How to generate idoc after creating a bapi?

I have used the bapi_salesorder_createfromdat1 function module to create sales orders. Now how can i generate an idoc of the sales orders created and send it to other system. Please give a solution.
Edited by: Shakti on Nov 19, 2008 3:30 PM

after your bapi do the following
  wa_edidc-rcvprt = gc_ls. "Partner Type of Receiver
  wa_edidc-direct = 1.     "Outbound
Port is with simialr name of logical system
  IF sy-sysid EQ gc_ert.
    CONCATENATE: gc_xit gc_clt gc_200 INTO wa_edidc-rcvpor.
  ELSEIF sy-sysid EQ gc_erq.
    CONCATENATE: gc_xiq gc_clt gc_300 INTO wa_edidc-rcvpor.
  ELSEIF sy-sysid EQ gc_erp.
    CONCATENATE: gc_xip gc_clt gc_400 INTO wa_edidc-rcvpor.
  ENDIF.
XIT only 200 client No, XIQ always only 300 and XIP always only 400 - Confirmed by Markus/ Erik
  IF sy-sysid EQ gc_ert.
    CONCATENATE: gc_xit gc_clt gc_200 INTO wa_edidc-rcvprn.
  ELSEIF sy-sysid EQ gc_erq.
    CONCATENATE: gc_xiq gc_clt gc_300 INTO wa_edidc-rcvprn.
  ELSEIF sy-sysid EQ gc_erp.
    CONCATENATE: gc_xip gc_clt gc_400 INTO wa_edidc-rcvprn.
  ENDIF.
  wa_edidc-mestyp = gc_ymtspa01.  "Message Type
  wa_edidc-idoctp = gc_ywhspa01.  "IDoc Type
Move data records from internal table to the edidd structure.
Check Whether Invoice is already sent or not to AGCONet
  IF NOT gt_final_sp2[] IS INITIAL.
    SELECT *
      FROM ysmk_invoice01
      INTO TABLE gt_invoice01
      FOR ALL ENTRIES IN gt_final_sp2
    WHERE vbeln EQ gt_final_sp2-vbeln_vf.
    IF sy-subrc EQ 0 .
    ENDIF.
    LOOP AT gt_final_sp2 INTO wa_final_sp2.
      CLEAR : wa_invoice01,gv_index.
      gv_index = sy-tabix.
      READ TABLE gt_invoice01 INTO wa_invoice01 WITH KEY vbeln = wa_final_sp2-vbeln_vf.
      IF sy-subrc EQ 0.
        IF wa_invoice01-process EQ 'X'.
          IF p_check NE 'X'.         " To Ignore previously processed Orders
            DELETE gt_final_sp2 INDEX gv_index.
          ENDIF.
        ENDIF.
      ENDIF.
      CLEAR : wa_final_sp2.
    ENDLOOP.
  ENDIF.
  IF gt_final_sp2[] IS INITIAL.
    MESSAGE s222.
    LEAVE TO LIST-PROCESSING.
  ENDIF.
  LOOP AT gt_final_sp2 INTO wa_final_sp2.
    wa_sdata_sp2-chas_ser_num = wa_final_sp2-qausp.
    wa_sdata_sp2-mat_num = wa_final_sp2-matnr.
    wa_sdata_sp2-bill_doc = wa_final_sp2-vbeln_vf.
    wa_sdata_sp2-bill_type = wa_final_sp2-fkart.
    wa_sdata_sp2-cust_num = wa_final_sp2-kunnr.
    wa_sdata_sp2-fkdat = wa_final_sp2-fkdat.
    wa_sdata_sp2-kzwi5 = wa_final_sp2-kzwi5.
    wa_sdata_sp2-netwr = wa_final_sp2-netwr.
    wa_sdata_sp2-aedat = wa_final_sp2-aedat.
    wa_edidd-segnam = gc_z1whspf2."Segment Name.
    wa_edidd-sdata = wa_sdata_sp2.
    APPEND wa_edidd TO gt_edidd.
    CLEAR wa_edidd.
    wa_invoice01-vbeln = wa_final_sp2-vbeln_vf.
    wa_invoice01-process = 'X'.
    MODIFY ysmk_invoice01 FROM wa_invoice01.
  ENDLOOP.
  IF NOT gt_edidd[] IS INITIAL.
*---Function module to trigger the IDOC explicitly
    CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
      EXPORTING
        master_idoc_control            = wa_edidc
      TABLES
        communication_idoc_control     = gt_edidc
        master_idoc_data               = gt_edidd
      EXCEPTIONS
        error_in_idoc_control          = 1
        error_writing_idoc_status      = 2
        error_in_idoc_data             = 3
        sending_logical_system_unknown = 4
        OTHERS                         = 5.
    IF sy-subrc NE 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
*Commit work used if the Function module is executed successfully
      COMMIT WORK.
      READ TABLE gt_edidc INTO wa_edidc INDEX 1.
      IF sy-subrc EQ 0.
        WRITE:/ wa_edidc-docnum, text-003.
      ENDIF.
    ENDIF.
  ENDIF.
*---Clearing the internal table and work area for Data structures
  IF sy-subrc EQ 0.
    r_mestyp-low     = gc_ymtspa01.
    r_mestyp-sign    = gc_i.
    r_mestyp-option  = gc_eq.
    APPEND  r_mestyp TO r_mestyp.
    CLEAR:  r_mestyp.
    r_docnum-low     = wa_edidc-docnum.
    r_docnum-sign    = gc_i.
    r_docnum-option  = gc_eq.
    APPEND  r_docnum TO r_docnum.
    CLEAR:  r_docnum.
   SUBMIT rbdmoind WITH p_credat = sy-datum
   WITH p_step = 100 AND RETURN.
    SUBMIT rseout00 WITH docnum  IN r_docnum
                    WITH mestyp  IN r_mestyp
                    WITH p_compl = 'Y'
                    WITH p_rcvpor = 'XITCLT200'
                    WITH p_rcvprt = 'LS' AND RETURN.
    CLEAR: wa_edidc,wa_edidd.
    REFRESH: gt_edidc,gt_edidd.

Similar Messages

  • Outbound Idoc after created Invoice document

    Hi All,
    May i know how to create outbound idoc after invoice document created.
    Because i just found out some solution for inbound idoc.
    Regards,
    Luke

    You need to set up the Output type using the NACE tcode and this output type should be configured to trigger the IDOC. Check the below link.
    http://www.erpgenie.com/sapedi/messagecontrol.htm
    This output type can be linked with the IDOC type in WE20 tcode.
    ~Srini
    Edited by: VaasPal on Dec 22, 2011 8:13 AM

  • HOW TO GENERATE IDOC FOR CHECK LIKE RFFOEDI1

    Hi Gurus,
    I need a big help in this. This program RFFOEDI1 do payment summary (report) and generates IDocs and RFFOUS_C does the same for Check except generating and IDoc. Is there a way to or a program to that can do this for check i.e do payment summary (report) and generates IDoc. I was told i can create a new function module to do this but I dont know how to go about doing this.
    A big help will be seriously appreciated and rewarded.
    Thanks for your time.

    Hi Subramanian,
    Thanks for the quick reply. Both the program produce the summary, but only the RFFOEDI1 generates IDoc for payment (wire & ACH) exept checks. RFFOUS_C also does the same thing except that it doesn't generate the IDocs for checks.
    So what I'm trying to do is have a program that will work like RFFOEDI1 for checks i.e it will also generates IDocs for checks too.
    To be more clear, when the payment run program FII0 is ran, its gives a report of the payment and generates IDocs using the first program when its wire or ACH but when its checks, it uses the second program which doesn't generate checks.
    I was think if we can make a function module that will generates checks and call it in the RFFOUS_C. This is just a guess and i dont know if it will work.
    Please advice the best way to go about this and how.
    Thanks very much.

  • Getting dump in generating IDOC when creating sales order

    hi all,
    I am using a std FM IDOC_OUTPUT_TPSDLS to generate the outbound delivery create/change.
    and i have created a new output type and added in V2 application and the Processing program is RSNASTED & Form ALE_PROCESSING.
    When I create the SAles Order in VA01, I am getting dump " Update terminated" and checked in ST22.
    I am getting this error "An exception occurred. This exception is dealt with in more detail below       
    . The exception, which is assigned to the class 'CX_SY_DYN_CALL_PARAM_MISSING',
    was neither                                                                   
    caught nor passed along using a RAISING clause, in the procedure               
    "NEW_DYN_PERFORM" "(FORM)"                                                    
    Since the caller of the procedure could not have expected this exception       
    to occur, the running program was terminated.                                 
    The reason for the exception is:                                               
    When calling the function module "IDOC_OUTPUT_TPSDLS", one of the parameters   
    needed according to the interface description was not specified.                                                                               
    This parameter was "DELIVERY".       
    I am not sure why this error...because I am using only starndard FM & program, why this issues..
    Kindly guide me
    thanks

    True what u r telling.....................
    I am trying to create a IDOC while creating,change a delivery.
    should i have to change the Processing program RSNASTED , form ALE_PROCESSING ???... or IDOC funciton module is wrong?
    please need ur advice
    thanks for your input

  • How to generate IDOC while creation of Sales Orders

    Hi
       If i create a sales order means.. i want to trigger a IDOC with this ORDER data .. how can  we do this.. when ever i'm creating a sales order it should be automatically trigger a IDOC , Because  ehen ever sales ordre  was created in R/3 system it should be transferred to some destination.. all the ALE configurations are done.. .
        so, how can we trigger an IDOC based on Orders creation..
    Thanks
    Babu

    Hi,
    Here is the link
    [Re: Idoc creation;
    Regards
    Sudheer

  • How to generate idoc  PODRCH02 using out put type

    Hi All,
    I need to generate outbound idoc PORDCH02 and message type PORDCH using out put types (messages).But i unable to generated this idoc using message type. System is giving error as  *No recipient found for message type PORDCH in the ALE model*
    To do this , i have done the following steps.
    1. In BD64 i have configure the business object BUS2012, using add bapi. ( In cust.distn model it doesn't allowing the message type. so i have given BAPI )
    2. In partner profile (WE20), for sending logical sytems
    i have configure the message type in outbound parametes.
    3. In NACE for out put type NEU  i have given medium as Distribution (ALE),  Partner function as LS     
    Could you please help me out , what are the necessary steps i need to take care and what are the steps i missed out.
    Thanks and regards
    Praveen

    In distribution model, you have to configure both the sending system and receiving system. The Tcode of Distribution model is BD64.

  • How can i test after creating Message mapping transformations

    Hi guys,
    How can i test my transformation after creation of message mapping in Integration Repository.
    Pleae expain step by step procedure
    Thanks & Regards.,
    Pushparaju.B

    Hi,
    1. If you just want to test the mapping --In message Mapping there are three tab, the second one being hte Test tAb. So u can pu the values in the left side XML and do test.
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/e3072e65f04445a010847aa970b68b/content.htm
    2. You can do the Testing from Interface mapping also. There is a Test tab there too.
    3. If you have created the whole scnerio then you can do testing from Integration directory:
    http://help.sap.com/saphelp_nw04/helpdata/en/6b/874a4273bb3830e10000000a155106/content.htm
    Regards
    Vijaya

  • FCP X 10.6 how to change resolution after creating a project??

    Hello Everybody!
    Im a fairly new FCP X user and trying to do my best to understand everything.
    My problem is that im working on a project where i have most of the video  shot in 1280 x 720  29.97fps resolution, i also have some pictures, titles and graphics, but when i check the general properties of the project it says 640 x 480 29.97fsp. I guess when i started the project this setting was selected instead of 1280 x 720 and i didnt noticed. So my question is, How can i change the resolution from 640 x 480 to 1280 x 720 after the project is already started on
    the Timeline???
    I dont want to render the project on that resolution at the end since its very low, so i REALLY need to find a way to increase the resolution.
    Thanks in advance!

    The only way that I can imagine that you could have inadvertently created a 640X480 sequence is that one of your pictures or graphics is that size and must have been the first clip you dropped on the timeline.
    If your sequence (project) is actually 640X480, then only clips of that size would perfectly fill the frame. Your 720 clips would appear as letterboxed and whatever other clip sizes you had would be displayed differently yet.
    Now that you have resized your project resolution to 720, the upside is that your HD clips should now fill the the frame. But those 640X480 clips now should appear pillarboxed because they are a different aspect ratio.. You could simply leave it at that; I do it all the time – usually with a color matte as a background. If you dislike the pillarbox (and lots of people do), then go into the inspector and try the Fill Spatial Conform option. Depending on the image, that may or may not produce a better result. If it doesn't, work with scale and position in Tranform until you get what you need.
    Russ 

  • How to schedule ACE_DISPATCHER after creating the case.

    Hi all .
    I want to run ACE_DISPATCHER every time I create or change a case .
    As I am using ACE for Case.
    The background event SAP_CRM_ACE_DISPATCHER_REQUEST which is right now configured to run the ACE_DISPATCHER  every time Case is created or changed . But its not happening .
    If we manually activate the rights then I can see the relevant case else it does'nt show in the search result .
    some times system works fine ie;  The ACE_DISPATCHER runs fine and updates the ACE tables .
    Please advice .
    Regards,
    Naval Bhatt .

    It is possible the parameters set for the process is causing this.
    In the IMG activity, navigate to: CRM -> Basic functions -> ACE -> Maintain General Parameters.
    You (or someone in your group) have maintained the following parameters and more parameters relevant to the ACE Engine background processing.
    1. ACTIVATION_PCKG_SIZE
    2. MAXIMUM_RUNNING_JOBS
    3. DISP_SHUTDOWN_DELAY_TIME
    But, note that the performance impact of changing these values have to be evaluated before changing the default values.

  • How to send idocs from workflow ?

    Dear Alll,
    I need to send few idocs based on condition in my workflow .Can you please let me know how to go for it .Do we use business object for this ?If yes which business object.
    Kind Regards,
    Anshu Kumar

    Hi Anshu,
    I had the same scenario in my project where I had to send an IDOC to SAP MDM thorugh workflow.please follow the following steps:-
    1.After the configurations of IDOC are done Create a RFC or BAPI which contains the code for Populating the segments of the IDOC. After populating the IDOC you need use the function module MASTER_IDOC_DISTRIBUTE to send the IDOC to the destination.
    2.after creating the BAPI you need to create Z business object where you need to include the above BAPI for IDOC.
    3.After the Z business object is created then in your workflow create an activity, in the activity create task which will contain the method of z business object as was done in step 2.
    I followed these steps and was able to do it successfully. Let me know if you are unable to achieve it with the above mentioned steps or you have any doubts or need any clarification wrt to the steps above.

  • File to IDOC scenario: Create customer master and then return customer no

    Hi all.
    I have a scenario to pass xml file to sap XI to generate IDOC to create customer master in SAP. My problem is that I need to return customer no. created in SAP from IDOC. Is there any solution to do this? Someone told me that BPM could be used for doing this but I don't know the steps.I have no problem in create customer master in SAP. My only problem is how to return customer no.  Any help would be appreciate. Thank you.
    Best Regards,
    Pavin

    >>u can use synch-Asynch bridge using BPM
    This can not be done via sync-async bridge.There are 2 reasons for this
    1.He has file adapter as sender and that doesn't support synchronous scenarios.
    2.He has standard IDOC as receiver.there is no way you can fetch customer# from IDOC without writing a custom program,Thats why i said he need to either use RFC/Proxy or do some custom development.
    Thanx
    Aamir

  • Generating idoc for Purchase orders - ORDERS05

    Hi,
    Can you please let me know how to generate idoc for Purchase orders - ORDERS05-manually, not by activating change pointers.

    hi
    i believe u wont have this functionality as it is a transcational data and the one way of doing it by configuring output types only.

  • I am trying to generate purchase order and i create a BAPI also which is active. But when i call the BAPI from SYbase Mobile Object RFC then after calling it gives an Error "Conflict when calling a Function Module (Field Length)".

    i am trying to generate purchase order and i create a BAPI also which is active.
    But when i call the BAPI from SYbase Mobile Object RFC then after calling it gives an Error "Conflict when calling a Function Module (Field Length)".

    Hi,
    Yeah i tried my Z_BAPI in R3 and then giving some ERROR.
    This is my CODE-
    FUNCTION ZBAPIPOTV2.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(POHD) TYPE  ZPOHD OPTIONAL
    *"     VALUE(POITEM) TYPE  ZPOITEM OPTIONAL
    *"  TABLES
    *"      RETURN STRUCTURE  BAPIRET1 OPTIONAL
    data: ls_pohd type bapimepoheader,
             ls_pohdx TYPE bapimepoheaderx,
             lt_poit TYPE TABLE OF bapimepoitem,
             lt_poitx TYPE TABLE OF bapimepoitemx,
             ls_poit TYPE bapimepoitem,
             ls_poitx TYPE bapimepoitemx.
       MOVE-CORRESPONDING pohd to ls_pohd.
       MOVE-CORRESPONDING poitem to ls_poit.
       ls_pohdx-comp_code = 'x'.
       ls_pohdx-doc_type = 'x'.
       ls_pohdx-vendor = 'x'.
       ls_pohdx-purch_org = 'x'.
       ls_pohdx-pur_group = 'x'.
       ls_poit-po_item = '00010'.
       APPEND ls_poit to lt_poit.
       ls_poitx-po_item = '00010'.
       ls_poitx-po_itemx = 'x'.
       ls_poitx-material = 'x'.
       ls_poitx-plant = 'x'.
       ls_poitx-quantity = 'x'.
       APPEND ls_poitx to lt_poitx.
    CALL FUNCTION 'BAPI_PO_CREATE1'
       EXPORTING
         POHEADER                     = ls_pohd
        POHEADERX                    =  ls_pohdx
    *   POADDRVENDOR                 =
    *   TESTRUN                      =
    *   MEMORY_UNCOMPLETE            =
    *   MEMORY_COMPLETE              =
    *   POEXPIMPHEADER               =
    *   POEXPIMPHEADERX              =
    *   VERSIONS                     =
    *   NO_MESSAGING                 =
    *   NO_MESSAGE_REQ               =
    *   NO_AUTHORITY                 =
    *   NO_PRICE_FROM_PO             =
    *   PARK_COMPLETE                =
    *   PARK_UNCOMPLETE              =
    * IMPORTING
    *   EXPPURCHASEORDER             =
    *   EXPHEADER                    =
    *   EXPPOEXPIMPHEADER            =
      TABLES
        RETURN                       = return
        POITEM                       = lt_poit
        POITEMX                      = lt_poitx
    *   POADDRDELIVERY               =
    *   POSCHEDULE                   =
    *   POSCHEDULEX                  =
    *   POACCOUNT                    =
    *   POACCOUNTPROFITSEGMENT       =
    *   POACCOUNTX                   =
    *   POCONDHEADER                 =
    *   POCONDHEADERX                =
    *   POCOND                       =
    *   POCONDX                      =
    *   POLIMITS                     =
    *   POCONTRACTLIMITS             =
    *   POSERVICES                   =
    *   POSRVACCESSVALUES            =
    *   POSERVICESTEXT               =
    *   EXTENSIONIN                  =
    *   EXTENSIONOUT                 =
    *   POEXPIMPITEM                 =
    *   POEXPIMPITEMX                =
    *   POTEXTHEADER                 =
    *   POTEXTITEM                   =
    *   ALLVERSIONS                  =
    *   POPARTNER                    =
    *   POCOMPONENTS                 =
    *   POCOMPONENTSX                =
    *   POSHIPPING                   =
    *   POSHIPPINGX                  =
    *   POSHIPPINGEXP                =
    *   SERIALNUMBER                 =
    *   SERIALNUMBERX                =
    *   INVPLANHEADER                =
    *   INVPLANHEADERX               =
    *   INVPLANITEM                  =
    *   INVPLANITEMX                 =
    ENDFUNCTION.
    i am trying to generate purchase order and i create a BAPI also which is active. But when i call the BAPI from SYbase Mobile Object RFC then after calling it gives an Error "Conflict when calling a Function Module (Field Length)". 

  • How to find out idoc num after creating a costomer or vendor .....etc

    hai
    i had to find out idoc number after creating a customer, for that particular customer, i know to find out bygoing to the transaction WE05, but it is very tedious to find the idoc num for that particular customer, is it possible to find from the application it self with out going to WE05
    if so please help me,
    reward guarenty
    thanks in advance
    sindu

    Hi ,
    In  Customer  Display   Tcode -- XD03 ,
    Extras ---> Customer Partner Function ---> ( Pls  check  Logical System LS )
    Regards.

  • How to extend Generated Idoc types?

    I want to create Idoc type ZMRESCR01 as an Extension of Basic Idoc type MRESCR01.
    I have created the Segments that I want to add to the Basic type using transaction WE31.
    When I try to extend the Basic Idoc type with transaction WE30, the error message "Action is not possible for generated idoctypes" appears.
    In Note 913901, I have read that I can extend this Basic type using transactions BDFG and BDBG, but I can't find any documentation about how to do it.
    Can you point me to any documentation or show me how to extend Generated Idoc types?
    Reward points are waiting for responses.

    Hello,
    I will answer my own question.
    After sending an OSS note to SAP, this is what they answered (my words):
    The error is not that in most recent releases extension of generated Idoctypes is not allowed. The error is that in previous versions it was possible to extend such Idoctypes!
    In fact, Note 913901, corrected this error. So, what you have to do if you want to extend this Idoctype is:
    1. Copy the BAPI of the method I want to extend (For me, it is BAPI_RESERVATION_CREATE) and modify it, adding the new fields.
    2. Use transaction BDBG to create a new ALE interface. Then a new Idoctype, new Inbound and Outbound Function Modules and new Message will be created for my new BAPI.
    This is the Note I created: 0001040039.
    As for the documentation on transaction BDBG, they provided me a link to the Sap help:[http://help.sap.com/saphelp_nw70/helpdata/en/78/21740f51ce11d189570000e829fbbd/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/en/78/21740f51ce11d189570000e829fbbd/frameset.htm].
    I hope this helps someone,
    Narcís Abio

Maybe you are looking for

  • Windows 8.1 Mail App - Cannot Send Mail

    The fact that this problem has been ongoing for TWO+ YEARS with no clearly defined fix makes me want to take my SP3 back to the store and go buy an iPad, even though I hate Apple products. I think I'm voicing the frustrations of the people here when

  • Problem to come back from sleep mode in Lenovo Thinkpad T400 using Windows XP

    Problem to come back from sleep mode  in Lenovo Thinkpad T400 using Windows XP. Each time closing the T400 lid and try to make the laptop into a sleep mode for some time, it does not properly come out of sleep mode. Login screen is able to see when o

  • Only excise posting need to be done

    Hi, 1.  Once a material is manufactured & posted to unrestricted stock, its available for sales & the subsequent RG1 entries are posted. 2. If the same material is required again for reprocessing, the goods can be removed from the stock only with the

  • SOA restore

    Hello, We have SOA suite installed, and as to how to restore SOA, 1. we can't use RMAN for tablespace/or full database restore. Because there are many other schemas , we just want to restore some messed up(or single) schemas in database. (sorry, all

  • Botón de reposo/activación problema

    Tengo un Iphone 5 (comprado en Uruguay en noviembre de 2012) que presenta el problema del botón de reposo/activación. No funciona. Provisionalmente estoy usando una función de apagado que figura en Configuración (Assistive Touch) pero quiero tener el