Tuesday, December 8, 2015

Getting xstring value from Source / URL



Code snippet to get Xstring value from source file either URL or Path File


DATA lr_mime_repository TYPE REF TO if_mr_api.
  
"
  
" Variables
  
DATA lv_img_xstring TYPE xstring.

  
SELECT SINGLE zparam_val1 FROM zett_value
  
INTO gv_img_source
  
WHERE zformtyp 'ED03'
    
AND zparam_id1 'PATH'
    
AND zparam_id2 'NOPHOTO'.


  
TRY.
      
"MIME repository reference
      lr_mime_repository 
cl_mime_repository_api=>get_api( ).

      
"Get file from MIME
      
CALL METHOD lr_mime_repository->get
        
EXPORTING
          i_url             
gv_img_source
          i_check_authority 
' '
        
IMPORTING
          e_content         
lv_img_xstring.

    
CATCH cx_root.
  
ENDTRY.

  
"Return binary representation of file
  gv_image_default 
lv_img_xstring.

No comments:

Post a Comment