Getting IDoc Number after posting it frm Java Program

Hi All:
I had written a Java Program to post an IDoc into the SAP System. I was successful in posting an IDoc. My next step is, to get the Idoc number generated by SAP system for the posted IDoc. Using this IDoc number i want to track its status.
Can anyone please let me know how to get the IDoc Number from SAP from a Java program? I have Transaction ID with me, can i get IDoc Number via Transaction ID?
Please let me know ur views on this.
Thanks & Best Regard,
- - Rajiv

Hi Rajiv,
   Could you Please help to clear one thing .I am very new to SAP JCO Programming.To remove the dependency of Posting Data to SAP through RFC program which is written by SAP People ,I want to use IDoc,is it possible to use it ? if yes could u please help with Some Java code so i can post Data through Java Code to SAP with IDoc.
Wait for Your Kind Reply.
Thanks & Warm regards,
Kamal

Similar Messages

  • Get Idoc Number created through BD14

    Hi,
    I want to send some vendor details from SAP side to other system.And for that I am submitting BD14 using some vendor numberand message type cremas.
    Now whenever we execute BD14 transaction with a vendor it will create one idoc number.
    Now please let me know can we get this idoc number?
    If i go to we02 i can see that but i want the table from where i can get this idoc number as i want show it in my final report output.
    Edited by: Julius Bussche on Sep 12, 2008 4:45 PM

    Hi
    Its very simple.
    Use function module SREL_GET_NEXT_RELATIONS
    where :
    GWA_OBJECT-OBJKEY = VENDOR_NUMBER.
    GWA_OBJECT-OBJTYPE = 'LFA1'.
    CALL FUNCTION 'SREL_GET_NEXT_RELATIONS'
      EXPORTING
        OBJECT = GWA_OBJECT
      TABLES
        ROLES = GT_ROLES .
    DELETE GT_ROLES WHERE OBJKEY EQ VENDOR_NUMBER AND OBJTYPE EQ 'LFA1'.
    After that, you will get IDOC number in the OBJKEY field where OBJTYPE = 'IDOC'

  • How can we find the Idoc number which posts the material document in SAP

    Hi All,
    How can we find the Idoc number which posts the material document in SAP. We could not able to find the IDOC number from the material document which was posted by Idoc.
    Thanks
    Chandru

    Hi,
    In MIGO you can go to service of object(Just above show overview) and check 5th option workflow you will find the idoc number.
    regards
    suresh

  • How to get IDoc number using sdata records

    Hi Experts,
    I have executed a report program in background. Its generating few IDoc's. I can view those idoc's in WE05 also. But now i want to display those idoc number in the result output of the report. One of the segment having materrial number and plant details in the IDoc. Using this details i want to display the IDoc number in the output screen. Even i have tried with EDID4 table its taking huge time to get a single IDoc. Is there is any simplest way is there to get those idoc's .
    Otherwise how to achive this?
    Thanks and Regards,
    Mohana

    Hi,
    1.)If you want the ouput in the same report program which triggers the idoc, it is better to use the control record information.
    You will get IDoc Number from XEDIDC(check the below code) and you can store the idoc number into an internal table if more idoc is expecting to be triggered.
         call function 'MASTER_IDOC_DISTRIBUTE'
              exporting
                MASTER_IDOC_CONTROL        = EDIDC
              tables
                COMMUNICATION_IDOC_CONTROL = XEDIDC
                MASTER_IDOC_DATA           = XEDIDD
              exceptions
                others                     = 5.
       read table xedidc index 1.
      append xedidc-docno to it_docno.
    And finallly use this to display in the output.
    2.) if u want it in a seperate report, then select based on date, idoctype, messagetype
    Regards,
    Sajith

  • To get IDOC number when running MASTER_IDOC_DISTRIBUTE in update task.

    Hi ,
    I am running 'MASTER_IDOC_DISTRIBUTE' Func Module for creating FIDCC2 message type IDOC in UPDATE TASK. I am not getting IDOC number of the created IDOC in this case.
    Can anyone pls update me how do I get it?
    Thanks,
    Prabhu
    Note: Useful answers will be rewarded.........

    I found the resolution....
    Thanks all.

  • How to obtain the IDOC number after creation

    Hello everyone,
    for our master data distribution via report RHALEINI (triggered via a custom report), we have some additional code in BAdI HRALE00OUTBOUND_IDOC, method IDOC_DATA_FOR_RECEIVER_MODIFY.
    Everything is working fine so far. Now I need to know the Idoc number after it was created to store it in a customer table together with some additional data. Since the Idoc was not yet created when we're in the method mentioned above, I have to put my coding somewhere else.
    Any that's exactly my question: Were could I put my coding? It needs to be executed after MASTER_DATA_DISTRIBUTE since this function creates the idoc in the database.
    I though about the following:
    - Since RHALEINI is called by a custom report, I might be able to read the idoc number from memory id COMM_HRMD_A (see RHALEINI, line 418).
    - Maybe BAdI IDOC_DATA_INSERT could be used for this purpose?
    What would be your approach for this?
    Thank you in advance.

    Hello Markus,
    EXPORT comm_control TO MEMORY ID 'COMM_HRMD_A'.
    This is a nice observation!
    Since RHALEINI is called by a custom report, I might be able to read the idoc number from memory id COMM_HRMD_A
    Are you SUBMIT'ting the report RHALEINI in the custom program? If yes, you can access the memory COMM_HRMD_A in your program. To verify this you can check in debug mode if the memory id is populated.
    I've checked the report RHALEINI & the internal table comm_control should contain the idoc number!
    Maybe BAdI IDOC_DATA_INSERT could be used for this purpose
    Only if the previous approach doesn't work out. Remember [K.I.S.S|http://en.wikipedia.org/wiki/KISS_principle]
    BR,
    Suhas

  • Get plan number after calling IP01 using BDC

    Hi,
    I am using IP01 by BDC to create maintenance plan.
    Is there any mthode to get  plan number after the call instead of  reading the message table  within call statment.?
    Thanks.

    One possible way is find an implicit enhancement point and fill up the plan number to memory id and in your bdc call program import the same from memory id

  • How to get Get IDOC Number for Inbound IDOCS

    Hi,
    I am using the FM -- IDOC_INPUT_HRMD for creating Inbound IDOCS.
    I populate the values for Control Record and Data Record and the IDOC is posted successfully and i get the status 53 in the status Table.
    But the problem is the field for IDOC number(DOCNUM in IDOC_STATUS Table of the FM ) is empty.
    How can i get the DOCNUM for the IDOC posted as a result of this FM ?
    regards,
    Siddhartha

    Hi Siddhartha,
    I think you cannot call IDOC_INPUT_HRMD fm directly from the external program as this fm only handles the application logic part and not the idoc number generation and save part.
    So I think you have to call IDOC_INBOUND_SINGLE from your external program and then get the IDOC number.
    Then if you need the status records then you need to call another fm and feed IDOC number that you have got from IDOC_INBOUND_SINGLE (there is one IDOC_READ_COMPLETELY but it is not a remote enabled fm)
    <b>OK, I just found one RFC enabled fm which you can use,
    <b>EDI_DOCUMENT_READ_ALL_STATUS</b></b>
    Hope this helps..
    Sri
    Message was edited by: Srikanth Pinnamaneni

  • How to get IDOC Number in XI?

    hi,
    i have a scenario (IDOC->XI->SOAP) wherein i have to delete the specific IDOC that is sent and only after getting a successful  confirmation from the receiver.
    Is there a way to get the IDOC number?
    Thakns,
    tirumal

    Hi Tirumal,
    There will be a EDI_* segment in the Idoc . It will be having field called DOCNUM - is nothing but Idoc number.
    Please close other threads, if it is solved
    Thanks,
    Moorthy

  • Get idoc number of receiver system in a SAP-to-SAP scenario

    Hi,
    In a my custom program i create cremas idoc that i send to another SAP system to create the vendor in the second SAP.
    How can i do to get the inbound idoc number created in the receiver SAP to get and show its status in the sender SAP without to use the ALEAUD process?
    My scenario is SAP-SAP without anything between the two .
    Thanks lot.
    Matteo Vernile.

    Hi,
         Hi,
    The inbound IDoc is usually created by middleware system i.e. SAP XI, Gentran and etc.
    Once the IDoc created, you can use the inbound function module to post to the application. The function module is usually starting with 'IDOC_INPUT_xxxxx' where normally the xxxxx is the name of the IDoc message type.
    You can find the associated inbound process code/function module with the IDoc message type via transaction WE42.
    FM like IDOC_INBOUND_FROM_FILE...
    Check the Function module idoc_inbound_aysnchronous
    <b>Reward points</b>
    Regards

  • Document Number after Post !!

    Hi ,
    I am using Call Transaction in BDC .
    After Posting the document , the system generates an Accounting Document Number ..how can i get that document number after the call transaction call ??
    Thank You

    Hi,
    You can also code something like this.
    clear i_msgtab.
    refresh i_msgtab.
    call transaction 'VA02' using    bdcdata
                            mode     p_mode
                            update   'S'
                            messages into i_msgtab.
    if sy-subrc <> 0.
    *Process and display error messages
      loop at i_msgtab.
        clear t100.
        select single * from t100
        where sprsl = i_msgtab-msgspra and
              arbgb = i_msgtab-msgid   and
              msgnr = i_msgtab-msgnr.
        perform process_message using t100-text.
      endloop.
      skip.
    endif.
    form process_message using p_message.
      data: l_message(480).
      if sy-subrc = 0.
        l_message = p_message.
        if l_message cs '&1'.
          replace '&1' with i_msgtab-msgv1 into l_message.
          replace '&2' with i_msgtab-msgv2 into l_message.
          replace '&3' with i_msgtab-msgv3 into l_message.
          replace '&4' with i_msgtab-msgv4 into l_message.
        else.
          replace '&' with i_msgtab-msgv1 into l_message.
          replace '&' with i_msgtab-msgv2 into l_message.
          replace '&' with i_msgtab-msgv3 into l_message.
          replace '&' with i_msgtab-msgv4 into l_message.
        endif.
        condense l_message.
        write: /2 i_msgtab-msgtyp, l_message(250).
      else.
        write: /2 i_msgtab.
      endif.
    endform.                    " process_message
    Hope this will help.
    Regards,
    Ferry Lianto

  • Idoc Number which posts the GR doc..

    Hi All,
    Please let me know how the incoming idoc number can be identified which posts the GR for a PO.
    Thanks
    Chandru

    Hi ,
    Go to MIGO display the document there you will get servicess for object icon ,Click that button then click display relashion ship icon.It will show you corresponding Idoc number.
    Regards,
    JS

  • Loop through matrix before document saved (or get doc number after save)

    Hi All,
    I would like to loop through the matrix of a document (e.g. an invoice) before it is posted to the database (when the add button is clicked), but I would like to know at that point whether the invoice will definitely be posted.  When you look at ActionSuccess, the items in the matrix are already cleared.
    Alternatively I would like to get the number of the invoice that was added so I can loop through the invoice lines records in SQL.
    I have looked at quite a number of posts on tjis forum, but none of them has a definite answer to either of the options - or none I could find at least
    Your help is appreciated and thanks in advance,
    Adele

    Hi Adele,
    Here some thoughts form Frank and me:
    As you mention, it makes basically no sense to process anything in such a document when a user can still cancel the saving (what about approvals???!!!!!).
    To do the checks "after save" there are two options:
    An easier one which is not 100% reliable from a "data perspective" - and one which is 100% reliable, but is a bit more "dangerous" because you will need to rely on an event to come BeforeAction = True AND BeforeAction = False (remember the "BubbleEvent" etc.)
    Option 1.
    (Not 100% (99.5%?) reliable is like suggested in some posts, but sometimes basic things are missed:
    Use SQL in the ItemEvent handler:
    If pVal.ItemUID = "1" And
    pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And
    pVal.ActionSuccess = True Then
    "SELECT DocEntry FROM OINV WHERE UserSign = <internal number of user> AND UpdateDate = '<today>' AND DocTotal = <the value in UI> AND ...<maybe additional criteria as another person can reuse the user code - or a "DI API Add-On" may add a document in parallel>... ORDER BY DocEntry desc"
    Theoretically it could happen that through a second connection / application instance a document could be posted at the same time. That's why this way is not 100% reliable...
    Re time between "Add" and the SQL to retrieve the data being short (on what e.g. Florian relies on):
    Please take in mind that you cannopt really count on the time being that short (milliseconds) when thinking about speed of the client PC, network traffic, users working at the same time with a company database, overall database response when working with a bigger database etc. etc.!!!
    Option 2.
    In the ItemEvent handler when BeforeAction = True start a global transaction that will block the table. After the ActionSuccess (BeforeAction = False) make a select to the table to get the desired data, and finally end the Transaction by commiting the data.
    HTH,
    Felipe & Frank

  • Get IDoc-number from flat IDoc using dynamic configuration

    Dear experts
    In an IDoc2File scenario I have added the IDoc-number to dynamic configuration using the folling code in an UDF:
    DynamicConfiguration conf = (DynamicConfiguration)
    container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey FileName = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","DOCNUM");
    conf.put(FileName, a);
    The information is stored in the SOAP message
    <SAP:DynamicConfiguration SOAP:mustUnderstand="1">
      <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="DOCNUM">0000000000012345</SAP:Record>
    </SAP:DynamicConfiguration>
    Can anybody tell me how I can access this information in the "variable substitution" section of the CC? Perhaps something like "message:docnum"?
    Additional information:
    Taking the IDoc-number from the payload using e.g. "payload:ORDERS05,1,IDOC,1,EDI_DC40,1,DOCNUM,1" does not work, since the XML-IDoc has been converted to an flat-IDoc.
    Thanks in advance for any good ideas
    Markus

    Dear Rodrigo and Sarvesh
    Thanks for your help so far! I applied your hints and now it is working fine.
    But now I have the following additional questions
    1.) My message mapping only maps the input IDoc to an output IDoc of the same type and structure. The MM is only required to process the UDF. Is there another, better solution to achieve my requirement that the IDoc-number shall be part of the filename?
    2.) In the CC you have the possibility to use temporary files (section "Processing", Option "Put File" = "Use Temporary File". I think this will not work with the given solution, will it?
    To possibly help somebody else or clarify the mechanism once again, I wrote down how my solution now looks like.
    My UDF in the message-mapping looks like this
    - Input = DOCNUM of IDoc, e.g. ORDERS05/IDOC/EDIDC/DOCNUM
    - Outpt = DOCNUM of IDoc, e.g. ORDERS05/IDOC/EDIDC/DOCNUM
    - UDF:
    public String putDynamicConfiguration(String docnum, Container container) throws StreamTransformationException{
    try
         DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
         DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
         String filename = "Prefix_" + docnum + ".txt";
         conf.put(key, filename);
         return docnum;
    catch (Exception e)
         return docnum;
    In the CC the settings are now as follows
    File Name Scheme = . -> only a dot or something else, because this field is obligatory, even if it is not used in this case.
    Variable substitution (...)
        Enable -> unchecked
    Adapter-Specific Message Attributes
        Use Adapter-Specific Message Attributes -> checked
        Fail If Adapter-Specific Message Attributes Missing -> checked
        File Name -> checked
        Directory, File Type, Temporary Name Scheme for Target File Name -> unchecked
    When I send an IDoc to PI and view the Adapte-Engine Version of the message (the SOAP-document, not the payload) I can find the Filename:
    <SAP:DynamicConfiguration SOAP:mustUnderstand="1">
    <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">Prefix_0000000000012345.txt</SAP:Record>
    </SAP:DynamicConfiguration>

  • Get IDoc number for IDoc generated through RBDMIDOC

    Hi All,
    I have a requirement where in I need to send Vendor master information through CREMAS to PI system. I am using change pointer and batch job to trigger RBDMIDOC and send IDocs.
    In case the IDoc fails a mail needs to be triggered to concerned person giving vendor number, Idoc number and date. Can anyone suggest any user exit/BADI where this can be done ??
    Note: system is 4.7C.

    Hi Chinmay
    I didn't knew you were in 4.7. Since you mentioned about the details of the workflow getting triggered, here are the options i can think of.
    In case of error it is triggering the standard task 00007989 which you can check in PFTC. This task calls the method ERRORPROCESS from Business Object IDOCAPPL. My suggestion here would be to create a subtype of BO IDOCAPPL in SWO1 transaction and add additional logic in method ERROR_PROCESS to send the mail. The details of the IDOC number and other things are available in the task container of TS00007989. But make sure you do it specific for your message type, as this will be triggered for all message types. And then change the BO and method reference in task 00007989 to point to your new BO method.
    Other options would be to delegate the BO IDOCAPPL to a new Z BO, and then modify the method IDOCAPPL. This way you don't have to change the task BO assignment, as it will implicitly use the Z BO method. May be you can get in touch with your Workflow consultant who can help you more on this.
    Regards
    Ranganath

Maybe you are looking for

  • Keeps Ejecting PC Disk & Apps Sometimes Cover Desktop on Launchpad

    Hi. I'm loving OS X Lion and I like the gesture to bring up Launchpad and I can't wait for all apps to have fullscreen abilities so you could just swipe between apps. I still believe the gestures that Lion replaced specifically the reverse scrolling

  • Followup doc Service Contr of Doc Type ZZB from Service Contra of Doc ZZA

    Hi Expert I want to create Followup document  Service Contract of Document Type ZZB from Service Contract with Document   type ZZA I maintained all copy controls but i am not getting the Service COntract Type ZZB in the Follow up document from ZZA If

  • Iphoto and flickr sync is constantly pending

    The flickr album on my MAC shows 321 photos, but on flickr, I can only see 284 items.  I had tried to quit iphoto, reboot the mac, nothing helps.  Any ideas? Thanks Sean

  • Problem configuring DSN file

    Hi guys. I need some advice on how to configure an .DSN file on a Windows95. I need to link MS Access on this win95 to a Oracle DB located on a remote machine. (MS Access) ---> (Remote machine OracleDB) Thanks. MYI null

  • Can't get 3Gs to update to iOS4 after many attempts

    My husband and I both have 3Gs iPhones. When updating to iOS4 his worked the very first time! Granted it took about 2 hours start to finish, but at least it worked and is running perfectly. Mine, however, has yet to finish. Everytime I try to update