cancel
Showing results for 
Search instead for 
Did you mean: 

Attaching a file to a purchase Order from EP6 to R/3 4.6C

Former Member
0 Kudos

Hi,

I have an urgent requirement of attaching a file (Doc or PDF) to a purchase order. I have done this in R/3 using GOS_EXECUTE_SERVICE with servie name as 'CREATE_ATTA'. The same FM if I call from EP6 it is giving some errors.

If any one has some idea about his , how to achieve this functionality,

can u pl help me.

I am trying in different possible options like BDN, GOS etc, but could not achieve.

Thanks

Bhavani

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Maybe you can use the service: PCATTA_CREA

Former Member
0 Kudos

hi. this might be a little late regarding posting date of first request . I had same request from a customer . it tooks me 3 days of searches and tests to have the following code .

REPORT ZTESTJLG3 . .

parameter p_mandt like sy-mandt default '120' .

parameter p_equi type equnr default '1000007' .

parameter p_path like IBIPPARMS-path memory id AD_LOCAL_PATH .

parameter p_name(30) default 'Test attach 100007' lower case .

" nom attachement .

data w_prog like sy-repid .

data w_dynnr like sy-dynnr .

data w_attachement type borident .

initialization .

w_prog = sy-repid .

w_dynnr = sy-dynnr .

" test jean luc recuperer le code de

  • fucntion module 'GOS_EXECUTE_SERVICE'

data lo_container TYPE REF TO cl_gui_container .

*call method lo_container->get_container_type .

at selection-screen on value-request for p_path .

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = w_prog

DYNPRO_NUMBER = w_dynnr

FIELD_NAME = 'P_PATH'

IMPORTING

FILE_NAME = p_path .

start-of-selection .

if sy-mandt ne p_mandt .

write 'Erreur mandt ' .

exit .

endif .

data ws_borident like borident .

ws_borident-OBJKEY = p_equi.

ws_borident-OBJTYPE = 'EQUI'.

data w_document like SOOD4 .

data : begin of wt_files occurs 0 .

data fname(128) .

data end of wt_files.

wt_files-fname = p_path .

append wt_files .

data folder_id like SOODK .

call function 'SO_FOLDER_ROOT_ID_GET'

EXPORTING

region = 'B'

IMPORTING

folder_id = folder_id

EXCEPTIONS

others = 1.

w_document-foltp = folder_id-objtp .

w_document-folyr = folder_id-objyr .

w_document-folno = folder_id-objno .

  • append document to documents.

w_document-objdes = p_name .

w_document-objnam = p_name .

data w_h_data like sooD2 ..

data w_fol_data like sofm2.

data w_rec_data like soos6 .

w_h_data-objdes = p_name .

CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'

EXPORTING

METHOD = 'IMPORTFROMPC'

  • OFFICE_USER =

REF_DOCUMENT = w_document

  • NEW_PARENT =

  • IMPORTING

  • AUTHORITY =

TABLES

  • OBJCONT =

  • OBJHEAD =

  • OBJPARA =

  • OBJPARB =

  • RECIPIENTS =

  • ATTACHMENTS =

  • REFERENCES =

FILES = wt_files

CHANGING

DOCUMENT = w_document

HEADER_DATA = w_h_data

FOLMEM_DATA = w_fol_data

RECEIVE_DATA = w_rec_data .

.

if w_document-okcode = 'CREA' or w_document-okcode = 'CHNG'.

w_attachement-objtype = 'MESSAGE'.

w_attachement-objkey = w_document(34).

CALL FUNCTION 'BINARY_RELATION_CREATE_COMMIT'

EXPORTING

OBJ_ROLEA = ws_borident

OBJ_ROLEB = w_attachement

RELATIONTYPE = 'ATTA'

  • IMPORTING

  • BINREL =

  • TABLES

  • BINREL_ATTRIB =

EXCEPTIONS

NO_MODEL = 1

INTERNAL_ERROR = 2

UNKNOWN = 3

OTHERS = 4

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endif .

Former Member
0 Kudos

CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'

EXPORTING

METHOD = 'IMPORTFROMPC'

does this also work in batch mode, i need to do so

when not, do somebody know another way to make it work in batch mode

thanks for your help

Edited by: Martin Wimmer on Nov 5, 2008 10:23 PM

Former Member
0 Kudos

Hi Jean,

I have tried your provided code its working successfully for attach document for purchase requisition.

I have small doubt regarding this requirement after attach the document i am trying to see this document in ME52N but i c't find the attach file.

Please help any one which transaction i can find the attach file.

Thanks in advance,

Regards,

Rajesh v.

Former Member
0 Kudos

Hi All,

Please suggest me how to find attached document using above code.

Regards,

Rajesh v.

Former Member
0 Kudos

Hello,

we try to attach file to a PO in R/3 system using GOS but without success for the moment. What did you do with GOS_EXECUTE_SERVICE function module.

Thanks

JC

Former Member
0 Kudos

Hi Somaraju,

I am also looking for A CODE EXAMPLE TO ATTACH A DOCUMENT TO A AN sap OBJECT E.G. BUS222 AND ISUACCOUNT.

IF YOU'VE AN Example code that you can email me . it would be great.

thanks for the help.

geoge.