How to create a Sales Order using BAPI_SALESORDER_CREATEFROMDAT1 in VC

I am new to Visual Composer.
I read the tutorial and created a Model which fetches the Sales Orders from the R/3 using <b>BAPI_SALESORDER_GETLIST</b>, every thing worked fine.
I am trying to create a sales order in R/3 using <b>BAPI_SALESORDER_CREATEFROMDAT1</b>, following are the steps I did:
1)Create a model
2)Drag a model element(iView) on to the designer
3)Double click the iView and Drag the function <b>BAPI_SALESORDER_CREATEFROMDAT1</b> on to the iView Designer
Now my question is, for <b>BAPI_SALESORDER_CREATEFROMDAT1</b> there are some mandatory fields as mentioned in the document.
1. Mandatory entries:
ORDER_HEADER_IN :
DOC_TYPE     Sales document type
SALES_ORG    Sales organization
DISTR_CHAN   Distribution channel
DIVISION     Division
ORDER_PARTNERS..:
PARTN_ROLE   Partner functions, SP sold-to party
PARTN_NUMB   Customer number
ORDER_ITEMS_IN..:
MATERIAL     Material number
REQ_QTY      Order quantity in sales unit
I can pass the values of structure <b>ORDER_HEADER_IN</b> from a input form but how should I pass mandatory values for tables <b>ORDER_PARTNERS</b> and <b>ORDER_ITEMS_IN</b>.
Ideally I should have one form where I can send all the mandatory items in the form.
Thank you,
Vamsi

Hi,
how did you return the materials in the Table View. I tried to do it, but it only returns one material?
Regards,
Matthias

Similar Messages

  • How to create the sales order using BAPI's ....?

    Hi Guru's,
    could you please provide how to create the sales order using BAPI's .....i need step by step process and please provide the details from scratch....basically  i don't have basic knowledge on this....please provide required inputs ....:)
    thanks in advance
    Srinivas......

    Hi Guru's thanks for your inouts and your valuble time...
    please find the program logic below...
    *& Report  ZAREPAS30
    REPORT  zarepas30.
    DATA : gs_vbeln                   TYPE  vbak-vbeln,
           gs_order_header_in         TYPE  bapisdhd1,
           gs_order_header_inx        TYPE  bapisdhd1x,
           gt_order_items_in          TYPE  STANDARD TABLE OF bapisditm,
           gwa_itab1                  TYPE  bapisditm,
           gt_order_items_inx         TYPE  STANDARD TABLE OF bapisditmx,
           gwa_itab2                  TYPE  bapisditmx,
           gt_order_partners          TYPE  STANDARD TABLE OF bapiparnr,
           gwa_itab3                  TYPE  bapiparnr,
           gt_return                  TYPE  STANDARD TABLE OF bapiret2,
           gwa_itab4                  TYPE  bapiret2.
    Sales document type
      PARAMETERS: p_auart TYPE auart OBLIGATORY.
    Sales organization
      PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    Distribution channel
      PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    Division.
      PARAMETERS: p_spart TYPE spart OBLIGATORY.
    Requested Delivery Date
      PARAMETERS: p_edatu  TYPE edatu OBLIGATORY.
    Sold-to
      PARAMETERS: p_sold  TYPE kunnr OBLIGATORY.
    Ship-to
      PARAMETERS: p_ship  TYPE kunnr OBLIGATORY.
    Material
      PARAMETERS: p_matnr TYPE matnr   OBLIGATORY.
    Quantity.
      PARAMETERS: p_menge TYPE kwmeng  OBLIGATORY.
    Plant
      PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
    Start-of-selection.
      START-OF-SELECTION.
    Header data
    Sales document type
      gs_order_header_in-doc_type = p_auart.
      gs_order_header_inx-doc_type = 'X'.
    Sales organization
      gs_order_header_in-sales_org = p_vkorg.
      gs_order_header_inx-sales_org = 'X'.
    Distribution channel
      gs_order_header_in-distr_chan  = p_vtweg.
      gs_order_header_inx-distr_chan = 'X'.
    Division
      gs_order_header_in-division = p_spart.
      gs_order_header_inx-division = 'X'.
    Reguested Delivery Date
      gs_order_header_in-req_date_h = p_edatu.
      gs_order_header_inx-req_date_h = 'X'.
      gs_order_header_inx-updateflag = 'I'.
    Partner data
    Sold to
      gwa_itab3-partn_role = 'AG'.
      gwa_itab3-partn_numb = p_sold.
      APPEND gwa_itab3 TO  gt_order_partners .
    ship to
      gwa_itab3-partn_role = 'WE'.
      gwa_itab3-partn_numb = p_ship.
      APPEND gwa_itab3 TO  gt_order_partners .
    ITEM DATA
      gwa_itab2-updateflag = 'I'.
    Line item number.
      gwa_itab1-itm_number = '000010'.
      gwa_itab2-itm_number = 'X'.
    Material
      gwa_itab1-material = p_matnr.
      gwa_itab2-material = 'X'.
    Plant
      gwa_itab1-plant    = p_plant.
      gwa_itab2-plant   = 'X'.
    Quantity
      gwa_itab1-target_qty = p_menge.
      gwa_itab2-target_qty = 'X'.
      APPEND gwa_itab1 TO gt_order_items_in.
      APPEND gwa_itab2 TO gt_order_items_inx.
    Line item number.
      gwa_itab1-itm_number = '000020'.
      gwa_itab2-itm_number = 'X'.
    Material
      gwa_itab1-material = p_matnr.
      gwa_itab2-material = 'X'.
    Plant
      gwa_itab1-plant    = p_plant.
      gwa_itab2-plant   = 'X'.
    Quantity
      gwa_itab1-target_qty = p_menge.
      gwa_itab2-target_qty = 'X'.
      APPEND gwa_itab1 TO gt_order_items_in.
      APPEND gwa_itab2 TO gt_order_items_inx.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
        order_header_in               = gs_order_header_in
        ORDER_HEADER_INX              = gs_order_header_inx
      IMPORTING
        SALESDOCUMENT                 = gs_vbeln
      tables
        RETURN                        = gt_return
        ORDER_ITEMS_IN                = gt_order_items_in
        ORDER_ITEMS_INX               = gt_order_items_inx
        order_partners                = gt_order_partners.
    Check the return table.
      LOOP AT gt_return into gwa_itab4 WHERE type = 'E' OR type = 'A'.
        EXIT.
      ENDLOOP.
      IF sy-subrc = 0.
        WRITE: / 'Error occured while creating sales order '.
      ELSE.
    Commit the work.
      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
        WRITE: / 'Document ', gs_vbeln, ' created'.
      ENDIF.

  • How to create a sales order using a catlog numer

    hi,
        is it possible to create a sales order using a catlog number of the material .. did  any one work on this type ... and how to maintain catalog number for a material?
    thank you
    mmn

    Do NOT USE BAPI_SALESORDER_CREATEFROMDATA, that FM is obsolete!
    Use BAPI_SALESORDER_CREATEFROMDAT1 .
    To build a reference to your contract you have to supply ORDER_HEADER_IN.
    Here´s a sample:
    MOVE:
    gs_vbak-vbeln TO ls_bapisdhd1-refobjkey,
    gs_vbak-vbeln TO ls_bapisdhd1-ref_doc,
    gs_vbak-vbtyp TO ls_bapisdhd1-refdoc_cat,
    gs_vbak-auart TO ls_bapisdhd1-refdoctype.
    also gothrouh the links
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap%2b-%2bsimple%2bprogram%2bto%2bcreate%2bsales%2border%2busing%2bbapi

  • How to create a sales order using PO ALE Idoc

    Hi,
    I  have a purchase order in my ECC6 system, and output for this PO is ALE idoc.
    Now I want to create a Sales order using that Idoc in the same system,
    can anbody please tell the procedure
    sreeram

    Do NOT USE BAPI_SALESORDER_CREATEFROMDATA, that FM is obsolete!
    Use BAPI_SALESORDER_CREATEFROMDAT1 .
    To build a reference to your contract you have to supply ORDER_HEADER_IN.
    Here´s a sample:
    MOVE:
    gs_vbak-vbeln TO ls_bapisdhd1-refobjkey,
    gs_vbak-vbeln TO ls_bapisdhd1-ref_doc,
    gs_vbak-vbtyp TO ls_bapisdhd1-refdoc_cat,
    gs_vbak-auart TO ls_bapisdhd1-refdoctype.
    also gothrouh the links
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap%2b-%2bsimple%2bprogram%2bto%2bcreate%2bsales%2border%2busing%2bbapi

  • How to create open sales order using BAPI....?

    Hi Guru's,
    please help me how to create open sales order and which BAPI i have to use for open sales order.
    please provide any program logic related to this or step by step process.....
    that would be helpful to me.
    thanks in advance...
    Srinivas....

    Hi sreenu,
    Open PO or Open sales order means that the complete cycle is not complete. That means the Sales order is not completely delievered or is not billed or is not paid for. Only once the cycle is completed the order status shows as complete untill then its Open.
    You can use VA05 to find open sales orders.
    Similarlry open PO's are those PO's whos inbound delivery is not complete or whos goods receipt is not complete and whos payment is not done to the vendor
    U cannot directly find the open PO and open SO from any table.
    That u have to calculate from the status of the PO and SO and then check wheteher that is complete or not.
    U have table VBUP for SO status.Check out the fields in that table
    pls see the below link.
    http://abaplovers.blogspot.com/2008/02/bapi-sales-order-create-code.html
    http://msdn.microsoft.com/en-us/library/cc185190.aspx
    thjanks
    karthik

  • How to create a sales order using bapi

    hi
        i need to create a sales order using bapi.
    can any one help me

    Do NOT USE BAPI_SALESORDER_CREATEFROMDATA, that FM is obsolete!
    Use BAPI_SALESORDER_CREATEFROMDAT1 .
    To build a reference to your contract you have to supply ORDER_HEADER_IN.
    Here´s a sample:
    MOVE:
    gs_vbak-vbeln TO ls_bapisdhd1-refobjkey,
    gs_vbak-vbeln TO ls_bapisdhd1-ref_doc,
    gs_vbak-vbtyp TO ls_bapisdhd1-refdoc_cat,
    gs_vbak-auart TO ls_bapisdhd1-refdoctype.
    also gothrouh the links
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap%2b-%2bsimple%2bprogram%2bto%2bcreate%2bsales%2border%2busing%2bbapi

  • How to create a sales order using a quatation reference

    Hi,
      I have a created a quatation.Now i want to create sales order using that quatation as a reference.will u pls tell me the way of doing it.send me the sample code if any and send me the related information and links.
    Regards,
    Kiran

    Go to VA01, enter the order type and then click on 'Create with Reference' and enter your quotation number there in the subsequent popup.

  • How to create the sales order using excell sheet thru BAPI's?

    Hi Guru's,
    In my excell sheet i had 11 sales order details ..now i wanted to create the sales order's sing BAPI's...?
    could please guide me step by step.....that would be greatly helpfull to me...
    Thanks in advance
    Srinivas....

    Hi,
    follow below steps.
    1. Get the excel data into internal table,  Build a internal table whcih fields are in bapi same order
    2. call the Bapi and pass the table data to the bapi
    3. after calling the  bapi,  call the commit bapi.
        then only it will careates.
    Regards
    Ganesh

  • Creating sales order using ' BAPI_SALESORDER_CREATEFROMDAT1'

    Hi ,
    i have a problem in creating sales order using ' BAPI_SALESORDER_CREATEFROMDAT1 '  .
    order number is created and every thing unless the order quantity isn't created for material item .
    my inputs are .
    in "ORDER_HEADER_IN"
    (DOC_TYPE , SALES_ORG , DISTR_CHAN , DIVISION ,SALES_OFF )
    in " ORDER_ITEMS_IN"
    (MATERIAL ,PLANT ,REQ_QTY  )
    in "ORDER_PARTNERS"
    (PARTN_ROLE , PARTN_NUMB)
    so the order created but as i say the the order quqntity isn't created for the material  so the "net value and maertial net valve )
    aren't calcoluted .
    << Moderator message - Everyone's problem is important. But the answers in the forum are provided by volunteers. Please do not ask for help quickly. >>
    waiting .
    thanks for all
    Edited by: Rob Burbank on Jan 7, 2011 4:28 PM

    Hi Mr. Ahmed Tohamy,
    my point is just create a schedule line with each item line. The relevant code we used was (excerpt)
    perform bapi_map_filled using:
          lv_matnr      'MATERIAL'   space
            changing ls_in    ls_inx,
          lv_tax_class1 'TAX_CLASS1' gc_true
            changing ls_in    ls_inx,
          lv_qty        'TARGET_QTY' space
            changing ls_in    ls_inx, "QTY to item line
          lv_qty        'REQ_QTY'    space
            changing ls_schdl ls_schdlx,"QTY to schedule line
          lv_itm_number 'ITM_NUMBER' space
            changing ls_in    ls_dummy,
          lv_itm_number 'ITM_NUMBER' space
            changing ls_schdl ls_dummy,
          lv_ref_doc_ca 'REF_DOC_CA' space
            changing ls_in    ls_inx,
          lv_orderid    'ORDERID'    space
            changing ls_in    ls_inx,
          lv_ref_doc    'REF_DOC'    space
            changing ls_in    ls_inx.
        append:
          ls_in       to pt_order_items_in,
          ls_inx      to pt_order_items_inx,
          ls_schdl    to pt_order_schdl,
          ls_schdlx   to pt_order_schdlx.
    Here the quantity is put to item line and schedule line, we always mark the correspoing X structure fields:
    *&      Form  bapi_map_filled
    *       if the value passed is not initial, it is moved to the field
    *       and the corresponding (BAPI-) X-field is marked
    *       if no x-structure is required, a dummy structure is passed
    *       if p_initial parameter is filled, initial fields will be marked
    *       in x-structure. Purpose: transfer of initial values to BAPI
    form bapi_map_filled using    p_value      type any
                                  p_fieldname  type fieldname
                                  p_initial    type flag
                         changing p_structure  type any
                                  p_structurex type any.
      field-symbols:
        <any> type any,
        <c>   type c.
      check:
         not ( p_value is initial and p_initial is initial ).
      assign:
        component p_fieldname of structure p_structure to <any>,
        component p_fieldname of structure p_structurex to <c>.
      <any> = p_value.
      check <c> is assigned.
      <c> = gc_true.
    endform.                    " bapi_map_filled
    Also, we did something to create conditions (i.e. tax) but I think that was project-specific.
    We used BAPI_SALESORDER_CREATEFROMDAT2, I do not know about BAPI_SALESORDER_CREATEFROMDAT1.
    Regards,
    Clemens

  • How to create a Sales order with ref to Contract using Function Module

    How to create a Sales order with ref to Contract using Function Module BAPI_SALESDOCU_CREATEFROMDATA ?

    We have a unique situation where we like change the sold-to customer of the sales order
    once order has been created. These orders have been created using either by function module
    BAPI_SALESDOCUMENT_COPY or using BDC (VA01, Copy with reference).
    These two processes work abosolutely fine except someone might have change the sold-to
    customer of the ship-to customer of the original sales order. If this the case then the new
    sales order will be created with the old sold-to and with not the new sold-to.
    We tried using BAPI_SALESDOCUMENT_CHANGE and commit afterwards. We checked
    the returned parameteres of the BAPIs and they are all successful but sold-to remains the
    same old one.
    Any help would be much more appreciated.

  • Line item data is not saving while creating a Sales order using Interactive

    Hi all,
    I am creating a sales order Using Interactive forms. In the form i am having Header data and line item data.I had created two structures one for Header data and one for Line item data. For entering  the LINE ITEM DATA i had created a Dynamic table with Buttons ADD ROW and DELETE ROW.
    User will Add the Row or Delete the Row based on the requirement.
    My issue is When ever the user clicks the SUBMIT button after entering the header data and 3 line items data , Sales order has been created with only first line item and the remaining two line items are not created.
    My Interactive form is like below
    HEADER DATA
    DOC_TYPE
    SALES_ORG
    DIST_CHN
    DIVISION
    PURCH_NO
    PARTN_ROLE
    PART_NO
    LINE ITEM DATA
                             ITEM_NO      MATERIAL          PLANT          QTY        COND_TYPE            COND_VALUE
    ADD ROW
    DELETE ROW
                                                                                    SUBMIT
    My  code for the method ONACTIONCLICK is like below
    method ONACTIONCLICK .
    data:
          Node_Adobe       type ref to If_Wd_Context_Node,
          Node_Zsaleheader       type ref to If_Wd_Context_Node,
          Elem_Zsaleheader       type ref to If_Wd_Context_Element,
          Stru_Zsaleheader       type If_Main=>Element_Zsaleheader,
          Node_Zsaleitem       type ref to If_Wd_Context_Node,
          Elem_Zsaleitem       type ref to If_Wd_Context_Element,
          Stru_Zsaleitem       type If_Main=>Element_Zsaleitem.
      data: header_data type BAPISDHEAD.
      data: item_wa type BAPIITEMIN.
      data: item_data type table of BAPIITEMIN.
      data: partner_wa type BAPIPARTNR.
      data: partner_data type table of BAPIPARTNR.
      data: sales_order type BAPIVBELN-VBELN.
      data: Errorlog type BAPIRETURN1.
    navigate from <CONTEXT> to <ADOBE> via lead selection
      Node_Adobe = wd_Context->get_Child_Node( Name = IF_MAIN=>wdctx_Adobe ).
    navigate from <ADOBE> to <Zsaleheader> via lead selection
      Node_Zsaleheader = Node_Adobe->get_Child_Node( Name = IF_MAIN=>wdctx_Zsaleheader ).
      Node_Zsaleitem = Node_Adobe->get_Child_Node( Name = IF_MAIN=>wdctx_Zsaleitem ).
    get element via lead selection
      Elem_Zsaleheader = Node_Zsaleheader->get_Element(  ).
      Elem_Zsaleitem = Node_Zsaleitem->get_Element(  ).
    get all declared attributes
      Elem_Zsaleheader->get_Static_Attributes(
        importing
          Static_Attributes = Stru_Zsaleheader ).
      header_data-DOC_TYPE = Stru_Zsaleheader-DOC_TYPE.
      header_data-SALES_ORG = Stru_Zsaleheader-SALES_ORG.
      header_data-DISTR_CHAN   = Stru_Zsaleheader-DISTR_CHAN.
      header_data-DIVISION = Stru_Zsaleheader-DIVISION.
      header_data-PURCH_NO = Stru_Zsaleheader-PURCH_NO.
      partner_wa-PARTN_ROLE   = Stru_Zsaleheader-PARTN_ROLE.
      partner_wa-PARTN_NUMB = Stru_Zsaleheader-PARTN_NUMB.
       append partner_wa to partner_data.
        Elem_Zsaleitem->get_Static_Attributes(
        importing
          Static_Attributes = Stru_Zsaleitem ).
      item_wa-ITM_NUMBER = Stru_Zsaleitem-ITM_NUMBER.
      item_wa-MATERIAL   = Stru_Zsaleitem-MATERIAL.
      item_wa-PLANT = Stru_Zsaleitem-PLANT.
      item_wa-REQ_QTY = Stru_Zsaleitem-REQ_QTY.
      item_wa-COND_TYPE   = Stru_Zsaleitem-COND_TYPE.
      item_wa-COND_VALUE = Stru_Zsaleitem-COND_VALUE.
      append item_wa to item_data.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
      EXPORTING
        ORDER_HEADER_IN           = header_data
      WITHOUT_COMMIT            = ' '
      CONVERT_PARVW_AUART       = ' '
    IMPORTING
       SALESDOCUMENT             = sales_order
      SOLD_TO_PARTY             =
      SHIP_TO_PARTY             =
      BILLING_PARTY             =
       RETURN                    = errorlog
      TABLES
        ORDER_ITEMS_IN            = item_data
        ORDER_PARTNERS            = partner_data
      ORDER_ITEMS_OUT           =
      ORDER_CFGS_REF            =
      ORDER_CFGS_INST           =
      ORDER_CFGS_PART_OF        =
      ORDER_CFGS_VALUE          =
      ORDER_CCARD               =
      ORDER_CFGS_BLOB           =
      ORDER_SCHEDULE_EX         =
    endmethod.
    PLEASE SUGGEST ME IF ANY CODE CHANGE IS REQUIRED
    Thanks in advance
    Ajay

    Hi,
    The item data is not read because, the dynamically added rows should also reflect back to the Web Dynpro context. When the user clicks on Add Row, use the Onsubmit event to add a empty line to internal table and then bind it to the context. And if the user removes a row, remove a row from internal table and bind it back to the context.
    You may refer this article.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/802f0ed1-a17a-2c10-7db4-d515a5b047ed
    Regards,
    Runal

  • Error while creating the sales order using Proxy

    Hi Folks,
    I am trying to create a Sales Order using Proxy via BAPI "BAPI_SALESORDER_CREATEFROMDAT2" :
    and i got this type of standard error message
    <Message>FB call: insufficient parameters</Message>
    few days back only i used the same bapi for creating the Sales Order and did it successfully...using the same parameters
    I don't have any clue about this type error .
    Kindly guide .
    Regards,

    Hi Nikhil,
    How refreshing the cache and restart the server will help ?
    basically i am testing the scenario at R/3 end only by generating XML template in SPROXY.
    My ECC 6.0 is on sp 12....I am not sure is it configuration related error or a bug ? as i have used the same code in ECC 6.0 with sp 09.
    regards,

  • FM SD_SALESDOCUMENT_CREATE  on creating a sales order using reference

    I create a sales order using a reference order number.On displaying it in VA02, and giving document flow, the reference document which I used to create the sales order gets displayed.
    A program/fm u2018Xu2019 is called on giving document flow (which takes the reference order number I used as input )
    Now if that u2018Xu2019 is getting the data of the reference order I used from some table u201CT_Yu201D.This table u201CT_Yu201D must be set during sales order creation itself. So, some program which is called during creation of sales order gets the reference order number I used as input and puts it in that table u201CT_Yu201D.
    My assumption is that SD_SALESDOCUMENT_CREATE is the function module handling that part. If it is not for that, then what is its function.
    *****If it is handling that part, which structure which this FM gets as input contains that order number which I used as reference?
    There are 3 bapiu2019s called on sales order creation, BAPI_SALESORDER_CREATEFROMDAT2, BAPI_SALESORDER_CREATEFROMDAT1, BAPI_SALESORDER_CREATEFROMDATA.
    Only one BAPI calls SD_SALESDOCUMENT_CREATE namely BAPI_SALESORDER_CREATEFROMDAT2
    *****Why does the FM SD_SALESDOCUMENT_CREATE not get triggered when I set a breakpoint in it during sales order creation?

    Please search in SDN so many thread related to create sales order

  • Creating a Sales Order using Web Dynpro

    Hi SDN,
      I want to create a Sales Order using Web Dynpro application. For that i have used "Bapi_Salesorder_Createfromdat2" as a adaptive RFC model. Every thing is fine and i could able to create a sales order for a single line item. But my intension is to create a sales order for multiple line items. So in the "Intialview" i have used a "Table" UI element to pass multiple line items. When i execute this application i could pass only single line item from this table. The table UI contol is not allowing to enter the second line item in the second row of the table. Can any one suggest me to solve this problem.
    Thanks in advance.
    Regards
    Basha

    Hi Basha,
    You need to create new element for the model node manually. For example: Create button "New item" and in action handler put someting like described here:
    Add row to table
    How to add more values in a Table in WD appl
    How to add a row to table dynamically?
    How to add a column to a table dynamically.
    add row to table bound to rfc model
    Best regards, Maksim Rashchynski.

  • How to Change a Sales Order using BAPI

    Hi All
    How can we change the sales document using BAPI as the requirement is
    --> First we create a Sales order using a BAPI.
    --> If the sales order is changed then we get the changed order information alonge with the old order data in a CSV file.
    here i have the problem that we are uncertain which fields will be changed some times we may get the item changes or some times we may get the quantity changed information and some times the condition type may be changed . So how to handle this ?
    Thanks,
    Chindam

    Hi,
    try this
    DATA: IT_MESSAGE TYPE STANDARD TABLE OF BAPIRET2,
          WA_VBELN TYPE BAPIVBELN-VBELN.
    DATA: WA_BAPIHEAD TYPE BAPISDH1,
          WA_BAPIHEADX TYPE BAPISDH1X,
          WA_HEADDATA TYPE BAPISDH1.
    DATA: I_BAPIITEM TYPE STANDARD TABLE OF BAPISDITM,
          WA_BAPIITEM TYPE BAPISDITM,
            WA_DATA TYPE BAPISDITM,
          I_BAPIITEMX TYPE STANDARD TABLE OF BAPISDITMX,
          WA_BAPIITEMX TYPE BAPISDITMX.
    CHANGE ITEM DATA
    WA_BAPIITEM-ITM_NUMBER =WA_DATA-ITM_NUMBER.
    WA_BAPIITEM-REASON_REJ = WA_DATA-REASON_REJ. "(REASON FOR REJECTION)
    WA_BAPIITEMX-ITM_NUMBER = WA_DATA-ITM_NUMBER. "(ITEM NUMBER)
    WA_BAPIITEMX-UPDATEFLAG = 'X'.
    WA_BAPIITEMX-REASON_REJ = 'X'.
    APPEND WA_BAPIITEM TO I_BAPIITEM.
    APPEND WA_BAPIITEMX TO I_BAPIITEMX.
    TO CHANGE HEADER DATA
    WA_BAPIHEADX-UPDATEFLAG = 'U'.
    WA_BAPIHEADX-DLV_BLOCK = 'X'.
    WA_BAPIHEAD-SALES_ORG = WA_HEADDATA-SALES_ORG. "(COMPANY CODE)
    WA_BAPIHEAD-DLV_BLOCK = WA_HEADDATA-DLV_BLOCK. "(DELIVERY BLOCK)
    WA_VBELN = '0000000168'.
    CALL BAPI AND PASS THE VALUE
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
       EXPORTING
         SALESDOCUMENT               = WA_VBELN " (SALES AND DOCUMENT NO)
        ORDER_HEADER_IN             = WA_BAPIHEAD
         ORDER_HEADER_INX           = WA_BAPIHEADX
       TABLES
         RETURN                     = IT_MESSAGE
        ORDER_ITEM_IN               = I_BAPIITEM
        ORDER_ITEM_INX              = I_BAPIITEMX
    CLEAR IT_MESSAGE.

Maybe you are looking for

  • Lots of serious problems.

    About a week ago, i started having some major problems with my late 2009 MBP. First off all, the trackpad does not click anymore. it doesnt have the click feel like it used to. if i click on the left side of the trackpad, it will not register, and i

  • Flex 3 Beta 3 FlashVars, where did they go?

    Did something change in the way FlashVars are handled in Flex 3 Beta 3? I am working on an application and I need access to FlashVars for some functionality, yet when the application loads, Application.application.parameters does not get populated wi

  • Random slowdown of BufferedImage painting.

    Relying on another thread that dealed with painting background image in GUI using Borders, I wrote a custom Border that display an image in the background. This is quite smart and stylish, it works and looks beautifull, except that..... I get sometim

  • Also problem read txt files into JTable

    hello, i used the following method to load a .txt file into JTable try{                     FileInputStream fin = new FileInputStream(filename);                     InputStreamReader isr = new InputStreamReader(fin);                     BufferedReade

  • Firefox not loading-just a black screen

    Hello- Mozilla Firefox is not loading on my computer. It just brings up a black page. Internet Explorer works just fine though. I can't find any phone numbers or any help for this. I've uninstalled and reinstalled Firefox and still have the same prob