Return order creation.

Hi, Expert,,
My issue:
1 ) I had create sales order for 2 Quantity.
2 I had completed PGI for 2 Quantity
3 ) I had complleted billing for this 2 Quantity,
But after billing customer want to return,
then
1 ) I had created return order with references to billing no - for 2  Quantity
2 ) I had completed PGR.- for 2  Quantity
3 ) I had created credit memo for -  for 2  Quantity
But by mistake user - created two times return process for that billing document no,
User receive worning message at a time return order creation - is There are already returns for item 000010: 2 EA
But i want to set error message if user create more quantity return order wrt to billing no.
Can anybody send me it's solution ASAP,
Thanks a lot in advance
Regards:
Happy

Hi ..
Since user is creating returns with reference to billing doc , he will not be able to create more quantity than in billing doc.
if he try's it will give error message , since in your case there was already a return order excist that why the erro message displayed an order already excist.
Hope it helps
jinoy

Similar Messages

  • Return Order creation referanace to billing document.

    Hi , Experts,
                   I have one issue regarding return process , Pls do the needful ASAP.
    My question : I have created one direct sales order , After thet i have created PGI & billing , But after created billing document , I want to take return taht goods, So i had created return for same sales order quantity, & also created credit memo. But my problem is, that system allow me futher create return sales order with referance to billing document no. At a return order creation time system only give warning message - (There are already returns for item 000010: 2 EA)
    & allow to save return document no. But i want to erroe message after take return all billing quantity. Can any body suggest me, what is the customizing require for this,
    Thanks a lot in advance.
    Regards;
    Happy

    Hi, abdul sir,
                     Here no any error message, My problem is that , why all line item comes in delivery, B'cause i had already deliver 5 line item out of 10 item, Here system take delivered line item with 0 quantity, I don't want that delivered  line item at a time in delivery,
    Regards:
    Happy

  • BADI for return order creation in CRM

    Hi group,
    I have an requirement. In CRM ,Return order should be created from UBB service contract when change process takes place(Contract termination), ie throgh actions in the UBB service contract. these steps are configured through Actions.
    The requirement is, I need to enhance the  BADI implemention(COPY_DOCUMENT) by creating a function module. this function module should provide the necessary data for Return Order creation. Is there any function module to create a Return order in CRM or how to proceed? Appreciate if any suggestions
    Regards,
    Sankar

    Hi,
           You can use BAPI_SALESORDER_CREATEFROMDAT2 .
    In import TESTRUN = X
    Description
    This parameter is a test switch.
    If you activate the switch, the system does not save the document.
    Value range
    Space = Document should be saved
      X   = Document should not be saved
    Default
    Space

  • Inactivate the cash discount condition type during return order creation.

    Hi All,
    I have created a Pricing procedure its having a  condition type Cash Discount.
    The client requirment is during the return order creation system should inactivate the cash discount condition type.
    Please sugget me what to do to fulfill this requirment.
    Thanks in advance.
    Regards
    Vankat.

    Hi
    You can achieve through creating new pricing procedure for Return process
    Otherwise try with user exit
    MV45AFZZ  USEREXIT_SAVE_DOCUMENT_PREPARE
    Maintain access Sequence with Document type and maintain condition record , so at the time of return order system wont pick that material 
    Regards,
    Prasanna
    Edited by: prasanna_sap on Feb 9, 2012 3:31 PM

  • Blocking of deleted material in Return Order creation

    Hi everyone,
    Can somebody please teach me how to block a particular deleted material in Return Order creation.  I have already blocked it in Sales Order creation using OVSU.
    Thanks in advance.

    hi,
    same t.code - OVSU
    Block f.returns - sales order return
    Block for order - sales order
    regards
    senya

  • Return Order Creation with Multiple Lines not possible - EHP3

    Hi Experts,
    We are facing an issue while creating Return Orders with external reference billing document post upgrade from CRM 7.0 to EHP3.
    While we select multiple line items from the external reference billing document and Create a return order(BT120H_CPL/NewComplEF ), the very first line item gets repeated instead of all the line items getting copied to the subsequent view(BT120H_CPL/ItemList ).
    Please help.
    Thanks,
    Rohit

    I hope you have tried.If not can you  please try with  below qualifier
    '015' Billing Document Number of Invoicing Party
    Provide the billing document EEDK02-BELNR.
    Also give qualifier at item level
    E1EDP02 : use Qualifier =15
    Provide the Billing document number at E1EDP02_BELNR and item at ZEILE.
    I am not sure what is error you are getting when you are referencing billing document.If something STD Idoc  is not working as you expected use your custom logic to bring the data when you are posting the Idoc.
    I have not worked on sales order process,But I have worked on Purchase Order creation process.
    Please let me know the error ,If i know the error i will defiantly help you.

  • Return Order Creation with Multiple Lines not possible - 7.0 to EHP3

    Hi Experts,
    We are facing an issue while creating Return Orders with external reference billing document post upgrade from CRM 7.0 to EHP3.
    While we select multiple line items from the external reference billing document and Create a return order, the very first line item gets repeated instead of all the line items getting copied to the subsequent view(BT120H_CPL/ItemList ).
    Please help.
    Thanks,
    Rohit

    >>. But is it possible in PI 7.0?
    Just few cents..
    Test using SOAPUI or  XMLSPY and use that same WSDL URL in the target URL of Communication channel. Just to make sure you use the right endpoint.
    or
    You can specify the method name as  soap action dynamically using udf in mapping and see how it behaves.

  • Error during return order creation in CRM online

    Hi all,
    When I create return order via transaction CIC0 with reference to standard order ( B2C ) then some times system gives error after saving the return order. The text of the error message is very confusing , It says"
    Message no. CRM_ORDER_MISC 020
    Diagnosis
    Errors have occured while transferring the document into another system. Remove the error messages from the enclosed log.
    <i><u>"Transmission log
    Message no. CRM_ORDER_MISC 020
    Diagnosis
    Errors have occured while transferring the document into another system. Remove the error messages from the enclosed log.
    Document xxxxxxxxxx doesn't have document category  but (Notification E V2 068)
    Sales document xxxxxxxxxx was not changed (Notification E V4 219)"</u></i>
    I have tried to replicate this return order with all the available tools but during save this message is coming from R/3.
    Regards,

    I would suggest you to try to create a return order in R3 system (from where the error is coming) with the same parameters.
    Usually that should give you the same error... Resolve the issue, then try to create order in CRM online. Now error should not be there.
    Regards,
    Kaushal

  • Returns order to Vendor with delivery

    Hi,
    I am doing returns order to vendor with delivery. Shipping data has been determined during return order creation, but delivery is not getting created. Please guide me through this....

    Hi,
    have been there before, couple of things need to check
    1. maintain supplying plant as return plant
    IMG-Material Management-Purchasing-Purchase order- returns order-returns to vendor
    Here, make sure you've maintained Puurchasing Doc type as "NB" and Del,Type f. Retur as "RL"
    2. add customer master data representing "return vendor"
    3, checked "Return vendor" on the Purchasing segment for vendor
    4  Assign vendor on customer master  (under vendor master general data's control section)
    Hope it will help
    Thanks,
    Linda

  • VPRS-based condition redetermined in return order (referencing billing doc)

    I have an issue with copy-control from invoice to return order.
    I want the invoice pricing conditions to be copied unchanged to the return order.
    This is similar to when creation the Sales order>Delivery>Billing Document.
    I need to make a return order for the same amount as in the original sales order (naturally, we want to credit the same amount).
    This works fine for all conditions, except for a VPRS-based condition, which is redetermined upon return order creation.
    The VPRS-based condition should fetch the moving average price for the sales order only, not for the return order.
    I have maintained copy control for billing document to sales order with pricing type 'G'
    G: Copy pricing elements unchanged and redetermine taxes. The system
    This works fine for Sales order --> Delivery --> Invoice, but not for Invoice --> Return order.
    I would prefer not to use a formula, but I guess one alternative solution is to fetch the condition value from the original sales order if I cannot do this with customizing.
    Let me know what you think about the forumla (VOFM) and if it is possible to achieve copy-control with unmodified condition values for the VPRS-condition.
    Thanks!

    Ok, thanks for your input!
    I'm sharing my solution:
    I implemented a new condition value formula for my pricing procedure:
    VOFM>Formulas>Condition value
    FORM FRM_KONDI_WERT_XXX.
      DATA: lv_kbetr TYPE kbetr,
            ls_vbfa  TYPE vbfa,
            lv_knumv TYPE knumv.
    Get moving average price for return order from SO
    The ZPRS pricing condition modifies price in return order
    The value of ZPRS should be the same in return order and SO
      IF xkomv-kschl EQ 'ZPRS'.
    Get sales order and position
        SELECT SINGLE vbelv posnv
          INTO corresponding fields of ls_vbfa
          FROM vbfa
          WHERE vbeln   EQ komp-vgbel  "invoice number
            AND posnn   EQ komp-vgpos  "invoice item
            AND vbtyp_n EQ 'M'         "invoice
            AND vbtyp_v EQ 'C'.        "order
        IF sy-subrc EQ 0.
    Get sales order conditions key
          SELECT SINGLE knumv
            INTO lv_knumv
            FROM vbak
            WHERE vbeln EQ ls_vbfa-vbelv.
          IF sy-subrc EQ 0.
    Get moving average price from sales order conditions
            SELECT SINGLE kbetr
              INTO lv_kbetr
              FROM konv
              WHERE knumv EQ lv_knumv
                AND kposn EQ ls_vbfa-posnv
                AND kschl EQ 'ZPRS'.
            IF sy-subrc EQ 0.
    Recalculate condition values
              xkomv-kbetr = lv_kbetr.
              xkomv-kwert = ( lv_kbetr * komp-mgame / 1000 ).
              xkwert      = xkomv-kwert.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.

  • Regarding user-exit for customer return order in sales order creation

    Hi,
    My problem is when sales order type ZRE(Customer return) is created with refrence to Invocie i have to check the quantity in the return order is less than the original invoice or not.If quantity in return order is greater than invoice quantity then i have to raise error message.For this which user-exit is suitable in sales order program SAPMV45A.
    Thanks,
    shyla kumar

    Hi
        Use can use MV45AFZZ AND MV45AFZB userexits
    Within mv45afzz USE CAN form related to VBAP or
    save_document_prepare.
    Please reward if useful.

  • Creation of return order with ref to an Invoice

    Hi SD Experts,
    When i create return order RE with reference to a Billing document F2, storage location from the original document is getting copied into the return sales order.
    My requirement is, the storage location should not be copied since returns are supposed to go to a different storage location. Is there a standard way to control this. I was checking in copy control. Not able to find one.
    Thanks for your help.
    Regards
    Raghavendran

    Hi Raghavendran Gundurao,
    I too had same requirement, i mapped it by following changes in configuration.
    storage location determination depends on Sh.pt+ plant+ storage cond.
    & sh.pt will get determined on the basis of plant+ shipping cond. + loading group.
    Create new shipping pt for return  (Eg. ZRE) & do the basis setting like assignment  to plant  & check whether return storage location  is maintained in plant.
    Also new shipping cond: ( e.g.: RE)
    maintain shipping condition(RE) in Return order setting (VOV8) as it has a priority over customer master shipping condition.
    Do the shipping pr determination RE+ your loading group+plant
    then do the picking location determination Sh.pt (ZRE)+ plant = return storage location
    By doing this your Shipping point will get redermined to ZRE in return sales order. & your new return storage location  in delivery.
    pls make sure that storage location is not mandatory field in sales order (incomletion procedure)
    if you have any further queries let me know.
    Regards,
    chetan

  • Update terminate during return sales order creation (Delivery processing)

    Hi,
    I have having issues with a scenario while creating delivery in a 4.7 system. When creating a return order (using FM SD_SALESDOCUMENT_CREATE) our system is configured to automatically generate deliveries for the return SO.
    The scenario we are facing an issue in is, during data processing, a delivery is created using FM W_FRM_DELIVERY_CREATE_GENERAL, delivery is then processed for picking and PGI using FM WS_DELIVERY_UPDATE.
    For the next record, a return order is created using FM SD_SALESDOCUMENT_CREATE, which also automatically tries to create the delivery. At this point we get an update terminate upon COMMIT and dump says SAPSQL_ARRAY_INSERT_DUPREC pointing towards form VBFA_BEARBEITEN.
    Based on my analysis, while updating table VBFA the internal table DA_XVBFAI also has document flow for the previously processed regular sales order for which the system tries to insert a record in VBFA. This is a duplicate record and the update is terminated. The buffer nees to be refreshed and I tried using FM SHP_DELIVERY_BUFFER_REFRESH and LE_DELIVERY_REFRESH_BUFFER. None of these seem to refresh the VBFA buffer.
    I would appreciate if anyone can share their experience with this issue. Thanks for your help!
    -Roger

    Hi,
    Try using one of these function modules BUTX_FRG0010_CLEAR_BUFFER or CK_F_SHARED_BUFFER_DELETE or COM_IL_DB_RESET_BUFFER or SNC_USER_FLUSH_BUFFER .
    KR Jaideep,

  • Error in : Purchase order Creation using BAPI_PO_CREATE1

    Hell  guys,
    I am trying to create a PO using a BAPI - BAPI_PO_CREATE1
    I want the new PO to have all the characteristics of an existing PO. whose PO # is  stored in wa_order_split_create-docnr and for the new PO, i want the quantity from wa_order_split_create-qty_acptd and the delivery data to be wa_order_split_create-dly_date. But this process and code below gives a short dump in the std FM - MEPO_DOC_ITEM_GET . It raises an exception of failure. I am trying to create many new PO's in the loop below. If there is just one row, sometimes, it creates the PO even with the exception failure ( which is pretty weird).
    Am i making any mistake while filling the header or item or schedule lines for the BAPI_PO_CREATE1 ? Any tips or clues why I am getting a dump ?
    DATA: i_insert,
            i_create_order,
            i_cycle     TYPE cycle,
            i_qty_acpt  TYPE dzmeng,
            i_dly_date  TYPE vbak-vdatu,
            i_item      TYPE roijnomiio .
      DATA: i_order TYPE symsgv,
            i_return TYPE swd_return .
      DATA: i_vbak      TYPE vbak,
            i_vbap      TYPE vbap,
            i_ekko      TYPE ekko,
            i_ekpo      TYPE ekpo,
            i_bsoh      TYPE bapisdhd1,
            i_bsohx     TYPE bapisdhd1x,
            i_bpoh      TYPE bapimepoheader,
            i_bpohx     TYPE bapimepoheaderx,
            i_vbeln     TYPE vbeln_va,
            i_posnr     TYPE posnr_va,
            i_contr     TYPE vbeln_va,
            i_conit     TYPE posnr_va,
            i_ebeln     TYPE ebeln,
            i_ebelp     TYPE ebelp,
            i_pargr     TYPE pargr,
            i_thead     TYPE thead,
            i_line      TYPE tline,
            i_note      TYPE txw_note,
            i_new_vbeln TYPE vbeln_va,
            i_new_ebeln TYPE ebeln,
            i_wa_bsoi   TYPE bapisditm,
            i_wa_bsoix  TYPE bapisditmx,
            i_wa_bsop   TYPE bapiparnr,
            i_wa_bsos   TYPE bapischdl,
            i_wa_bsosx  TYPE bapischdlx,
            i_wa_vbpa   TYPE vbpa,
            i_wa_vbkd   TYPE vbkd,
            i_wa_bpoi   TYPE bapimepoitem,
            i_wa_bpoix  TYPE bapimepoitemx,
            i_wa_bpos   TYPE bapimeposchedule,
            i_wa_bposx  TYPE bapimeposchedulx,
            i_wa_bpop   TYPE bapiekkop,
            i_wa_ekpa   TYPE ekpa,
            i_message   TYPE char72,
            i_bapiretn  TYPE bapiret2,
            i_bapiret2  TYPE TABLE OF bapiret2 INITIAL SIZE 1,
            i_vbpa      TYPE TABLE OF vbpa INITIAL SIZE 1,
            i_vbkd      TYPE TABLE OF vbkd INITIAL SIZE 1,
            i_ekpa      TYPE TABLE OF ekpa INITIAL SIZE 1,
            i_bsoi      TYPE TABLE OF bapisditm INITIAL SIZE 1,
            i_bsoix     TYPE TABLE OF bapisditmx INITIAL SIZE 1,
            i_bsos      TYPE TABLE OF bapischdl INITIAL SIZE 1,
            i_bsosx     TYPE TABLE OF bapischdlx INITIAL SIZE 1,
            i_bsop      TYPE TABLE OF bapiparnr INITIAL SIZE 1,
            i_bpoi      TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
            i_bpoix     TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
            i_bpos      TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
            i_bposx     TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
            i_bpop      TYPE TABLE OF bapiekkop INITIAL SIZE 1,
            i_text_tab  TYPE TABLE OF tline INITIAL SIZE 1,
            i_line_tab  TYPE TABLE OF tline INITIAL SIZE 1,
            i_txw_note  TYPE TABLE OF txw_note INITIAL SIZE 1,
            i_oij_el_doc_mot TYPE oij_el_doc_mot .
      CONSTANTS: c_char_c VALUE 'C',
                 c_char_e VALUE 'E',
                 c_char_p VALUE 'P',
                 c_char_g VALUE 'G',
                 c_char_i VALUE 'I',
                 c_char_s VALUE 'S',
                 c_char_x VALUE 'X',
                 c_zsw(3) VALUE 'ZSW',
                 c_nomit_stat(4) VALUE 'ZDNY' .
      DATA : lv_nomtk_split        TYPE oij_nomtk.
      DATA : i_order_split_create  TYPE TABLE OF zsws_order_split.
      DATA : wa_order_split_create TYPE zsws_order_split.
      LOOP AT i_order_split_create INTO wa_order_split_create.
        IF NOT i_create_order IS INITIAL .
          CLEAR: i_create_order .
              MOVE: wa_order_split_create-docnr  TO i_ebeln,
                    wa_order_split_create-docitm TO i_ebelp .
              CALL FUNCTION 'ME_EKKO_SINGLE_READ'
                   EXPORTING
                        pi_ebeln         = i_ebeln
                   IMPORTING
                        po_ekko          = i_ekko
                   EXCEPTIONS
                        no_records_found = 1
                        OTHERS           = 2.
              IF sy-subrc <> 0 .
              ENDIF .
    * Fill PO Header
              i_bpoh-comp_code   = i_ekko-bukrs .
              i_bpoh-doc_type    = i_ekko-bsart .
              i_bpoh-vendor      = i_ekko-lifnr .
              i_bpoh-langu       = i_ekko-spras .
              i_bpoh-pmnttrms    = i_ekko-zterm .
              i_bpoh-purch_org   = i_ekko-ekorg .
              i_bpoh-pur_group   = i_ekko-ekgrp .
              i_bpoh-currency    = i_ekko-waers .
              i_bpoh-agreement   = i_ekko-konnr .
              i_bpoh-incoterms1  = i_ekko-inco1 .
              i_bpoh-incoterms2  = i_ekko-inco2 .
    * Fill PO update indicator 'X'
              i_bpohx-comp_code  = c_char_x .
              i_bpohx-doc_type   = c_char_x .
              i_bpohx-vendor     = c_char_x .
              i_bpohx-langu      = c_char_x .
              i_bpohx-pmnttrms   = c_char_x .
              i_bpohx-purch_org  = c_char_x .
              i_bpohx-pur_group  = c_char_x .
              i_bpohx-currency   = c_char_x .
              i_bpohx-agreement  = c_char_x .
              i_bpohx-incoterms1 = c_char_x .
              i_bpohx-incoterms2 = c_char_x .
              CALL FUNCTION 'ME_EKPO_SINGLE_READ'
                   EXPORTING
                        pi_ebeln         = i_ebeln
                        pi_ebelp         = i_ebelp
                   IMPORTING
                        po_ekpo          = i_ekpo
                   EXCEPTIONS
                        no_records_found = 1
                        OTHERS           = 2.
              IF sy-subrc <> 0 .
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
              ENDIF .
    * Fill PO Item
              i_wa_bpoi-po_item    = i_ekpo-ebelp .
              i_wa_bpoi-material   = i_ekpo-matnr .
              i_wa_bpoi-plant      = i_ekpo-werks .
              i_wa_bpoi-stge_loc   = i_ekpo-lgort .
              i_wa_bpoi-quantity   = wa_order_split_create-qty_acptd .
              i_wa_bpoi-po_unit    = i_ekpo-meins .
              i_wa_bpoi-tax_code   = i_ekpo-mwskz .
              i_wa_bpoi-val_type   = i_ekpo-bwtar .
              i_wa_bpoi-item_cat   = i_ekpo-pstyp .
              i_wa_bpoi-acctasscat = i_ekpo-knttp .
              i_wa_bpoi-agreement  = i_ekpo-konnr .
              i_wa_bpoi-agmt_item  = i_ekpo-ktpnr .
              APPEND i_wa_bpoi TO i_bpoi .
    * Fill PO Item update indicator 'X'
              i_wa_bpoix-po_item    = i_ekpo-ebelp .
              i_wa_bpoix-po_itemx   = c_char_x .
              i_wa_bpoix-material   = c_char_x .
              i_wa_bpoix-plant      = c_char_x .
              i_wa_bpoix-stge_loc   = c_char_x .
              i_wa_bpoix-quantity   = c_char_x .
              i_wa_bpoix-po_unit    = c_char_x .
              i_wa_bpoix-tax_code   = c_char_x .
              i_wa_bpoix-val_type   = c_char_x .
              i_wa_bpoix-item_cat   = c_char_x .
              i_wa_bpoix-acctasscat = c_char_x .
              i_wa_bpoix-agreement  = c_char_x .
              i_wa_bpoix-agmt_item  = c_char_x .
              APPEND i_wa_bpoix TO i_bpoix .
    * Fill PO Item Schedule
              i_wa_bpos-po_item       = i_ekpo-ebelp .
              i_wa_bpos-sched_line    = '0001' .
              i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
              i_wa_bpos-quantity      = wa_order_split_create-qty_acptd .
              APPEND i_wa_bpos TO i_bpos .
    * Fill PO Item schedule update indicator 'X'
              i_wa_bposx-po_item       = i_ekpo-ebelp .
              i_wa_bposx-sched_line    = '0001' .
              i_wa_bposx-delivery_date = c_char_x .
              i_wa_bposx-quantity      = c_char_x .
              APPEND i_wa_bposx TO i_bposx .
              CLEAR: i_pargr .
              SELECT SINGLE pargr
                INTO i_pargr
                FROM t161
               WHERE bstyp = i_ekko-bstyp
                 AND bsart = i_ekko-bsart .
              CLEAR i_ekpa[].
              CALL FUNCTION 'MM_READ_PARTNERS'
                   EXPORTING
                        application = c_char_p
                        ebeln       = i_ebeln
                        bstyp       = i_ekko-bstyp
                        pargr       = i_pargr
                   TABLES
                        x_ekpa      = i_ekpa[].
              LOOP AT i_ekpa INTO i_wa_ekpa .
                i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
                i_wa_bpop-langu = sy-langu .
                IF NOT i_wa_ekpa-lifn2 IS INITIAL .
                  i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
                ELSE .
                  i_wa_bpop-buspartno = i_wa_ekpa-parnr .
                ENDIF .
                APPEND i_wa_bpop TO i_bpop .
                CLEAR: i_wa_ekpa, i_wa_bpop .
              ENDLOOP .
              CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
              CALL FUNCTION 'BAPI_PO_CREATE1'
                   EXPORTING
                        poheader         = i_bpoh
                        poheaderx        = i_bpohx
                   IMPORTING
                        exppurchaseorder = i_new_ebeln
                   TABLES
                        return           = i_bapiret2
                        poitem           = i_bpoi[]
                        poitemx          = i_bpoix[]
                        poschedule       = i_bpos[]
                        poschedulex      = i_bposx[].
              i_order = i_new_ebeln .
              SHIFT i_order LEFT DELETING LEADING '0' .
              i_return-errortype = c_char_i .
              i_return-workarea  = c_zsw .
              i_return-message   = '064' .
              i_return-variable1 = i_order .
            loop at i_bapiret2 into i_bapiretn where type ca 'EAX' .
            append i_bapiretn to t_bapi_return .
          endloop .
          if t_bapi_return[] is initial .
             i_create_order = c_char_x .
               CALL FUNCTION 'SWD_POPUP_MESSAGE_SEND'
                   EXPORTING
                        act_return = i_return. "Popup with new PO no.
          ENDCASE .                                     " Docind
        ENDIF .
      ENDLOOP.

    Hi Shareen,
    I think in the following parts of the code,
              CALL FUNCTION 'MM_READ_PARTNERS'
                   EXPORTING
                        application = c_char_p
                        ebeln       = i_ebeln
                        bstyp       = i_ekko-bstyp
                        pargr       = i_pargr
                   TABLES
                        x_ekpa      = i_ekpa[].
    Error in : Purchase order Creation using BAPI_PO_CREATE1
    Posted: Mar 20, 2006 7:39 PM      Reply      E-mail this post 
    Hell guys,
    I am trying to create a PO using a BAPI - BAPI_PO_CREATE1
    I want the new PO to have all the characteristics of an existing PO. whose PO # is stored in wa_order_split_create-docnr and for the new PO, i want the quantity from wa_order_split_create-qty_acptd and the delivery data to be wa_order_split_create-dly_date. But this process and code below gives a short dump in the std FM - MEPO_DOC_ITEM_GET . It raises an exception of failure. I am trying to create many new PO's in the loop below. If there is just one row, sometimes, it creates the PO even with the exception failure ( which is pretty weird).
    Am i making any mistake while filling the header or item or schedule lines for the BAPI_PO_CREATE1 ? Any tips or clues why I am getting a dump ?
    DATA: i_insert,
            i_create_order,
            i_cycle     TYPE cycle,
            i_qty_acpt  TYPE dzmeng,
            i_dly_date  TYPE vbak-vdatu,
            i_item      TYPE roijnomiio .
      DATA: i_order TYPE symsgv,
            i_return TYPE swd_return .
      DATA: i_vbak      TYPE vbak,
            i_vbap      TYPE vbap,
            i_ekko      TYPE ekko,
            i_ekpo      TYPE ekpo,
            i_bsoh      TYPE bapisdhd1,
            i_bsohx     TYPE bapisdhd1x,
            i_bpoh      TYPE bapimepoheader,
            i_bpohx     TYPE bapimepoheaderx,
            i_vbeln     TYPE vbeln_va,
            i_posnr     TYPE posnr_va,
            i_contr     TYPE vbeln_va,
            i_conit     TYPE posnr_va,
            i_ebeln     TYPE ebeln,
            i_ebelp     TYPE ebelp,
            i_pargr     TYPE pargr,
            i_thead     TYPE thead,
            i_line      TYPE tline,
            i_note      TYPE txw_note,
            i_new_vbeln TYPE vbeln_va,
            i_new_ebeln TYPE ebeln,
            i_wa_bsoi   TYPE bapisditm,
            i_wa_bsoix  TYPE bapisditmx,
            i_wa_bsop   TYPE bapiparnr,
            i_wa_bsos   TYPE bapischdl,
            i_wa_bsosx  TYPE bapischdlx,
            i_wa_vbpa   TYPE vbpa,
            i_wa_vbkd   TYPE vbkd,
            i_wa_bpoi   TYPE bapimepoitem,
            i_wa_bpoix  TYPE bapimepoitemx,
            i_wa_bpos   TYPE bapimeposchedule,
            i_wa_bposx  TYPE bapimeposchedulx,
            i_wa_bpop   TYPE bapiekkop,
            i_wa_ekpa   TYPE ekpa,
            i_message   TYPE char72,
            i_bapiretn  TYPE bapiret2,
            i_bapiret2  TYPE TABLE OF bapiret2 INITIAL SIZE 1,
            i_vbpa      TYPE TABLE OF vbpa INITIAL SIZE 1,
            i_vbkd      TYPE TABLE OF vbkd INITIAL SIZE 1,
            i_ekpa      TYPE TABLE OF ekpa INITIAL SIZE 1,
            i_bsoi      TYPE TABLE OF bapisditm INITIAL SIZE 1,
            i_bsoix     TYPE TABLE OF bapisditmx INITIAL SIZE 1,
            i_bsos      TYPE TABLE OF bapischdl INITIAL SIZE 1,
            i_bsosx     TYPE TABLE OF bapischdlx INITIAL SIZE 1,
            i_bsop      TYPE TABLE OF bapiparnr INITIAL SIZE 1,
            i_bpoi      TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
            i_bpoix     TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
            i_bpos      TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
            i_bposx     TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
            i_bpop      TYPE TABLE OF bapiekkop INITIAL SIZE 1,
            i_text_tab  TYPE TABLE OF tline INITIAL SIZE 1,
            i_line_tab  TYPE TABLE OF tline INITIAL SIZE 1,
            i_txw_note  TYPE TABLE OF txw_note INITIAL SIZE 1,
            i_oij_el_doc_mot TYPE oij_el_doc_mot .
      CONSTANTS: c_char_c VALUE 'C',
                 c_char_e VALUE 'E',
                 c_char_p VALUE 'P',
                 c_char_g VALUE 'G',
                 c_char_i VALUE 'I',
                 c_char_s VALUE 'S',
                 c_char_x VALUE 'X',
                 c_zsw(3) VALUE 'ZSW',
                 c_nomit_stat(4) VALUE 'ZDNY' .
      DATA : lv_nomtk_split        TYPE oij_nomtk.
      DATA : i_order_split_create  TYPE TABLE OF zsws_order_split.
      DATA : wa_order_split_create TYPE zsws_order_split.
      LOOP AT i_order_split_create INTO wa_order_split_create.
        IF NOT i_create_order IS INITIAL .
          CLEAR: i_create_order .
              MOVE: wa_order_split_create-docnr  TO i_ebeln,
                    wa_order_split_create-docitm TO i_ebelp .
              CALL FUNCTION 'ME_EKKO_SINGLE_READ'
                   EXPORTING
                        pi_ebeln         = i_ebeln
                   IMPORTING
                        po_ekko          = i_ekko
                   EXCEPTIONS
                        no_records_found = 1
                        OTHERS           = 2.
              IF sy-subrc <> 0 .
              ENDIF .
    Fill PO Header
              i_bpoh-comp_code   = i_ekko-bukrs .
              i_bpoh-doc_type    = i_ekko-bsart .
              i_bpoh-vendor      = i_ekko-lifnr .
              i_bpoh-langu       = i_ekko-spras .
              i_bpoh-pmnttrms    = i_ekko-zterm .
              i_bpoh-purch_org   = i_ekko-ekorg .
              i_bpoh-pur_group   = i_ekko-ekgrp .
              i_bpoh-currency    = i_ekko-waers .
              i_bpoh-agreement   = i_ekko-konnr .
              i_bpoh-incoterms1  = i_ekko-inco1 .
              i_bpoh-incoterms2  = i_ekko-inco2 .
    Fill PO update indicator 'X'
              i_bpohx-comp_code  = c_char_x .
              i_bpohx-doc_type   = c_char_x .
              i_bpohx-vendor     = c_char_x .
              i_bpohx-langu      = c_char_x .
              i_bpohx-pmnttrms   = c_char_x .
              i_bpohx-purch_org  = c_char_x .
              i_bpohx-pur_group  = c_char_x .
              i_bpohx-currency   = c_char_x .
              i_bpohx-agreement  = c_char_x .
              i_bpohx-incoterms1 = c_char_x .
              i_bpohx-incoterms2 = c_char_x .
              CALL FUNCTION 'ME_EKPO_SINGLE_READ'
                   EXPORTING
                        pi_ebeln         = i_ebeln
                        pi_ebelp         = i_ebelp
                   IMPORTING
                        po_ekpo          = i_ekpo
                   EXCEPTIONS
                        no_records_found = 1
                        OTHERS           = 2.
              IF sy-subrc <> 0 .
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
              ENDIF .
    Fill PO Item
              i_wa_bpoi-po_item    = i_ekpo-ebelp .
              i_wa_bpoi-material   = i_ekpo-matnr .
              i_wa_bpoi-plant      = i_ekpo-werks .
              i_wa_bpoi-stge_loc   = i_ekpo-lgort .
              i_wa_bpoi-quantity   = wa_order_split_create-qty_acptd .
              i_wa_bpoi-po_unit    = i_ekpo-meins .
              i_wa_bpoi-tax_code   = i_ekpo-mwskz .
              i_wa_bpoi-val_type   = i_ekpo-bwtar .
              i_wa_bpoi-item_cat   = i_ekpo-pstyp .
              i_wa_bpoi-acctasscat = i_ekpo-knttp .
              i_wa_bpoi-agreement  = i_ekpo-konnr .
              i_wa_bpoi-agmt_item  = i_ekpo-ktpnr .
              APPEND i_wa_bpoi TO i_bpoi .
    Fill PO Item update indicator 'X'
              i_wa_bpoix-po_item    = i_ekpo-ebelp .
              i_wa_bpoix-po_itemx   = c_char_x .
              i_wa_bpoix-material   = c_char_x .
              i_wa_bpoix-plant      = c_char_x .
              i_wa_bpoix-stge_loc   = c_char_x .
              i_wa_bpoix-quantity   = c_char_x .
              i_wa_bpoix-po_unit    = c_char_x .
              i_wa_bpoix-tax_code   = c_char_x .
              i_wa_bpoix-val_type   = c_char_x .
              i_wa_bpoix-item_cat   = c_char_x .
              i_wa_bpoix-acctasscat = c_char_x .
              i_wa_bpoix-agreement  = c_char_x .
              i_wa_bpoix-agmt_item  = c_char_x .
              APPEND i_wa_bpoix TO i_bpoix .
    Fill PO Item Schedule
              i_wa_bpos-po_item       = i_ekpo-ebelp .
              i_wa_bpos-sched_line    = '0001' .
              i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
              i_wa_bpos-quantity      = wa_order_split_create-qty_acptd .
              APPEND i_wa_bpos TO i_bpos .
    Fill PO Item schedule update indicator 'X'
              i_wa_bposx-po_item       = i_ekpo-ebelp .
              i_wa_bposx-sched_line    = '0001' .
              i_wa_bposx-delivery_date = c_char_x .
              i_wa_bposx-quantity      = c_char_x .
              APPEND i_wa_bposx TO i_bposx .
              CLEAR: i_pargr .
              SELECT SINGLE pargr
                INTO i_pargr
                FROM t161
               WHERE bstyp = i_ekko-bstyp
                 AND bsart = i_ekko-bsart .
              CLEAR i_ekpa[].
              CALL FUNCTION 'MM_READ_PARTNERS'
                   EXPORTING
                        application = c_char_p
                        ebeln       = i_ebeln
                        bstyp       = i_ekko-bstyp
                        pargr       = i_pargr
                   TABLES
                        x_ekpa      = <b>i_ekpa[].</b>
              LOOP AT i_ekpa INTO i_wa_ekpa .
                i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
                i_wa_bpop-langu = sy-langu .
                IF NOT i_wa_ekpa-lifn2 IS INITIAL .
                  i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
                ELSE .
                  i_wa_bpop-buspartno = i_wa_ekpa-parnr .
                ENDIF .
                APPEND i_wa_bpop TO i_bpop .
                CLEAR: i_wa_ekpa, i_wa_bpop .
              ENDLOOP .
              CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
              CALL FUNCTION 'BAPI_PO_CREATE1'
                   EXPORTING
                        poheader         = i_bpoh
                        poheaderx        = i_bpohx
                   IMPORTING
                        exppurchaseorder = i_new_ebeln
                   TABLES
                        return           = i_bapiret2
                    <b>    poitem           = i_bpoi[]
                        poitemx          = i_bpoix[]
                        poschedule       = i_bpos[]
                        poschedulex      = i_bposx[].</b>
    it should be only i_bpoi, i_bpoix, i_bpos, i_bposx but not  i_bpoi[], i_bpoix[], i_bpos[], i_bposx[].
    CHange the code as follows:
    DATA: i_insert,
            i_create_order,
            i_cycle     TYPE cycle,
            i_qty_acpt  TYPE dzmeng,
            i_dly_date  TYPE vbak-vdatu,
            i_item      TYPE roijnomiio .
      DATA: i_order TYPE symsgv,
            i_return TYPE swd_return .
      DATA: i_vbak      TYPE vbak,
            i_vbap      TYPE vbap,
            i_ekko      TYPE ekko,
            i_ekpo      TYPE ekpo,
            i_bsoh      TYPE bapisdhd1,
            i_bsohx     TYPE bapisdhd1x,
            i_bpoh      TYPE bapimepoheader,
            i_bpohx     TYPE bapimepoheaderx,
            i_vbeln     TYPE vbeln_va,
            i_posnr     TYPE posnr_va,
            i_contr     TYPE vbeln_va,
            i_conit     TYPE posnr_va,
            i_ebeln     TYPE ebeln,
            i_ebelp     TYPE ebelp,
            i_pargr     TYPE pargr,
            i_thead     TYPE thead,
            i_line      TYPE tline,
            i_note      TYPE txw_note,
            i_new_vbeln TYPE vbeln_va,
            i_new_ebeln TYPE ebeln,
            i_wa_bsoi   TYPE bapisditm,
            i_wa_bsoix  TYPE bapisditmx,
            i_wa_bsop   TYPE bapiparnr,
            i_wa_bsos   TYPE bapischdl,
            i_wa_bsosx  TYPE bapischdlx,
            i_wa_vbpa   TYPE vbpa,
            i_wa_vbkd   TYPE vbkd,
            i_wa_bpoi   TYPE bapimepoitem,
            i_wa_bpoix  TYPE bapimepoitemx,
            i_wa_bpos   TYPE bapimeposchedule,
            i_wa_bposx  TYPE bapimeposchedulx,
            i_wa_bpop   TYPE bapiekkop,
            i_wa_ekpa   TYPE ekpa,
            i_message   TYPE char72,
            i_bapiretn  TYPE bapiret2,
            i_bapiret2  TYPE TABLE OF bapiret2 INITIAL SIZE 1,
            i_vbpa      TYPE TABLE OF vbpa INITIAL SIZE 1,
            i_vbkd      TYPE TABLE OF vbkd INITIAL SIZE 1,
            i_ekpa      TYPE TABLE OF ekpa INITIAL SIZE 1,
            i_bsoi      TYPE TABLE OF bapisditm INITIAL SIZE 1,
            i_bsoix     TYPE TABLE OF bapisditmx INITIAL SIZE 1,
            i_bsos      TYPE TABLE OF bapischdl INITIAL SIZE 1,
            i_bsosx     TYPE TABLE OF bapischdlx INITIAL SIZE 1,
            i_bsop      TYPE TABLE OF bapiparnr INITIAL SIZE 1,
            i_bpoi      TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
            i_bpoix     TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
            i_bpos      TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
            i_bposx     TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
            i_bpop      TYPE TABLE OF bapiekkop INITIAL SIZE 1,
            i_text_tab  TYPE TABLE OF tline INITIAL SIZE 1,
            i_line_tab  TYPE TABLE OF tline INITIAL SIZE 1,
            i_txw_note  TYPE TABLE OF txw_note INITIAL SIZE 1,
            i_oij_el_doc_mot TYPE oij_el_doc_mot .
      CONSTANTS: c_char_c VALUE 'C',
                 c_char_e VALUE 'E',
                 c_char_p VALUE 'P',
                 c_char_g VALUE 'G',
                 c_char_i VALUE 'I',
                 c_char_s VALUE 'S',
                 c_char_x VALUE 'X',
                 c_zsw(3) VALUE 'ZSW',
                 c_nomit_stat(4) VALUE 'ZDNY' .
      DATA : lv_nomtk_split        TYPE oij_nomtk.
      DATA : i_order_split_create  TYPE TABLE OF zsws_order_split.
      DATA : wa_order_split_create TYPE zsws_order_split.
      LOOP AT i_order_split_create INTO wa_order_split_create.
        IF NOT i_create_order IS INITIAL .
          CLEAR: i_create_order .
              MOVE: wa_order_split_create-docnr  TO i_ebeln,
                    wa_order_split_create-docitm TO i_ebelp .
              CALL FUNCTION 'ME_EKKO_SINGLE_READ'
                   EXPORTING
                        pi_ebeln         = i_ebeln
                   IMPORTING
                        po_ekko          = i_ekko
                   EXCEPTIONS
                        no_records_found = 1
                        OTHERS           = 2.
              IF sy-subrc <> 0 .
              ENDIF .
    Fill PO Header
              i_bpoh-comp_code   = i_ekko-bukrs .
              i_bpoh-doc_type    = i_ekko-bsart .
              i_bpoh-vendor      = i_ekko-lifnr .
              i_bpoh-langu       = i_ekko-spras .
              i_bpoh-pmnttrms    = i_ekko-zterm .
              i_bpoh-purch_org   = i_ekko-ekorg .
              i_bpoh-pur_group   = i_ekko-ekgrp .
              i_bpoh-currency    = i_ekko-waers .
              i_bpoh-agreement   = i_ekko-konnr .
              i_bpoh-incoterms1  = i_ekko-inco1 .
              i_bpoh-incoterms2  = i_ekko-inco2 .
    Fill PO update indicator 'X'
              i_bpohx-comp_code  = c_char_x .
              i_bpohx-doc_type   = c_char_x .
              i_bpohx-vendor     = c_char_x .
              i_bpohx-langu      = c_char_x .
              i_bpohx-pmnttrms   = c_char_x .
              i_bpohx-purch_org  = c_char_x .
              i_bpohx-pur_group  = c_char_x .
              i_bpohx-currency   = c_char_x .
              i_bpohx-agreement  = c_char_x .
              i_bpohx-incoterms1 = c_char_x .
              i_bpohx-incoterms2 = c_char_x .
              CALL FUNCTION 'ME_EKPO_SINGLE_READ'
                   EXPORTING
                        pi_ebeln         = i_ebeln
                        pi_ebelp         = i_ebelp
                   IMPORTING
                        po_ekpo          = i_ekpo
                   EXCEPTIONS
                        no_records_found = 1
                        OTHERS           = 2.
              IF sy-subrc <> 0 .
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
              ENDIF .
    Fill PO Item
              i_wa_bpoi-po_item    = i_ekpo-ebelp .
              i_wa_bpoi-material   = i_ekpo-matnr .
              i_wa_bpoi-plant      = i_ekpo-werks .
              i_wa_bpoi-stge_loc   = i_ekpo-lgort .
              i_wa_bpoi-quantity   = wa_order_split_create-qty_acptd .
              i_wa_bpoi-po_unit    = i_ekpo-meins .
              i_wa_bpoi-tax_code   = i_ekpo-mwskz .
              i_wa_bpoi-val_type   = i_ekpo-bwtar .
              i_wa_bpoi-item_cat   = i_ekpo-pstyp .
              i_wa_bpoi-acctasscat = i_ekpo-knttp .
              i_wa_bpoi-agreement  = i_ekpo-konnr .
              i_wa_bpoi-agmt_item  = i_ekpo-ktpnr .
              APPEND i_wa_bpoi TO i_bpoi .
    Fill PO Item update indicator 'X'
              i_wa_bpoix-po_item    = i_ekpo-ebelp .
              i_wa_bpoix-po_itemx   = c_char_x .
              i_wa_bpoix-material   = c_char_x .
              i_wa_bpoix-plant      = c_char_x .
              i_wa_bpoix-stge_loc   = c_char_x .
              i_wa_bpoix-quantity   = c_char_x .
              i_wa_bpoix-po_unit    = c_char_x .
              i_wa_bpoix-tax_code   = c_char_x .
              i_wa_bpoix-val_type   = c_char_x .
              i_wa_bpoix-item_cat   = c_char_x .
              i_wa_bpoix-acctasscat = c_char_x .
              i_wa_bpoix-agreement  = c_char_x .
              i_wa_bpoix-agmt_item  = c_char_x .
              APPEND i_wa_bpoix TO i_bpoix .
    Fill PO Item Schedule
              i_wa_bpos-po_item       = i_ekpo-ebelp .
              i_wa_bpos-sched_line    = '0001' .
              i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
              i_wa_bpos-quantity      = wa_order_split_create-qty_acptd .
              APPEND i_wa_bpos TO i_bpos .
    Fill PO Item schedule update indicator 'X'
              i_wa_bposx-po_item       = i_ekpo-ebelp .
              i_wa_bposx-sched_line    = '0001' .
              i_wa_bposx-delivery_date = c_char_x .
              i_wa_bposx-quantity      = c_char_x .
              APPEND i_wa_bposx TO i_bposx .
              CLEAR: i_pargr .
              SELECT SINGLE pargr
                INTO i_pargr
                FROM t161
               WHERE bstyp = i_ekko-bstyp
                 AND bsart = i_ekko-bsart .
              CLEAR i_ekpa[].
              CALL FUNCTION 'MM_READ_PARTNERS'
                   EXPORTING
                        application = c_char_p
                        ebeln       = i_ebeln
                        bstyp       = i_ekko-bstyp
                        pargr       = i_pargr
                   TABLES
                        x_ekpa      = i_ekpa.
              LOOP AT i_ekpa INTO i_wa_ekpa .
                i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
                i_wa_bpop-langu = sy-langu .
                IF NOT i_wa_ekpa-lifn2 IS INITIAL .
                  i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
                ELSE .
                  i_wa_bpop-buspartno = i_wa_ekpa-parnr .
                ENDIF .
                APPEND i_wa_bpop TO i_bpop .
                CLEAR: i_wa_ekpa, i_wa_bpop .
              ENDLOOP .
              CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
              CALL FUNCTION 'BAPI_PO_CREATE1'
                   EXPORTING
                        poheader         = i_bpoh
                        poheaderx        = i_bpohx
                   IMPORTING
                        exppurchaseorder = i_new_ebeln
                   TABLES
                        return           = i_bapiret2
                        poitem           = i_bpoi
                        poitemx          = i_bpoix
                        poschedule       = i_bpos
                        poschedulex      = i_bposx.
              i_order = i_new_ebeln .
              SHIFT i_order LEFT DELETING LEADING '0' .
              i_return-errortype = c_char_i .
              i_return-workarea  = c_zsw .
              i_return-message   = '064' .
              i_return-variable1 = i_order .
            loop at i_bapiret2 into i_bapiretn where type ca 'EAX' .
            append i_bapiretn to t_bapi_return .
          endloop .
          if t_bapi_return[] is initial .
             i_create_order = c_char_x .
               CALL FUNCTION 'SWD_POPUP_MESSAGE_SEND'
                   EXPORTING
                        act_return = i_return. "Popup with new PO no.
          ENDCASE .                                     " Docind
        ENDIF .
      ENDLOOP.

  • Sales order creation with bapi in webdynpro using table control

    When i use table control to update the line items only first row is getting updated in the sale order creation and the loop is not updating the other row to header only the first row is getting saved, for the same set of data sale order is getting created in va01 for multiple line items. Pls give me some idea to resolve this issue, here is the code i am using for creating sale order using bapi 'BAPI_SALESORDER_CREATEFROMDAT2' method CREATE_SALES_ORDER .
    Declaration for Order Header Node DATA: node_order_header TYPE REF TO if_wd_context_node, elem_order_header TYPE REF TO if_wd_context_element, stru_order_header TYPE if_componentcontroller=>element_order_header . * Declaration for Order Items Node DATA: node_order_items TYPE REF TO if_wd_context_node, elem_order_items TYPE REF TO if_wd_context_element, stru_order_items TYPE if_componentcontroller=>element_order_items . * Declaration for Order Partners Node DATA: node_order_partners TYPE REF TO if_wd_context_node, elem_order_partners TYPE REF TO if_wd_context_element, stru_order_partners TYPE if_componentcontroller=>element_order_partners . node_order_header = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_header ). elem_order_header = node_order_header->get_element( ). elem_order_header->get_static_attributes( IMPORTING static_attributes = stru_order_header ). * via lead selection node_order_items = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_items ). elem_order_items = node_order_items->get_element( ). elem_order_items->get_static_attributes( IMPORTING static_attributes = stru_order_items ). * via lead selection node_order_partners = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_partners ). elem_order_partners = node_order_partners->get_element( ). elem_order_partners->get_static_attributes( IMPORTING static_attributes = stru_order_partners ). DATA: v_sales_doc TYPE bapivbeln-vbeln. DATA: w_order_header_in TYPE bapisdhd1, i_order_header_in TYPE table of bapisdhd1," i_order_partners TYPE TABLE OF bapiparnr, w_order_partners TYPE bapiparnr, i_return TYPE TABLE OF bapiret2, w_return TYPE bapiret2, i_order_items_in TYPE TABLE OF bapisditm, w_order_items_in TYPE bapisditm, i_order_conditions_in TYPE TABLE OF bapicond, w_order_conditions_in TYPE bapicond, w_order_SCHDL type BAPISCHDL, i_order_SCHDL type table of BAPISCHDL. * Order Header Details CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in, i_order_conditions_in, w_order_SCHDL, i_order_SCHDL. refresh : i_order_partners, i_return, i_order_items_in, i_order_conditions_in, i_order_SCHDL. w_order_header_in-doc_type = stru_order_header-doc_type. w_order_header_in-sales_org = stru_order_header-sales_org. w_order_header_in-distr_chan = stru_order_header-distr_chan. w_order_header_in-division = stru_order_header-division. w_order_header_in-req_date_h = stru_order_header-req_date_h. w_order_header_in-sales_dist = stru_order_header-sales_dist. w_order_header_in-purch_no_c = stru_order_header-purch_no_c. * Order Item Details CLEAR: i_order_items_in,w_order_items_in. * w_order_items_in-itm_num = stru_order_items-itm_num. w_order_items_in-ITM_NUMBER = stru_order_items-ITM_NUMBER. w_order_items_in-material = stru_order_items-material. w_order_items_in-target_qty = stru_order_items-target_qty."'5'. w_order_items_in-target_qu = stru_order_items-target_qu."'5'. w_order_items_in-plant = stru_order_items-plant. w_order_items_in-target_val = stru_order_items-target_val. w_order_items_in-currency = stru_order_items-currency. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_items_in-material IMPORTING output = w_order_items_in-material. APPEND w_order_items_in TO i_order_items_in. * Order Partner Details CLEAR: i_order_partners,w_order_partners. w_order_partners-partn_role = stru_order_partners-partn_role. w_order_partners-partn_numb = stru_order_partners-partn_numb. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_partners-partn_numb IMPORTING output = w_order_partners-partn_numb. APPEND w_order_partners TO i_order_partners. * Order Condition Details w_order_SCHDL-ITM_NUMBER = stru_order_items-itm_number." '000010'. w_order_SCHDL-req_qty = stru_order_items-target_qty." '5'. APPEND w_order_SCHDL to i_order_SCHDL. * Create Sales Order BAPI Call *loop at i_order_header_in into w_order_header_in. CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2' EXPORTING order_header_in = w_order_header_in IMPORTING salesdocument = v_sales_doc TABLES return = i_return order_items_in = i_order_items_in order_partners = i_order_partners order_schedules_in = i_order_SCHDL order_conditions_in = i_order_conditions_in. * Get message manager DATA: l_current_controller TYPE REF TO if_wd_controller, l_message_manager TYPE REF TO if_wd_message_manager. l_current_controller ?= wd_this->wd_get_api( ). CALL METHOD l_current_controller->get_message_manager RECEIVING message_manager = l_message_manager. DATA: v_message_text TYPE string. * When Sales Order is created commit the data IF NOT v_sales_doc IS INITIAL. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = 'X'. CONCATENATE 'Sales Document' v_sales_doc 'has been created.' INTO v_message_text SEPARATED BY space. * Report Success message CALL METHOD l_message_manager->report_success EXPORTING message_text = v_message_text. ELSE. v_message_text = 'Error Creating Sales Order'. * Report Error message CALL METHOD l_message_manager->report_error_message EXPORTING message_text = v_message_text. ENDIF. *endloop. endmethod. and code for table control i am using is method WDDOINIT . Types : Begin of item_tab, itm_number type bapisditm-itm_number, material type bapisditm-material, plant type bapisditm-plant , target_qty type bapisditm-target_qty, target_qu type bapisditm-target_qu, target_val type bapisditm-target_val, currency type bapisditm-currency, end of item_tab. *Creating internal table and Work Area of the same structure *as that of the Node created. Data : it_item type standard table of item_tab, wa_item type item_tab. *Appending Blank Work Area to Internal table. ***********************************************888 *LOOP AT it_item INTO wa_item. **wa_item-itm_number to bapisditm-itm_number. **wa_item-material to bapisditm-material. **wa_item-plant to bapisditm-plant. **wa_item-target_qty to bapisditm-target_qty. **wa_item-target_qu to bapisditm-target_qu. **wa_item-target_val to bapisditm-target_val. **wa_item-currency to bapisditm-currency. ** * APPEND wa_item TO it_item. *ENDLOOP. **********************************************88 ******** Do 10 times. Append wa_item to it_item. enddo. ********* "Binding the table DATA lo_nd_order_items TYPE REF TO if_wd_context_node. * DATA lt_material TYPE wd_this->Elements_material. * navigate from to via lead selection lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ). * @TODO handle non existant child * IF lo_nd_material IS INITIAL. * ENDIF. ** @TODO compute values ** e.g. call a model function * lo_nd_order_items->bind_table( new_items = it_item set_initial_elements = abap_true ). endmethod.

    DATA: node_order_header TYPE REF TO if_wd_context_node, elem_order_header TYPE REF TO if_wd_context_element, stru_order_header TYPE if_componentcontroller=>element_order_header . * Declaration for Order Items Node DATA: node_order_items TYPE REF TO if_wd_context_node, elem_order_items TYPE REF TO if_wd_context_element, stru_order_items TYPE if_componentcontroller=>element_order_items . * Declaration for Order Partners Node DATA: node_order_partners TYPE REF TO if_wd_context_node, elem_order_partners TYPE REF TO if_wd_context_element, stru_order_partners TYPE if_componentcontroller=>element_order_partners . node_order_header = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_header ). elem_order_header = node_order_header->get_element( ). elem_order_header->get_static_attributes( IMPORTING static_attributes = stru_order_header ). * via lead selection node_order_items = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_items ). elem_order_items = node_order_items->get_element( ). elem_order_items->get_static_attributes( IMPORTING static_attributes = stru_order_items ). * via lead selection node_order_partners = wd_context->get_child_node( name = if_componentcontroller=>wdctx_order_partners ). elem_order_partners = node_order_partners->get_element( ). elem_order_partners->get_static_attributes( IMPORTING static_attributes = stru_order_partners ). DATA: v_sales_doc TYPE bapivbeln-vbeln. DATA: w_order_header_in TYPE bapisdhd1, i_order_header_in TYPE table of bapisdhd1," i_order_partners TYPE TABLE OF bapiparnr, w_order_partners TYPE bapiparnr, i_return TYPE TABLE OF bapiret2, w_return TYPE bapiret2, i_order_items_in TYPE TABLE OF bapisditm, w_order_items_in TYPE bapisditm, i_order_conditions_in TYPE TABLE OF bapicond, w_order_conditions_in TYPE bapicond, w_order_SCHDL type BAPISCHDL, i_order_SCHDL type table of BAPISCHDL. * Order Header Details CLEAR: w_order_header_in, i_order_partners, i_return, i_order_items_in, i_order_conditions_in, w_order_SCHDL, i_order_SCHDL. refresh : i_order_partners, i_return, i_order_items_in, i_order_conditions_in, i_order_SCHDL. w_order_header_in-doc_type = stru_order_header-doc_type. w_order_header_in-sales_org = stru_order_header-sales_org. w_order_header_in-distr_chan = stru_order_header-distr_chan. w_order_header_in-division = stru_order_header-division. w_order_header_in-req_date_h = stru_order_header-req_date_h. w_order_header_in-sales_dist = stru_order_header-sales_dist. w_order_header_in-purch_no_c = stru_order_header-purch_no_c. * Order Item Details CLEAR: i_order_items_in,w_order_items_in. * w_order_items_in-itm_num = stru_order_items-itm_num. w_order_items_in-ITM_NUMBER = stru_order_items-ITM_NUMBER. w_order_items_in-material = stru_order_items-material. w_order_items_in-target_qty = stru_order_items-target_qty."'5'. w_order_items_in-target_qu = stru_order_items-target_qu."'5'. w_order_items_in-plant = stru_order_items-plant. w_order_items_in-target_val = stru_order_items-target_val. w_order_items_in-currency = stru_order_items-currency. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_items_in-material IMPORTING output = w_order_items_in-material. APPEND w_order_items_in TO i_order_items_in. * Order Partner Details CLEAR: i_order_partners,w_order_partners. w_order_partners-partn_role = stru_order_partners-partn_role. w_order_partners-partn_numb = stru_order_partners-partn_numb. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = w_order_partners-partn_numb IMPORTING output = w_order_partners-partn_numb. APPEND w_order_partners TO i_order_partners. * Order Condition Details w_order_SCHDL-ITM_NUMBER = stru_order_items-itm_number." '000010'. w_order_SCHDL-req_qty = stru_order_items-target_qty." '5'. APPEND w_order_SCHDL to i_order_SCHDL. * Create Sales Order BAPI Call *loop at i_order_header_in into w_order_header_in. CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2' EXPORTING order_header_in = w_order_header_in IMPORTING salesdocument = v_sales_doc TABLES return = i_return order_items_in = i_order_items_in order_partners = i_order_partners order_schedules_in = i_order_SCHDL order_conditions_in = i_order_conditions_in. * Get message manager DATA: l_current_controller TYPE REF TO if_wd_controller, l_message_manager TYPE REF TO if_wd_message_manager. l_current_controller ?= wd_this->wd_get_api( ). CALL METHOD l_current_controller->get_message_manager RECEIVING message_manager = l_message_manager. DATA: v_message_text TYPE string. * When Sales Order is created commit the data IF NOT v_sales_doc IS INITIAL. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = 'X'. CONCATENATE 'Sales Document' v_sales_doc 'has been created.' INTO v_message_text SEPARATED BY space. * Report Success message CALL METHOD l_message_manager->report_success EXPORTING message_text = v_message_text. ELSE. v_message_text = 'Error Creating Sales Order'. * Report Error message CALL METHOD l_message_manager->report_error_message EXPORTING message_text = v_message_text. ENDIF. *endloop. endmethod. and code for table control i am using is method WDDOINIT . Types : Begin of item_tab, itm_number type bapisditm-itm_number, material type bapisditm-material, plant type bapisditm-plant , target_qty type bapisditm-target_qty, target_qu type bapisditm-target_qu, target_val type bapisditm-target_val, currency type bapisditm-currency, end of item_tab. *Creating internal table and Work Area of the same structure *as that of the Node created. Data : it_item type standard table of item_tab, wa_item type item_tab. *Appending Blank Work Area to Internal table. ***********************************************888 *LOOP AT it_item INTO wa_item. **wa_item-itm_number to bapisditm-itm_number. **wa_item-material to bapisditm-material. **wa_item-plant to bapisditm-plant. **wa_item-target_qty to bapisditm-target_qty. **wa_item-target_qu to bapisditm-target_qu. **wa_item-target_val to bapisditm-target_val. **wa_item-currency to bapisditm-currency. ** * APPEND wa_item TO it_item. *ENDLOOP. **********************************************88 ******** Do 10 times. Append wa_item to it_item. enddo. ********* "Binding the table DATA lo_nd_order_items TYPE REF TO if_wd_context_node. * DATA lt_material TYPE wd_this->Elements_material. * navigate from to via lead selection lo_nd_order_items = wd_context->get_child_node( name = wd_this->wdctx_order_items ). * @TODO handle non existant child * IF lo_nd_material IS INITIAL. * ENDIF. ** @TODO compute values ** e.g. call a model function * lo_nd_order_items->bind_table( new_items = it_item set_initial_elements = abap_true ). endmethod.

Maybe you are looking for

  • Email id geterates in PDF Problem

    Hi, I have a problem when generating a PDF in dat if i get email id. then in the log its generating Possible variable substitution ignored. Variable 'gmail' not found.  for any email id. some times the dat is going in to loop that crashing the adobe

  • JNI_CreateJavaVM hangs in DLL called via Adobe plug-in

    We have a plugin that works in Adobe Acrobat and Adobe Reader. The plugin is written in VS2008 VC++ and calls into a DLL that we have written. The DLL in turn uses JNI and calls into some Java code. We've tested the DLL and calls into Java separately

  • Get Message Notification in BPM 10G from External JMS Provider

    Hello, Can anyone provide me the steps how to get a message from the queue (external JMS provider) in BPM 10G. I have been looking into this for couple of days now and I'm not able to figure it out. Any input on this would be greatly appreciated. Tha

  • Calculate shipping charges using javascript

    I have a pdf order form that I am creating to email customers.  I need to create a shipping field in which the value is a flat rate depending on the subtotal.  Example if subtotal is less than $150 then shipping = $15.  If $250 > subtotal > $150 ship

  • Using addresses, can you print duplicate mailing labels for the same address

    using my address book, can I print duplicate mailing labels for the same name and address.