Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Attach Image to Invoice

Former Member
0 Kudos

Hi All

I need to read image from application server and attach it to Invoice .

It wld be helpful if anyone suggest fn module to read image from application server and more attach to invoice.

Thanks

Arunachala.G

2 REPLIES 2

Former Member
0 Kudos

Below is the code base which is used to upload a picture from the SAP Application Server.

TYPES pict_line TYPE x LENGTH 1022.

DATA l_mime_api TYPE REF TO if_mr_api.

DATA l_pict_wa TYPE xstring.

DATA l_pict_tab TYPE TABLE OF pict_line.

DATA l_length TYPE i.

DATA l_url TYPE c LENGTH 255.

l_mime_api = cl_mime_repository_api=>get_api( ).

l_mime_api->get(

EXPORTING i_url = '/SAP/PUBLIC/BC/ABAP/Sources/PLANE.GIF'

IMPORTING e_content = l_pict_wa

EXCEPTIONS OTHERS = 4 ).

IF sy-subrc 0.

RETURN.

ENDIF.

l_length = XSTRLEN( l_pict_wa ).

WHILE l_length >= 1022.

APPEND l_pict_wa(1022) TO l_pict_tab.

SHIFT l_pict_wa BY 1022 PLACES LEFT IN BYTE MODE.

l_length = XSTRLEN( l_pict_wa ).

ENDWHILE.

IF l_length > 0.

APPEND l_pict_wa TO l_pict_tab.

ENDIF.

CALL FUNCTION 'DP_CREATE_URL'

EXPORTING

type = 'IMAGE'

subtype = 'GIF'

TABLES

data = l_pict_tab

CHANGING

url = l_url.

picture->load_picture_from_url(

EXPORTING url = l_url ).

picture->set_display_mode(

EXPORTING display_mode = picture->display_mode_stretch ).

The Entire code is available in the program DEMO_CFW.

Former Member
0 Kudos

Hi

I need to attach image to invoice ...fb03.. when I user create->attachment.. its asking popup to enter the file location.

I need to enter the filepath in my program from the selection screen .. ie from application server ..

It wld be helpful to give the picture of this.

Thanks

Arunachal.G