2009 Aug 19 1:54 PM
Hi All,
I used IDOC to send data from SAP to XI in my previous assignments.
Now i have a requirement wherein i need to use an idoc to post data within SAP i.e in the same system. This is because incase the idoc fails the end user can correct the data and re-process the idoc and post it again. though its not so recommended its agreeded upon in the design phase.
now my doubt is in MASTER_IDOC_DISTRIBUTE should i set the control record so that it points to the same system which means the port i create which has an RFC which will point to the same system from where the report is run. is this the correct way.
thank you.
Regards,
Jayaram
Edited by: JAYARAM MAGANTI on Aug 19, 2009 2:55 PM
2009 Aug 19 5:25 PM
Yes, its the right way.. But the design not at all recommend..
2009 Aug 19 2:05 PM
2009 Aug 19 2:11 PM
Hi,
So is the below steps correct
1) create RFC is SM59 pointing to same system
2) create trfc in we21 for idoc
3) create partner profile in we20 with my idoc and port as above
4) get data and call master_idoc_distribute
Regards,
Jayaram
2009 Aug 20 3:26 AM
Jayaram,
Steps you mentioned are correct.
Pls maintain the values as I shown below , you will be able to post the idoc in the same system.
And one more suggestion , us fm 'IDOC_INBOUND_SYNCHRONOUS' as this will give you the idoc number in return. So that in the same program you can use it for any reporting purpose or you can show in the output screen the list of idocs generated etc.
DATA : lv_sysid LIKE sy-sysid.
***
gwa_edi_dc-tabnam = 'EDI_DC'.
gwa_edi_dc-mandt = sy-mandt.
gwa_edi_dc-docrel = sy-saprl.
gwa_edi_dc-status = '30'.
gwa_edi_dc-doctyp = 'ORDERS05'.
gwa_edi_dc-direct = '2'.
gwa_edi_dc-rcvpor = 'SAPxxx'.
REPLACE 'xxx' WITH sy-sysid INTO gwa_edi_dc-rcvpor.
gwa_edi_dc-rcvprt = 'LS'.
gwa_edi_dc-rcvprn = sy-sysid.
CONSTATNT : gc_clnt(4) TYPE c VALUE 'CLNT',
MOVE gc_clnt TO gwa_edi_dc-rcvprn+3.
MOVE sy-mandt(3) TO gwa_edi_dc-rcvprn+7.
gwa_edi_dc-sndpor = 'SAPxxx'.
CLEAR lv_sysid.
*Here you need to populate your sys id lv_sid
*example lv=sid = 'PDV'. "pdv is our producion system
REPLACE 'xxx' WITH lv_sysid INTO gwa_edi_dc-sndpor.
gwa_edi_dc-sndprt = 'LS'.
gwa_edi_dc-sndpfc = 'LS'.
gwa_edi_dc-sndprn = gc_sndprn."Comming as from Parameter.
gwa_edi_dc-credat = sy-datum.
gwa_edi_dc-cretim = sy-uzeit.
gwa_edi_dc-mestyp = 'ORDERS'.
gwa_edi_dc-exprss = 'X'.
CALL FUNCTION 'IDOC_INBOUND_SYNCHRONOUS'
EXPORTING
int_edidc = "control record ie gwa_edi_dc
online = 'O'
IMPORTING
docnum = lv_docnum " it gives idoc number
TABLES
int_edidd = "pass data record
EXCEPTIONS
idoc_not_saved = 1
OTHERS = 2.
Now you can use the idoc number anywhere you want .
wa_idoc-docnum = lv_docnum.
Best Regards,
Vvieks
"Grow and help others to grow"
2009 Aug 19 5:25 PM
Yes, its the right way.. But the design not at all recommend..