cancel
Showing results for 
Search instead for 
Did you mean: 

How to read attachments from IDOC_INPUT_INVOIC_MRM fm?

0 Kudos

I am getting invoice attachments to this fm. attachments looks something like this

1 84824849839849498984934903849348938493480348................

2 99848482848904850948509485094859048509458409580945809458...

3 38493984038904850948509485094580458094580948094

how to upload this to application server

here is my code:

loop idocdata to lw_idocdata.

IF lw_idocdata-segnam EQ '/ARBA/ATTACH_CONTENT'.

lv_lchar = lw_idocdata-sdata.
SHIFT lv_lchar BY 1 PLACES.
CONDENSE lv_lchar.
lv_xstring = lv_lchar.

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_xstring
append_to_table = abap_true
IMPORTING
output_length = lv_len
TABLES
binary_tab = lt_blob.
ENDIF.

endloop

OPEN DATASET lv_file FOR OUTPUT in BINARY MODE.
IF sy-subrc EQ 0.
LOOP AT lt_blob INTO ls_blob.
TRANSFER ls_blob TO lv_file.
ENDLOOP.
endif.
CLOSE DATASET lv_file.


I can see the file in al11(non readable form). when i download it through cg3y to my pc, i am not able see the pdf content. says couldn't open the pdf.

I have a doubt that incorrectly i am passing data to all through above code

Please help me with the issue. please check whether piece of code is right?

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member626875
Discoverer
0 Kudos

Hi, did you solve this topic? How did you solve it? Thanks