Post IDOC within same SAP system

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

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"

Similar Messages

  • IDOCS: Inbound non-SAP system

    Hi
    The outbound idocs works fine. I want to create an inbound goods receipt/movement idoc.
    Should i rather write RFC to update the SAP system from a non-SAP system ?

    Hi,
    Your first query...
    Should i rather write RFC to update the SAP system from a non-SAP system ?
    Always prefer using idocs for posting before BAPI / RFC fucntion module.
    As you have mentioned outbound idocs are working fine..which means you are able to create idocs from non-sap system..right? If so you can use same idoc type for posting.
    Your second query's answer...
    Check out following code for calling BAPI_GOODSMVT_CREATE
    You need to code to call function module /BAPI in your posting program as follows..
    append the data into the corresponding internal tables and work-area, check for the IMPORT and TABLES parameter in the function module BAPI_GOODSMVT_CREATE.
    a.     GOODSMVT_HEADER-DOC_DATE = SYST-DATM
    b.     GOODSMVT_HEADER -PSTNG_DATE = RECEIPT_DATE (Input File)
    c.     GOODSMVT_HEADER - HEADER_TXT = BATCH ID (Input File)
    d.     GOODSMVT_HEADER - GR_GI_SLIP_NO = GOODS_INWARD_NO (Input File)
    e.     GOODSMVT_ITEM-MOVE_TYPE = Constant ‘101’
    f.     GOODSMVT_ITEM-PO_NUMBER = PURCHASE_ORDER_NO (Input File)
    g.     GOODSMVT_ITEM -PO_ITEM  = PURCHASE_ORDER_LINE_NO (Input File)
    h.     GOODSMVT_ITEM –PLANT = From Selection Screen (WERKS)
    i.     GOODSMVT_ITEM – STGE_LOC = From Selection Screen (LGORT)
    j.     GOODSMVT_ITEM -ENTRY_QNT = QUANTITY_RETURNED (Input File)
    k.     GOODSMVT_ITEM -NO_MORE_GR = COMPLETE_INDICATOR (Input File). Value ‘X’ if status = ‘X’ else space.
    6.     Call the function module BAPI_GOODSMVT_CREATE.
    7.     Use function module BAPI_TRANSACTION_COMMIT to do the commit work.
    append the data into the corresponding internal tables and work-area, check for the IMPORT and TABLES parameter in the function module BAPI_GOODSMVT_CREATE.
    a.     GOODSMVT_HEADER-DOC_DATE = SYST-DATM
    b.     GOODSMVT_HEADER -PSTNG_DATE = RECEIPT_DATE (Input File)
    c.     GOODSMVT_HEADER - HEADER_TXT = BATCH ID (Input File)
    d.     GOODSMVT_HEADER - GR_GI_SLIP_NO = GOODS_INWARD_NO (Input File)
    e.     GOODSMVT_ITEM-MOVE_TYPE = Constant ‘101’
    f.     GOODSMVT_ITEM-PO_NUMBER = PURCHASE_ORDER_NO (Input File)
    g.     GOODSMVT_ITEM -PO_ITEM  = PURCHASE_ORDER_LINE_NO (Input File)
    h.     GOODSMVT_ITEM –PLANT = From Selection Screen (WERKS)
    i.     GOODSMVT_ITEM – STGE_LOC = From Selection Screen (LGORT)
    j.     GOODSMVT_ITEM -ENTRY_QNT = QUANTITY_RETURNED (Input File)
    k.     GOODSMVT_ITEM -NO_MORE_GR = COMPLETE_INDICATOR (Input File). Value ‘X’ if status = ‘X’ else space.
    6.     Call the function module BAPI_GOODSMVT_CREATE.
    7.     Use function module BAPI_TRANSACTION_COMMIT to do the commit work.
    Hope this will help you.
    Cheers,
    Nilesh

  • Receiving IDocs from non-SAP system ...

    Hello guys,
    I have problem with implementing IDoc-XI-IDoc scenario. The sender system is a subsystem (non-SAP system) sending IDocs but XI is not able to receive them. I thing the IDoc metadata can not be found.
    Logical system name of the sender is IF6020DEV. I registered the system in SLD. In Integration Directory I imported the Bussines System IF6020DEV to my scenario and I created communication channel of type Sender IDoc Adapter in it.
    In IDX2 I created new port called IF6020DEV and I copied needed metadata into the port. But it doesn't work. Probably I don't do it right because I'm beginner with SAP XI.
    Could you give me any advice how to configure XI for receiving IDocs from non-SAP system?
    Thank you in advance!
    Regards
    Zbynek

    Thank you very much. The issue described in refered discussion is almost same issue what I'm solving. Unfortunetally the described solution dosn't work for me.
    The sender system still returns following error. I know you probably won't understand it because you don't know the subsystem, but maybe you could get some idea what is wrong.
    05/29/09 16:09:19.482 idoup2 Logon...
    05/29/09 16:09:19.482 idoup2 RfcOpenEx (TRACE=1 CLIENT=110 USER=xxxxxx LANG=D LCHECK=1 GWHOST=xxxxxx GWSERV=3361 ASHOST=xxxxxxx SYSNR=61 PASSWD=<password>)
    05/29/09 16:09:19.529 idoup2 Logon RfcOpenEx result=1
    05/29/09 16:09:19.607 idoup2 Call to (IDOC_INBOUND_ASYNCHRONOUS) failed (3)
    05/29/09 16:09:19.607 idoup2 Handle=1
    05/29/09 16:09:19.607 idoup2 key............:
    05/29/09 16:09:19.607 idoup2 status.........:
    05/29/09 16:09:19.607 idoup2 message........:IDoc-Adapter Eingang: Der Absenderport ist initial
    05/29/09 16:09:19.607 idoup2 internal status:
    05/29/09 16:09:19.607 idoup2 idoc_upload failed with rc=(3), try(2)
    05/29/09 16:09:20.607 idoup2 key............:IDoc-Adapter Eingang: Der Absend
    05/29/09 16:09:20.607 idoup2 status.........:EXCEPTION SYSTEM_FAILURE RAISED
    05/29/09 16:09:20.607 idoup2 message........:IDoc-Adapter Eingang: Der Absenderport ist initial
    05/29/09 16:09:20.607 idoup2 internal status:
    05/29/09 16:09:20.607 idoup2 idoc_upload failed with rc=(18), try(1)
    05/29/09 16:09:21.607 idoup2 Logoff...

  • Send idoc to external sap system

    hi all,
    is it possible to send IDoc to a sap system which is not in the same network with XI? If yes, is there any special points that should be taken care?
    Regards,
    Hui

    HI Hui
    It is possible. But it is IDOC to IDOC Scenario.
    Check these below SAP contribution docs on Idoc-Idoc scenario:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c09b775e-e56e-2910-1187-d8eba09c7a4a
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f6d2d790-0201-0010-9382-b50b499b3fbe
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/903a0abc-e56e-2910-51a8-9dc616df56eb
    Cheers..
    Vasu
    <i>** Reward points if found useful **</i>

  • *IDOC INBOUND ( NON SAP system - SAP system )*

    I am transferring IDOC  INBOUND ( NON SAP system ->> SAP system ) by calling SAP standard funtc module IDOC_INBOUND_SINGLE using SAP JCo.
    In which I am passing all necessary information in Control Record regarding sender and receiver port/IDOC/segment etc.
    BUT help me to clarify my doubt that if i am calling a function and i am able to access SAP FM, then why i have to specify the SAP port/RFC connection at RECEIVER end in WE21.
    Whats the Significance if i am calling the FM from same SAP system and configuring the port explicitly in WE21.*
    If i don't Specify in we02 i am getting error as EDI : RECEIVER PORT in CONTROL RECORD is INVALID

    Dear Sree,
    For Basic understanding of IDOC read : saptechnical - Step-by Step ALE IDOC guide ( all necessary TCodes available here )
    Kindly let me know your data flow .
    In short :
    As per my scenario the data flow is from  non SAP to SAP  i,.e. Inbound processing.
    At my non SAP  i am calling SAP standard function IDOC_INBOUND_SINGLE using SAP Jco 2.1.
    You have to fill all Control Structure EDI_DC40 ( port etc. ) and Table parameter EDI_DD40 ( segment etc. )
    Read IDOC status and error in WE02.
    Goodluck.
    - Aakash

  • Sending IDoc from Non-SAP system to XI

    Dear all,
       We have a non sap system which needs to send IDoc to XI, Please could you answer my following four questions
    1. What should be the values for the following fields in the IDoc control record
    e.g. RCVPRN = <logical system name of XI>
    SNDPOR
    SNDPRT
    SNDPRN
    RCVPRT
    RCVPOR
    2. How does XI decide which port(idx1) to be used when it receives an idoc
    3. The third party system is a non sap one, so it does not have a client no, so I would assume, I need to use another SAP system as a meta data provider, in that case, how would i tell XI to use that port when it receives IDocs from the non-SAP system ?
    4. In what step does XI use the logical system name of the Business system(in SLD)?
    Thanks in advance
    cheers
    danus
    Edited by: Chidambaram Danus on Jan 25, 2008 2:21 PM

    Hi
    there is bit wrong interpretation of the statement
    If the sender system is a non-SAP system, the sender service is identified from the logical system name of the sender port.
    If the sender system is nonSAP it indicates taht the data is coming to XI from non sap systems such as file, database, webservice etc. to XI and from XI it will pass to sap as IDOC inbound.
    For this you need to create the logical system in SAP (receiver) and pass on that value to IDOC header.
    You could maintain it in the Business service used for Sender system (nonSAP). here it will be available in the tabs ---> History.
    note : IDOC is the concept of data container in SAP, you will not be able to have the IDOCs in non sap systems...
    Thanks
    Swarup
    Edited by: Swarup Sawant on Jan 25, 2008 2:54 PM

  • HTTP Receiver Adapter - Post HTTPS to non-sap system

    I plan on doing an https post to a non-sap system using the http rec adapter.  Will I need to make some config changes to enable ssl communication on the XI system?  Will I need the certificate of the target system?
    Thanks,
    Mark

    Hi Mark,
    You will need Certificate to enable SSL communication.
    And once you install your certifictaes on the systems according to the above blog then there are few changes which needs to done on XI side.
    On XI Server - Go to SM59 and Create HTTP destination to the system with SSL enabled in that destination.Select active option for SSL.
    In confguration - Go to HTTP rec channel and select HTTP destination and here give the one which u have created in last step.

  • How to check the Idocs sent from SAP system

    How to check the outbound Idocs sent from SAP system to target systems.
    How to know the message types and target systems.

    Hi,
    In Addition with the above mentioned transaction code(WE02), u can check out idocs in these table - EDIDC, EDID4, EDIDS.  Depending on different status you can differentiate them as Inbound or Outbound Idocs...
    Cheers...
    Santosh.
    <i><b>Mark All Usefull Answers...</b></i>

  • Two different company in same SAP system ?

    Dear Gurus,
    I came across a requirement from Client
    There is a company A which is having own business . This company A operates/manage company B (all panning/execution/sales purchase/inventory etc) but not in Books of account. From legal point of view company A is funding company B & generates profit/loss.
    But practically company A manages all Business of Company B like a group company but from legal point of view it is a Third party in which company A has Investment . In management reporting they shows all the details of company B.
    The reason of this kind of arrangement is govt licence.
    In there current situation they have there own legacy system on which they manages this all things ( 2 different Data base ) & its legal .
    Can this be mapped in same SAP System ( say as different company code or any other way ) ? ? How ?
    Regards,
    Ishwar

    Dear Christian,
    Actually I feel that may be that is possible by creating a new company code but i am more concern from Audit point of view
    Auditor might have problem : why i am mapping some other (legal point of view ) company Transaction in my system ?
    if anybudy has came across similar situation please guide
    Ishwar

  • Post IDOC internally in same SAP system

    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

    Hi,
    You can test in the same system
    But make sure that the using partner profile(WE21) is having Collect IDOC's option so that the IDOC are not transferred to the target system.
    Hope this helps
    Regards
    Shiva

  • XI system idoc transfer to SAP system.

    hi ,
    this is parthasarathi,i am using ALE/IDOC.basically i need to transfer idoc from XI system to SAP system.
    can any one help me out in this case.
    my system is SAP system ie inbound system.
    i am using message type HRMD_A and idoc type is HRMD_A04.
    1)what are the steps i need to take in the inbound system..?
    2)what is the function module i need to use?
       how this is reflecting SAP system.
    3) idoc will be generated in XI system with employee master data and the same idoc generated in  XI system ,that idoc should be send to SAP system ie inbound system.
    can any help me out ..
    thanks.
    partha.

    Hi parthasarathy,
    To connect the two systems u need a connection called as RFC.(sm59)
    medium of transaction is port (we21)
    IDOC Intermediate document - travelling (or) data carrying from 1 - 2
    create partner profiles for sharing the appln. (we20)
    application linking and enabling (ALE)--used to generate an idoc in sender side and post it in the receiver side.
    r3 - r3 -use ALE - transactional rfc
    r3 - non r3 - use EDI (electronic data interchange) - file port
    bridge (bd64) - distribution model view
    to view idoc's (we05,we02)
    types of data
    1. master data -- ale -- eg. send materail(bd10),customer(bd12),vendor(bd14)
    2.transactional data -- ale
    3.control data -- cts(correction and transport systems)
    Hope this gives u overall idea of how to use idoc's.
    Regards,
    Nagarajan.

  • Segment creation for outbound Idocs to non-SAP system

    Hi,
    I need to create a custom idoc for outbound interface to a non-SAP system. Here I need to create segments. So, should I create the fields in the segment with the attributes of fields in non-SAP system or fields attributes should be of SAP system.
    For example:
    There is a field invoice number which is of 10 Chars in SAP but in legacy it is divided into 2 fields: invoice prefix of 2 chars and invoice no. of 8 chars. Should my segment contain one invoice field of 10 chars or should it be two fields with 2 and 8 chars?
    In general, always should the segment fields contain field attributes based on receiving system?
    Thanks in advance.
    Sriram.

    Hi
    Should my segment contain one invoice field of 10 chars or should it be two fields with 2 and 8 chars?
    I think it shoild be better to have 2 fields, but probably the result will be the same if you send the idoc by a text file, because both informations should be contiguos, I mean if you have file with a record like this:
    1234567890
    This record can be obtained downloading a segment with 2 fields:
    FIELD1 = '12'
    FIELD2 = '34567890'.
    or single field:
    FIELD = '1234567890'.
    So it'll be the same for tje target system
    In general, always should the segment fields contain field attributes based on receiving system?
    It depends on who has to convert the idoc to the right format for the target system
    I mean you can create a "SAP" Idoc, so the receiving system will have to convert it to the right format
    or
    you can send the idoc in the right format, so the receiving system doesn't need to convert it
    Max

  • IDOC between 2 sap system

    Hi,
    I need to send Idoc from SAP system(A) to SAP system(B).
    In system B i need to store data in custom table.
    Correct me for below settings
    in system A
    1) define RFC that point to system B
    2) define port in WE21 that point to above rfc
    3) maintain partner profile for outbound idoc in Logical system in WE20
    4) trigger IDOC
    Now IDOC is sent to system B
    In system B
    1) maintain receiver port in IDX2 that has system A clinet and RFC pointing to system A
    2) maintain inbound partner profile for the same idoc with a Z process code.
    write code inside Z process code to save data in custom table.
    Now i am not able to Z process code as it says ALE settings not maintained. i created new FM ...assigned it to a z proces code in WE42.
    what other steps should i do.
    Also my other doubt is if another user maintains for the same message type another process code will 2 idocs get generated in system B whenever i trigger idoc from system A..which i dont wont to happen...is there a way to stop it.

    Hi,
    It seems that your ALE configuration is not done properly. Check your logical system setting with both System A and System B. then RFC destination with Tcode SM59. After that you go ahead with your logic and  Z program. it will work.
    As you ask you dont want others data then you shoul check with your function consultant that they use there data and if data is no longer useful you remove that one eith block that one.
    Regds,
    Rakesh

  • FM to recive the Idocs from Non-SAP system.

    Hi Gurus,,,,
    Is there any FM to recive the IDocs from the outside(Non-SAP) into SAP system.
    Thanks In Advance.
    Abhi....

    hi digvijay
    You could refer to this link which has method to convert  xml to Idoc:
    http://www.wmusers.com/forum/showthread.php?t=9059
    Best Regards
    Manthan.

  • Restrict inactive HR employee to be sent through IDOC to another SAP system

    Requirement: HR employee data (ONLY ACTIVE EMPLOYEES) needs to be sent from one SAP system to another SAP system.
    E.g. of process followed u2013
    Tcode - PA30 - Action type u2018Hireu2019 is created for employee A, B, C & D for a specific date. Later another action u2018Retirementu2019 is created for the employee C. So in the current system employee A, B and D are active employees wherein employee C is an inactive employee.
    Data filtering is set in the Distribution Model wherein only active employees should be passed when an IDOC is created using PFAL.
    The IDOC which is created has all the employees A, B, C & D. The only difference being that for Employee C the segment which has the status u2018Retirementu2019 is discarded and hence this does not satisfy the requirement.
    Is there any way in which the Inactive employee (e.g. retired) is restricted from being sent to the IDOC.
    Please advise.
    Rasika

    Hi Darek,
    Thanks for your response.
    I cannot use this as the requirement does not allow customised development. I want to know whether the filter can be done solely by customising.
    Regards,
    Rasika

Maybe you are looking for