Reason_rej in BAPI_SALESORDER_CHANGE

I'm trying to insert a reject reason by using BAPI_SALESORDER_CHANGE, this is the data I load into the structures, please let me know if anyone notices something wrong or like something's missing.
SALESDOCUMENT: XXXXXXXXXX
ORDER_HEADER_INX / UPDATEFLAG = U
ORDER_ITEM_IN / ITM_NU = 000010
ORDER_ITEM_IN / PO_ITM = 000010
ORDER_ITEM_IN / REASON_REJ = 10
ORDER_ITEM_INX / ITM_NU = 000010
ORDER_ITEM_INX / UPDATEFLAG = U
ORDER_ITEM_INX / PO_ITM_NO = X
ORDER_ITEM_INX / REASON_REJ= X
I'd appreciatte any help for I don't know if I am missing or misspelling some values.
Thanks,
AC

Hi,
I think you should hev passed the following:
SALESDOCUMENT: XXXXXXXXXX
ORDER_HEADER_INX / UPDATEFLAG = U
ORDER_ITEM_IN / ITM_NU = 000010
ORDER_ITEM_IN / PO_ITM = '000010'
ORDER_ITEM_IN / REASON_REJ = '10'
ORDER_ITEM_INX / ITM_NU = 000010
ORDER_ITEM_INX / UPDATEFLAG = U
ORDER_ITEM_INX / PO_ITM_NO = X
ORDER_ITEM_INX / REASON_REJ= X
For you have no need to change order header please try without updateflag here. For PO_ITM and REASON_REJ are not numeric you need single quotation marks here.
Regards,
Klaus

Similar Messages

  • Error in BAPI_SALESORDER_CHANGE while updating condition

    Hi,
    I am using this BAPI to change an existing pricing condition. However, I am getting an error  " Manual change of condition type is not possible". I'm not sure whether this is a coding error or is it related to configuration. this is how I am populating the structures:
    so_cond_in-itm_number = wa_vbap1-posnr.
    so_cond_in-cond_count = wa_konv-zaehk.
    so_cond_in-cond_st_no = wa_konv-STUNR.
    so_cond_in-cond_type  = wa_konv-kschl.
    so_cond_in-cond_value = wa_konv-kbetr.
    so_cond_in-currency = wa_konv-waers.
    so_condx_in-itm_number = wa_vbap1-posnr.
    so_condx_in-updateflag = 'U'.
    so_condx_in-cond_st_no = wa_konv-STUNR.
    so_condx_in-cond_count = wa_konv-zaehk.
    so_condx_in-cond_type  = wa_konv-kschl.
    so_condx_in-cond_value = 'X'.
    so_condx_in-currency   = 'X'.
    APPEND so_condx_in.
    CLEAR so_condx_in.
    APPEND so_cond_in.
    CLEAR so_cond_in.
    st_logswitch-cond_handl = 'X'.
    Any help would be appreciated.
    Thanks
    SM

    Hi Sneha ,
    Can you please check the code for using the BAPI_SALESORDER_CHANGE bapi. this is similar to your chase.  Please compare with the passing parameters
    then you will get some idea on your code.
    *- Population of Order Item data
        ls_order_item-itm_number = ls_submit-posnr. "Item
        ls_order_item-prc_group5 = '003'."lc_004.          "Material Group5
        IF ls_submit-zmeng = 0.
          ls_order_item-reason_rej = lc_99.         "Reason for Rejection
        ENDIF.
        APPEND ls_order_item TO lt_order_item.
    *-Population of update flag for Order Item
        ls_order_itemx-itm_number = ls_submit-posnr."Item
        ls_order_itemx-updateflag = lc_u.           "Update flag
        ls_order_itemx-prc_group5 = gc_x.           "Material Group5 update
    *- if the required quanity is zero then reject the line
        IF ls_submit-zmeng = 0.
          ls_order_itemx-reason_rej = gc_x.         "Reason for Rejection
        ENDIF.
        APPEND ls_order_itemx TO lt_order_itemx.
    *-Population of
        ls_schedule_lines-itm_number = ls_submit-posnr.
        ls_schedule_lines-sched_line = ls_submit-etenr.
        ls_schedule_lines-req_qty = ls_submit-zmeng.
        APPEND ls_schedule_lines TO lt_schedule_lines.
    *-Population of update flag for Schedule line data
        ls_schedule_linesx-itm_number = ls_submit-posnr.
        ls_schedule_linesx-sched_line = ls_submit-etenr.
        ls_schedule_linesx-updateflag = lc_u.
        ls_schedule_linesx-req_qty = gc_x.
        APPEND ls_schedule_linesx TO lt_schedule_linesx.
    *- at the end of Order call the BAPI to Update the Order
        ls_order_head-collect_no = ls_submit-vbeln.
         ls_order_headx-updateflag = lc_u.
         ls_order_headx-collect_no = gc_x.
    *- BAPI Call to Update the Order
          CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
            EXPORTING
              salesdocument    = ls_submit-vbeln
              order_header_in  = ls_order_head
              order_header_inx = ls_order_headx
            TABLES
              return           = lt_return
              order_item_in    = lt_order_item
              order_item_inx   = lt_order_itemx
              schedule_lines   = lt_schedule_lines
              schedule_linesx  = lt_schedule_linesx.
    *- Check for the errors and based on that populate the log
          READ TABLE lt_return INTO ls_return WITH KEY type = lc_e.
          IF sy-subrc EQ 0.
            LOOP AT lt_return INTO ls_return WHERE type = lc_e.
              ls_log-excep = 1.
              ls_log-vbeln = ls_submit-vbeln.
              ls_log-message = ls_return-message.
              APPEND ls_log TO gt_log.
              CLEAR: ls_log,
                     ls_submit-vbeln .
            ENDLOOP.
          ELSE.
    *- Commit the Changes
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                wait = gc_x.
    *- Check for the success message and populate the log
            LOOP AT lt_return INTO ls_return WHERE number = lc_311.
              ls_log-excep = 3.
              ls_log-vbeln = ls_submit-vbeln.
              ls_log-message = ls_return-message.
              APPEND ls_log TO gt_log.
              CLEAR: ls_log,
                     ls_submit-vbeln .
            ENDLOOP.
          ENDIF.
    Thanks
    Sekhar

  • Remove Reason For Rejection From Sales Order Using BAPI_SALESORDER_CHANGE

    Hi
    I have a sales order and would like to remove the rejection reason.
    I am trying to use BAPI_SALESORDER_CHANGE with the following code:
    (0000xxxxxxx  is my material #. i just removed the actual #).
    MOVE: '0000050106' TO SALESDOCUMENT.
    MOVE: 'U' TO T_HEADER_INX-UPDATEFLAG.
    MOVE:                        30 to t_order_item_in-ITM_NUMBER,
                                      ' ' to t_order_item_in-REASON_REJ,
          '0000000000xxxxxxxx' to t_order_item_in-material.
    APPEND t_order_item_in.
    MOVE: 'U' TO t_order_item_inx-updateflag.
    MOVE: 'X' to t_order_item_inx-REASON_REJ,
               'X' TO t_order_item_inx-material.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        salesdocument              = SALESDOCUMENT
        order_header_inx           = T_HEADER_INX
      tables
        RETURN                     = T_RETURN
        ORDER_ITEM_IN              = T_ORDER_ITEM_IN
        ORDER_ITEM_INX             = T_ORDER_ITEM_INX
    WAIT UP TO 5 SECONDS.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      WAIT          = 'X'
    IMPORTING
       RETURN        = t_return
    WAIT UP TO 5 SECONDS.
    can anybody help?
    the BAPI returns success messages saying the item was processed successfully but the reason code is still there.
    However, if i pass in any other reason code like 02 or 06, it works!.
    thanks.

    Thanks for your help. =)
    I also realized that I forgot to add the SO Item # into the T_ORDER_ITEM_INX-ITM_NUMBER fields.
    But now it works.

  • How to use this CF - BAPI_SALESORDER_CHANGE to set reason for rejec in VA02

    Hi gurus,
    Can anybody guide me how can i use this Call function in the program to change sales order item data.
    Requirement:
    I want to set an Reason for Rejection in Open sales orders .
    how should i use this call function in program so that i can set - Reason for Rejection in Sales Orders.
    Guru's please give in detail like what parameters should i pass and where should i pass.
    Regards.
    S.Saravanan

    Hi,
    Use field REASON_REJ ad pass the reason code to item structure and set the flag for the item in ITEMX table.
    For more info, look for the where used list of the BAPI 'BAPI_SALESORDER_CHANGE' or search the forum.
    Regards
    Shiva

  • Problem with BAPI_SALESORDER_CHANGE

    Hi Experts,
    I am using the following code to reject the sales orders and to update in the database.
    for the sales orders having multiple line items, when i select only one line item it should update only that particular line item but it is updating all the line items in that sales order.
    can anybody please tell me how to correct this error.
            I_ITEM-ITM_NUMBER = I_SELECTED_SO-POSNR.
            I_ITEM-REASON_REJ = I_SELECTED_SO-ABGRU.
            APPEND I_ITEM. CLEAR I_ITEM.
            I_ITEMX-ITM_NUMBER = I_SELECTED_SO-POSNR.
            I_ITEMX-UPDATEFLAG = 'U'.
            I_ITEMX-REASON_REJ = 'X'.
            APPEND I_ITEMX. CLEAR I_ITEMX.
          Save rejection reason text
            I_TEXT-DOC_NUMBER = I_SELECTED_SO-VBELN.
            I_TEXT-ITM_NUMBER = I_SELECTED_SO-POSNR.
            I_TEXT-LANGU      = SY-LANGU.
            APPEND I_TEXT.
            I_BAPISDH1X-UPDATEFLAG = 'U'.
            CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
              EXPORTING
                SALESDOCUMENT    = I_SELECTED_SO-VBELN
                ORDER_HEADER_IN  = I_BAPISDH1
                ORDER_HEADER_INX = I_BAPISDH1X
              TABLES
                RETURN           = I_RETURN
                ORDER_ITEM_IN    = I_ITEM
                ORDER_ITEM_INX   = I_ITEMX
                ORDER_TEXT       = I_TEXT.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    thanks & regards,
    sudheer

    Not sure why it would update all lines... Could it be something in the configuration or in the user exit that propagates the update from one line to the others?
    I used pretty much the same code with just a few differences and didn't use I_TEXT at all:
    DATA: s_da_order_item_in TYPE t_order_item_in WITH HEADER LINE.
    DATA: s_da_order_item_inx TYPE t_order_item_inx WITH HEADER LINE.
        s_da_order_item_in-material   = it_ztable-matnr.
        s_da_order_item_in-itm_number = it_ztable-posnr.
        s_da_order_item_in-reason_rej = c_abgru.
        APPEND s_da_order_item_in.
        CLEAR  s_da_order_item_in.
        s_da_order_item_inx-updateflag = c_updateflag.
        s_da_order_item_inx-reason_rej = c_updatefield.
        s_da_order_item_inx-itm_number = it_ztable-posnr.
        APPEND s_da_order_item_inx.
        CLEAR  s_da_order_item_inx.
    The rest was the same. It worked perfectly fine.

  • BAPI_SALESORDER_CHANGE

    Hi All,
    I have a requirement to change the reasons for rejection for selective items in the sales order.
    but when i use BAPI_SALESORDER_CHANGE. i get the error:
    Field ABGRU cannot be changed VBAPKOM 0003000ready for input.
    Sales document not changed.
    These are the following values i pass:
    IMPORT PARAMETERS:
    Salesdocument :' 100000356'
    Order_header_inx-Updateflag = 'X'
    TABLES:
    order_item_in-item_number = '003000'.
    order_item_in-plant = '1000'.
    order_item_in-reason_rej = ' '.
    order_item_inx-item_number = '003000'.
    order_item_inx-updateflag  = 'U'.
    order_item_inx-reason_rej = 'X'.
    order_item_inx-plant = 'X'.
    do i have to input any other values .Pls help.
    thanks,
    Kavitha

    REPORT  ZSALESORDER_CHANGE MESSAGE-ID 38.
    Selection Screen Definitions *
    PARAMETERS: p_vbeln TYPE vbap-vbeln OBLIGATORY, "Order Number
    p_posnr TYPE vbap-posnr OBLIGATORY, "Order Item
    p_etenr TYPE vbep-etenr OBLIGATORY, "Schedule Line
    p_reqqty TYPE bapischdl-req_qty OBLIGATORY. " Order Qty
    Internal Tables/Structures/Variables for calling BAPI. *
    DATA: i_hdr TYPE bapisdh1,
    i_hdrx TYPE bapisdh1x,
    i_ret TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
    wa_ret TYPE bapiret2.
    DATA: BEGIN OF i_sched OCCURS 10.
    INCLUDE STRUCTURE bapischdl.
    DATA: END OF i_sched.
    DATA: BEGIN OF i_schedx OCCURS 10.
    INCLUDE STRUCTURE bapischdlx.
    DATA: END OF i_schedx.
    START-OF-SELECTION Event *
    START-OF-SELECTION.
    *" Initialize internal tables.
    REFRESH: i_sched, i_schedx, i_ret.
    CLEAR: i_sched, i_schedx, i_ret.
    *" Fill required ORDER_HEADER_IN data.
    i_hdrx-updateflag = 'U'.
    *" Fill required SCHEDULE_LINES data.
    *P_POSNR = P_POSNR + 10.
    i_sched-itm_number = p_posnr.
    i_sched-sched_line = p_etenr.
    i_sched-req_qty = p_reqqty.
    i_schedx-updateflag = 'U'.
    i_schedx-itm_number = p_posnr.
    i_schedx-sched_line = p_etenr.
    i_schedx-req_qty = 'X'.
    *i_schedx-ITM_NUMBER = 'X'.
    *i_schedx-SCHED_LINE = 'X'.
    APPEND i_sched.
    APPEND i_schedx.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = p_vbeln
    order_header_in = i_hdr
    order_header_inx = i_hdrx
    TABLES
    return = i_ret
    schedule_lines = i_sched
    schedule_linesx = i_schedx.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    LOOP AT i_ret.
    WRITE / i_ret-message.
    ENDLOOP.

  • Problem in adding "Reason for Rejection" using BAPI_SALESORDER_CHANGE

    Hi all,
           I have a requirement to stop further processing of sales order by changing the reason for rejection at line item. I have done the code and passed the reason code in the item table to BAPI. The return message says the sales order ammended successsfully, but when i go and see the sales order I dont see it getting updated. when i go to check the order its throwing an error message "Update was terminated"  Could some one please help in getting this solved.
    The code is shown below
    Populate the headerX details
    it_bapisdh1x-updateflag  = 'U'.
    it_bapisdh1x-sales_org   = 'X'.
    it_bapisdh1x-distr_chan  = 'X'.
    it_bapisdh1x-division    = 'X'.
    it_bapisdh1x-purch_no_c  = 'X'.
    it_bapisdh1x-cust_group  = 'X'.
    Populate the header details
    it_bapisdh1-sales_org    = '1298'.
    it_bapisdh1-distr_chan   = '95'.
    it_bapisdh1-division     = '00'.
    it_bapisdh1-purch_no_c   = 'Test1'.
    Partner Roles
    it_bapiparnr-partn_role = 'AG'.
    it_bapiparnr-partn_numb = '9820000049'.
    it_bapiparnr-itm_number = '00000'.
    APPEND it_bapiparnr.
    it_bapiparnr-partn_role = 'WE'.
    it_bapiparnr-partn_numb = '9820000049'.
    it_bapiparnr-itm_number = '000000'.
    APPEND it_bapiparnr.
    it_bapisditmx-itm_number = '00010'.
    it_bapisditmx-updateflag = 'U'.
    it_bapisditmx-material   = 'X'.
    it_bapisditmx-cust_group = 'X'.
    it_bapisditmx-reason_rej = 'X'.
    APPEND it_bapisditmx.
    it_bapisditm-itm_number = '00010'.
    it_bapisditm-material   = 'YAG'.
    it_bapisditm-reason_rej = '01'.
    APPEND it_bapisditm.
    BREAK-POINT.
    salesd = '4000004045'.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
      salesdocument = salesd
      order_header_in = it_bapisdh1
      order_header_inx = it_bapisdh1x
      behave_when_error = ' '
      int_number_assignment = ' '
    TABLES
      order_item_in = it_bapisditm
      order_item_inx = it_bapisditmx
      partners = it_bapiparnr
      return = it_bapiret2.
    IF sy-subrc = 0.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    endif.

    When using BAPI_SALESORDER_CHANGE, you set the fields your are updating to 'X'.  In the example you gave, you are trying to change the header data, material number, etc.
    Try slimming it down to:
    Populate the headerX details
    it_bapisdh1x-updateflag = 'U'.
    it_bapisditmx-itm_number = '00010'.
    it_bapisditmx-updateflag = 'U'.
    it_bapisditmx-reason_rej = 'X'.
    APPEND it_bapisditmx.
    it_bapisditm-itm_number = '00010'.
    it_bapisditm-reason_rej = '01'.
    APPEND it_bapisditm.
    BREAK-POINT.
    salesd = '4000004045'.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = salesd
    order_header_in = it_bapisdh1
    order_header_inx = it_bapisdh1x
    behave_when_error = ' '
    int_number_assignment = ' '
    TABLES
    order_item_in = it_bapisditm
    order_item_inx = it_bapisditmx
    return = it_bapiret2.
    IF sy-subrc = 0.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    endif.
    I hope this helps,
    Mark

  • Enter the document number error in BAPI_SALESORDER_CHANGE

    Hi,
    please help me on the below error:
    Call of BAPI_SALESORDER_CHANGE gives us an error V1 045 "Enter the document number". We are sure the call is proper (document number is send). The errors occurs in function module SD_SALES_DOCUMENT_READ in lines 60 and 61:
    60 VBAK-VBELN = DOCUMENT_NUMBER.
    61 PERFORM BELEG_LESEN(SAPMV45A).
    In line 60 field VBAK-VBELN is set but in form BELEG_LESEN(SAPMV45) is initial. The value of field is checked in MV45AF0B_BELEG_LESEN line 53.
    53 if vbak-vbeln is initial.
    54 message e045.
    55 endif.
    kindly help me on this error,
    Thanks in advance friends,
    Naidu

    LOOP AT IT_ZVCONTRACT_SUSP_SAVE INTO WA_ZVCONTRACT_SUSP_SAVE.
    *Assign values to required fields for for updation
        SALESDOCUMENT = WA_ZVCONTRACT_SUSP_SAVE-VBELN.
        ORDER_HEADER_IN-SALES_ORG = WA_ZVCONTRACT_SUSP_SAVE-VKORG.
        ORDER_HEADER_IN-PURCH_DATE = '00000000'.
        ORDER_HEADER_INX-SALES_ORG = 'X'.
        ORDER_HEADER_INX-PURCH_DATE = 'X'.
        ORDER_HEADER_INX-UPDATEFLAG = 'U'.
        WA_ORDER_ITEM_IN-ITM_NUMBER = WA_ZVCONTRACT_SUSP_SAVE-POSNR.
        IF WA_ZVCONTRACT_SUSP_SAVE-CFLAG EQ 'P'.      "flag for permanent suspension
          WA_ORDER_ITEM_IN-REASON_REJ = WA_ZVCONTRACT_SUSP_SAVE-ABGRU.
        ELSEIF WA_ZVCONTRACT_SUSP_SAVE-CFLAG EQ 'T'.  "flag for temporary suspension
          WA_ORDER_ITEM_IN-REASON_REJ = ''.
        ENDIF.
        APPEND WA_ORDER_ITEM_IN TO ORDER_ITEM_IN.
        WA_ORDER_ITEM_INX-ITM_NUMBER = WA_ZVCONTRACT_SUSP_SAVE-POSNR.
        WA_ORDER_ITEM_INX-UPDATEFLAG = 'U'.
        WA_ORDER_ITEM_INX-REASON_REJ = 'X'.
        APPEND WA_ORDER_ITEM_INX TO ORDER_ITEM_INX.
    *update contract for reason code
        CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
          EXPORTING
            SALESDOCUMENT    = SALESDOCUMENT
            ORDER_HEADER_IN  = ORDER_HEADER_IN
            ORDER_HEADER_INX = ORDER_HEADER_INX
          TABLES
            RETURN           = RETURN
            ORDER_ITEM_IN    = ORDER_ITEM_IN
            ORDER_ITEM_INX   = ORDER_ITEM_INX.
    ENDLOOP.
    We are using it the above given way and it is working fine.
    Regards,
    Abhijit G. Borkar

  • BAPI_SALESORDER_CHANGE - dynpro_not_found ???

    Dear all,
    I found a lot of discussions about using BAPI_SALESORDER_CHANGE and possible errors, but I didn't find anything about the runtime error 'DYNPRO_NOT_FOUND' ...
    As may other developers I want to change 'reason for rejection', but when the BAPI is executing, I get a dump with the error 'dynpro not found' ... I have no idea why I get this error ...
    The program I wrote is :
    report zsd_settlebulkorders.
    tables: vbak, vbap, vbup.
    data: begin of gt_items occurs 0,
             vbeln      like vbak-vbeln,
             posnr      like vbap-posnr.
    data: end of gt_items.
    data: gt_orditems  type bapisditm  occurs 0 with header line.
    data: gt_orditemsx type bapisditmx occurs 0 with header line.
    data: gt_return    type bapiret2   occurs 0 with header line.
    data: gs_ordhead   type bapisdh1.
    data: gs_ordheadx  type bapisdh1x.
    data: gv_vbeln     type bapivbeln-vbeln.
    select-options: s_vbeln for vbak-vbeln.
    start-of-selection.
    refresh: gt_items.
    select vbap~vbeln vbap~posnr into table gt_items from vbap
                                                                                    inner join vbak
                                                                                    on vbak~vbeln = vbap~vbeln
                                                                                    inner join vbup
                                                                                    on vbup~vbeln = vbap~vbeln
                                                                                    and vbup~posnr = vbap~posnr
                                                                                    where vbak~vbeln in s_vbeln
                                                                                        and vbak~auart eq 'ZOR'
                                                                                        and vbup~lfgsa ne 'C'
                                                                                        and vbup~absta ne 'C'.
    loop at gt_items.
    clear: gv_vbeln.
    clear: gs_ordhead, gs_ordheadx.
    refresh: gt_orditems, gt_orditemsx, gt_return.
    clear: gt_orditems, gt_orditemsx, gt_return.
    gv_vbeln = gt_items-vbeln.
    gs_ordheadx-updateflag  = 'U'.
    gt_orditems-itm_number  = gt_items-posnr.
    gt_orditems-reason_rej  = '93'.
    append gt_orditems.
    gt_orditemsx-itm_number = gt_items-posnr.
    gt_orditemsx-updateflag = 'U'.
    gt_orditemsx-reason_rej = 'X'.
    append gt_orditemsx.
    call function 'BAPI_SALESORDER_CHANGE'
       exporting
          salesdocument               = gv_vbeln
          order_header_in             = gs_ordhead
          order_header_inx            = gs_ordheadx
       tables
           return                      = gt_return
           order_item_in               = gt_orditems
           order_item_inx              = gt_orditemsx.
    read table gt_return with key type = 'E'.
    if sy-subrc ne 0.
       call function 'BAPI_TRANSACTION_COMMIT'
          exporting           wait = 'X'.
       message 'Sales order update was succesfull' type 'S'.
    endif.
    endloop.
    As result we get the following error :

    Hi Kurt,
    It looks like somebody has created custom logic (modification or enhancement) to display a screen. This results in an exception, as you currently executing the BAPI in a background process and not a dialog process.
    You can tell it is custom logic as the screen number begins with a "9", which are usually reserved for customer enhancements. 
    If you look at the source code extract in ST22 (Use the Tree Menu on the left hand side of the screen "Runtime Error"->"ABAP Developer View"->"Source Code Extract"), you can find the offending screen call. 
    You can stop the screen call logic by checking if the code is being run in background.  Check if the value of the system field SY-BATCH is set to "X", implying the code is being run in a background process.  If so then do not process the screen display logic. 
    Note you may need to add some logic to update the BAPI return fields with information pertinent to the screen that would have been displayed. 
    Cheers,
    Katan

  • Update sales order using BAPI_SALESORDER_CHANGE --- URGENT!!!!

    Hello,
    <b> I want to update Batch, Pricing date, Header text & Item text using BAPI_SALESORDER_CHANGE.</b>
    But i am not able to do it.
    i have written a code, but it's still not updating:
    PARAMETERS: p_vbeln LIKE vbak-vbeln.
    TYPES: BEGIN OF t_return.
            INCLUDE STRUCTURE bapiret2.
    TYPES: END OF t_return.
    TYPES: BEGIN OF t_order_item_in.
            INCLUDE STRUCTURE bapisditm.
    TYPES: END OF t_order_item_in.
    TYPES: BEGIN OF t_order_item_inx.
            INCLUDE STRUCTURE bapisditmx.
    TYPES: END OF t_order_item_inx.
    TYPES: BEGIN OF t_schedule_lines.
            INCLUDE STRUCTURE bapischdl.
    TYPES: END OF t_schedule_lines.
    TYPES: BEGIN OF t_schedule_linesx.
            INCLUDE STRUCTURE bapischdlx.
    TYPES: END OF t_schedule_linesx.
    TYPES: BEGIN OF t_order_text.
            INCLUDE STRUCTURE bapisdtext.
    TYPES: END OF t_order_text.
    DATA: l_vbeln              LIKE          bapivbeln-vbeln,
          i_order_header_inx   LIKE          bapisdh1x,
          i_order_header_in    LIKE          bapisdh1,
          i_return             TYPE TABLE OF t_return,
          i_order_item_in      TYPE TABLE OF t_order_item_in,
          wa_order_item_in     LIKE LINE  OF i_order_item_in,
          i_order_item_inx     TYPE TABLE OF t_order_item_inx,
          wa_order_item_inx    LIKE LINE  OF i_order_item_inx,
          i_schedule_lines     TYPE TABLE OF t_schedule_lines,
          wa_schedule_lines    LIKE LINE  OF i_schedule_lines,
          i_schedule_linesx    TYPE TABLE OF t_schedule_linesx,
          wa_schedule_linesx   LIKE LINE  OF i_schedule_linesx,
          i_order_text         TYPE TABLE OF t_order_text,
          wa_order_text        LIKE LINE  OF i_order_text,
          w_return             LIKE          bapiret2,
          l_date               TYPE char10.
    CLEAR l_vbeln.
    l_vbeln = p_vbeln.
              UPDATE REJECTION REASON IN SALES ORDER                *
    *WRITE sy-datum TO l_date.
    i_order_header_inx-updateflag = 'U'.
    REFRESH i_order_item_in.
    CLEAR wa_order_item_in.
    wa_order_item_in-itm_number = '000010'.
    wa_order_item_in-batch = '2007450027'.
    wa_order_item_in-price_date = sy-datum.
    wa_order_item_in-reason_rej = '00'.
    APPEND wa_order_item_in TO i_order_item_in.
    REFRESH i_order_item_inx.
    CLEAR wa_order_item_inx.
    wa_order_item_inx-itm_number = '000010'.
    wa_order_item_inx-updateflag = 'U'.
    wa_order_item_in-batch = 'X'.
    wa_order_item_in-price_date = 'X'.
    wa_order_item_inx-reason_rej = 'X'.
    APPEND wa_order_item_inx TO i_order_item_inx.
    *wa_order_text-doc_number = l_vbeln.
    **wa_order_text-TDOBJECT = 'EHSWA_MAN'.
    ***wa_order_text-text_id = '0001'.
    **wa_order_text-TDTEXT = 'Header Texts'.
    *wa_order_text-text_line = 'SYNGENTA HEADER'.
    ***wa_order_text-function = 'U'.
    wa_order_text-doc_number = l_vbeln.
    wa_order_text-itm_number = '000010'.
    *wa_order_text-TDOBJECT = 'EBAN'.
    wa_order_text-text_id = '0001'.
    *wa_order_text-TDTEXT = 'Item text'.
    wa_order_text-text_line = 'SYNGENTA TEXT'.
    wa_order_text-function = '004'.
    APPEND wa_order_text TO i_order_text.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        salesdocument               = l_vbeln
      ORDER_HEADER_IN             =
        order_header_inx            = i_order_header_inx
      SIMULATION                  =
      BEHAVE_WHEN_ERROR           = ' '
      INT_NUMBER_ASSIGNMENT       = ' '
      LOGIC_SWITCH                =
      NO_STATUS_BUF_INIT          = ' '
      TABLES
        return                      = i_return
        order_item_in               = i_order_item_in
        order_item_inx              = i_order_item_inx
      PARTNERS                    =
      PARTNERCHANGES              =
      PARTNERADDRESSES            =
      ORDER_CFGS_REF              =
      ORDER_CFGS_INST             =
      ORDER_CFGS_PART_OF          =
      ORDER_CFGS_VALUE            =
      ORDER_CFGS_BLOB             =
      ORDER_CFGS_VK               =
      ORDER_CFGS_REFINST          =
       schedule_lines              = i_schedule_lines
       schedule_linesx             = i_schedule_linesx
       order_text                  = i_order_text
      ORDER_KEYS                  =
      CONDITIONS_IN               =
      CONDITIONS_INX              =
      EXTENSIONIN                 =
    IF sy-subrc = 0.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait   = 'X'
        IMPORTING
          return = w_return.
    ENDIF.
    Please help out.
    Please send the code of it.
    Thanks in advance...

    START-OF-SELECTION.
    Get Blocked Orders
      PERFORM sub_select_orders.
      PERFORM order_reason_for_reject.
      END-OF-SELECTION.
    Display output
      PERFORM sub_display_output.
    *&      Form  sub_select_orders
          text
    FORM sub_select_orders .
      SELECT a~vbeln
             a~erdat
             a~erzet
             a~auart
             b~posnr
             FROM ( vbak as A
             INNER JOIN VBAP AS B
             on Bvbeln = AVBELN )
             INTO TABLE i_order_data
             WHERE a~vbeln IN s_ordno  AND
                   A~auart IN s_auart  AND
                   A~erdat IN s_orddt  AND
                   A~vkorg IN s_vkorg  AND
                   A~vtweg IN s_vtweg  AND
                   A~spart IN s_spart .
      IF sy-subrc NE 0.
        MESSAGE i001.
      No data selected
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " sub_get_blocked_orders
    *&      Form  order_reason_for_reject
          text
    -->  p1        text
    <--  p2        text
    FORM order_reason_for_reject .
      LOOP AT i_order_data INTO w_order_data.
        w_output-vbeln = w_order_data-vbeln.
        w_ordhdrx-updateflag = c_update.
    Update Order Reason for rejection .
        w_orditem-ITM_NUMBER = w_order_data-posnr.
        w_orditem-reason_rej = p_abgru.
        append w_orditem to i_orditem .
        w_orditemx-ITM_NUMBER = w_order_data-posnr.
        w_orditemx-updateflag = c_update.
        w_orditemx-reason_rej = 'X'.
        append w_orditemx to i_orditemx .
        At end of vbeln .
        w_output-vbeln = w_order_data-vbeln .
          CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
            EXPORTING
              salesdocument    = w_order_data-vbeln
              order_header_in  = w_ordhdr
              order_header_inx = w_ordhdrx
            TABLES
              ORDER_ITEM_IN    = i_orditem
              ORDER_ITEM_INX   = i_orditemx
              return           = i_bapiret.
          READ TABLE i_bapiret WITH KEY type = c_error
                               TRANSPORTING NO FIELDS.
          IF sy-subrc EQ '0'.
            move 'Order Reason for rejection update Failed' to
            w_output-message .
          ELSE.
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                wait   = c_check
              IMPORTING
                 return = i_return.
          move 'Order Reason for rejection update successful' to
          w_output-message .
         endif .
         refresh :i_orditemx , i_orditem .
        Endat .
        APPEND w_output TO i_output.
        CLEAR w_output.
      endloop .
    ENDFORM.                    " order_reason_for_reject

  • Problem in updating Quantity using 'BAPI_SALESORDER_CHANGE'

    Hi,
    I am using Bapi_salesorder_change to update item quantity and reason for rejection.My code is as below.
           MOVE c_u TO e_orderheader_inx-updateflag.
            FREE i_orderitem_in.
            MOVE newitem-posnr_ref TO e_orderitem_in-itm_number.
            MOVE c_rej TO e_orderitem_in-reason_rej.
            MOVE c_qt TO e_orderitem_in-target_qty.
            APPEND e_orderitem_in TO i_orderitem_in.
            FREE i_orderitem_inx.
            MOVE newitem-posnr_ref TO e_orderitem_inx-itm_number .
            MOVE c_u TO e_orderitem_inx-updateflag.
            MOVE c_x TO e_orderitem_inx-reason_rej.
            MOVE c_x TO e_orderitem_inx-target_qty .
            APPEND e_orderitem_inx TO i_orderitem_inx.
            FREE i_return.
            CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
              EXPORTING
                salesdocument              = xvbak-vbeln
                ORDER_HEADER_IN            =
                order_header_inx           = e_orderheader_inx
              TABLES
               return                      =  i_zbapiret2
               order_item_in               =  i_orderitem_in
               order_item_inx              =  i_orderitem_inx.
    But in 'i_zbapiret2' iam getting the below errors.
    1)Storage location BH in plant is not defined .
    2) Error in ITEM_IN 000020
    3) sales documnet 000078965 was not changed.
    PLease help me to solve this problem.
    Thanks in advance,
    Sravanthi.

    Hi,
      From the error message it seems that you dont have the storage location for the plant as you have passed to the BAPI check table 'T001L' to see if that storage location is there for the plant. If not then we need to maintain that.
    Regards,
    Himanshu

  • Problem with BAPI_SALESORDER_CHANGE function module

    I know lot of posts have been done about problems with this function module. However I was not able to find the answer to my problem. Hence posting a new thread
    I have the following code which changes the reason rejection (if required to 'ZF') and also updates the sales order quantity.
    The code works absolutely fine as long as the PGI date of the order item is either today or in the future. However if the PGI date of the order item is in the past. I get an error in the t_return table with error type 'E' saying 'PGI date is in the past hence could not update the item'.
    If I try to update the same order quantity in VA02 for the item with PGI date in the past it does so without any problem.
    Can someone please suggest what the problem might be. Or if there is some other way I can update the quantity. (I dont want to use BDC)
    FORM change_sales_order_item USING value(r_rtb_posnrs) TYPE zpsd_ztsdrtb_ro_track
                                 CHANGING r_return TYPE type_t_bapiret2.
      DATA: v_order_header_in TYPE bapisdh1,
      v_order_header_inx TYPE bapisdh1x,
      t_schedule_lines TYPE bapischdl OCCURS 0 WITH HEADER LINE,
      t_schedule_linesx TYPE bapischdlx OCCURS 0 WITH HEADER LINE,
      v_temp_rtb_vbeln TYPE vbeln,
      v_temp_rtb_posnr TYPE posnr,
      wa_old_rtb_posnrs TYPE ztsdrtb_ro_track,
      t_item_in TYPE bapisditm OCCURS 0 WITH HEADER LINE,
      t_item_inx TYPE bapisditmx OCCURS 0 WITH HEADER LINE,
      v_rtb_old_vbeln TYPE zrtbvbeln,
      v_rtb_old_posnr TYPE zrtbposnr,
      v_ro_old_vbeln TYPE zrovbeln,
      v_ro_old_posnr TYPE zroposnr,
      v_rtb_count TYPE i,
      v_next_row_index TYPE i,
      v_update_order_flg TYPE char1, "Update the sales order flag
      v_rtb_record_counter TYPE i,
      v_original_vbeln TYPE vbeln,
      t_bapiret TYPE STANDARD TABLE OF bapiret2.
      FIELD-SYMBOLS: <wa_r_rtb_posnrs> TYPE ztsdrtb_ro_track,
                     <wa_r_rtb_posnr_next> TYPE ztsdrtb_ro_track.
      CONSTANTS: c_updateflag TYPE bapisditmx-updateflag VALUE 'U'.
      v_order_header_inx-updateflag = 'U'.
    Get rid of the duplicate records for the same RTB order. Just use
    the last record quantity in the internal table
      LOOP AT r_rtb_posnrs ASSIGNING <wa_r_rtb_posnrs>.
        v_rtb_record_counter = v_rtb_record_counter + 1.
        <wa_r_rtb_posnrs>-seqnr = v_rtb_record_counter.
      ENDLOOP.
      SORT r_rtb_posnrs DESCENDING BY zrtbvbeln zrtbposnr seqnr zrtbconsumedflg.
      DELETE ADJACENT DUPLICATES FROM r_rtb_posnrs COMPARING zrtbvbeln zrtbposnr.
      DESCRIBE TABLE r_rtb_posnrs LINES v_rtb_count.
      v_rtb_record_counter = 0.
      v_update_order_flg = space.
      LOOP AT r_rtb_posnrs ASSIGNING <wa_r_rtb_posnrs>.
        v_rtb_record_counter = v_rtb_record_counter + 1.
        v_update_order_flg = space.
    Popluate the item quantity update flags for schedule lines
        t_schedule_linesx-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
        t_schedule_linesx-sched_line = '0001'.
        t_schedule_linesx-updateflag = c_updateflag.
        t_schedule_linesx-req_qty = 'X'.
        APPEND t_schedule_linesx.
        CLEAR t_schedule_linesx.
    *Item (Order QQuantity Field to be changed "KWMENG")
        t_schedule_lines-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
        t_schedule_lines-sched_line = '0001'.
        t_schedule_lines-req_qty = <wa_r_rtb_posnrs>-zrtbchgqty.
        APPEND t_schedule_lines.
        CLEAR t_schedule_lines.
    If fully consumed then set the rejection flag
        IF <wa_r_rtb_posnrs>-zrtbconsumedflg = 'X'.
          t_item_inx-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
          t_item_inx-updateflag = 'X'.
          t_item_inx-reason_rej = 'X'.
          APPEND t_item_inx.
          CLEAR t_item_inx.
          t_item_in-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
          t_item_in-reason_rej = 'ZF'.
          APPEND t_item_in.
          CLEAR t_item_in.
        ELSE.
          t_item_inx-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
          t_item_inx-updateflag = 'X'.
          t_item_inx-reason_rej = 'X'.
          APPEND t_item_inx.
          CLEAR t_item_inx.
          t_item_in-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
          t_item_in-reason_rej = ' '.
          APPEND t_item_in.
          CLEAR t_item_in.
        ENDIF.
    If you have reached the last line of the RTB intern table update the sales order
    *Index pointing to the next row
        v_next_row_index = v_rtb_record_counter + 1.
        IF v_rtb_record_counter = v_rtb_count.
          v_update_order_flg = 'X'.
        ELSEIF v_rtb_record_counter < v_rtb_count.
    Get the next row data
          READ TABLE r_rtb_posnrs INDEX v_next_row_index ASSIGNING <wa_r_rtb_posnr_next>.
          IF sy-subrc = 0.
            IF <wa_r_rtb_posnrs>-zrtbvbeln <> <wa_r_rtb_posnr_next>-zrtbvbeln.
              v_update_order_flg = 'X'.
            ENDIF.
          ENDIF.
        ELSE.
          v_update_order_flg = space.
        ENDIF.
    update the rtb orders with quantities and the rejection flag (if required)
        IF v_update_order_flg = 'X'.
          CALL FUNCTION 'BAPI_SALESORDER_CHANGE' STARTING NEW TASK 'SOUPDATE'
            PERFORMING callbk_bapi_salesorder_change ON END OF TASK
            EXPORTING
              salesdocument    = <wa_r_rtb_posnrs>-zrtbvbeln
              order_header_in  = v_order_header_in
              order_header_inx = v_order_header_inx
            TABLES
              return           = t_return
              schedule_lines   = t_schedule_lines
              schedule_linesx  = t_schedule_linesx
              order_item_in    = t_item_in
              order_item_inx   = t_item_inx.
          WAIT UNTIL t_return[] IS NOT INITIAL.
          READ TABLE t_return INTO wa_return WITH KEY type = 'E'.
          IF sy-subrc <> 0.
          ELSE.
            r_return[] = t_return[].
            MESSAGE ID 'ZSD' TYPE 'E' NUMBER 613.
           RAISE errorinorderupdate.
          ENDIF.
          REFRESH t_schedule_linesx.
          REFRESH t_schedule_lines.
          REFRESH t_item_in.
          REFRESH t_item_inx.
          REFRESH t_return.
        ENDIF.
      ENDLOOP.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
       IMPORTING
         return = t_bapiret.
    ENDFORM.                    "Change_Sales_Order

    see the following example and try to do this:
    i_hdrx-updateflag = 'U'.
    *" Fill required SCHEDULE_LINES data.
    i_sched-itm_number = p_posnr.
    i_sched-sched_line = p_etenr.
    i_sched-req_qty = p_reqqty.
    i_schedx-updateflag = 'U'.
    i_schedx-itm_number = p_posnr.
    i_schedx-sched_line = p_etenr.
    i_schedx-req_qty = 'X'.
    APPEND i_sched.
    APPEND i_schedx.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = p_vbeln
    order_header_in = i_hdr
    order_header_inx = i_hdrx
    TABLES
    return = i_ret
    schedule_lines = i_sched
    schedule_linesx = i_schedx.

  • BAPI_SALESORDER_CHANGE to update reason for rejection of sales order item

    Hi,
    The FM BAPI_SALESORDER_CHANGE is not working properly as I am getting below error when try to update the reason for rejection at sales order item level.
    The delivery is done for this salesorder. Is it because the reason for rejection field is not as an input field when delivery done?
    error in return table is " Field 'ABGRU' cannot be changed, VBAPKOM 000010  ready for input"
    Request your suggestions to avoid this error.
    Thanks

    >
    anikaushi wrote:
    > Hi,
    > The delivery is done for this salesorder. Is it because the reason for rejection field is not as an input field when delivery done?
    >
    >  error in return table is " Field 'ABGRU' cannot be changed, VBAPKOM 000010  ready for input"
    >
    >
    > Thanks
    Yes, Most likely.. You can confirm this by trying to change a order without delivery and see if it goes thru (to ensure that you have passed correct parameters)...
    you may have to delete the delivery (and if billing document exist, cancel it), before you can reject the line item... it would be safer to raise an error message and let the users manually delete delivery document as long as you don't have large volumes of this scenario..
    Please see the SDN thread for how you can avoid this error...
    Re: Cancel Sale Order after Issued Billing

  • Schedule lines creation with BAPI_SALESORDER_CHANGE

    Dear All,
    1. I'm trying to create a new Schedule Lines to an already existing Scheduling Agreement.
    2. For this, I'm using the BAPI --> BAPI_SALESORDER_CHANGE.
    3. This BAPI returns me a message saying that the Schedule line processed successfully.
    4. When I check the VBEP Table with the Scheduling Agreement number, I'm able to see the newly created schedule line.
    5. But, when I see the Transaction VA33, I'm not able to see the schedule lines.
    I checked in SDN and OSS notes. I found 1647069 which says to pass the line number and Item number which I'm already doing it.
    Can any one help me out ?
    Regards,
    Deepu.K

    I verified in my system that the below should work. Here, I am inserting a new schedule 0002 for item 10 with qty 1 and another date.
    Of course, you should ensure that there is sufficient quantity that is not yet confirmed by existing schedule lines.
    BAPI_SALESORDER_CHANGE
    SALESDOCUMENT = '0011827125'
    ORDER_HEADER_INX
               UPDATEFLAG = 'U'
    ORDER_ITEM_IN
               ITM_NUMBER = '000010'
    ORDER_ITEM_INX
               ITM_NUMBER = '000010'
               UPDATEFLAG = 'U'
    SCHEDULE_LINES
               ITM_NUMBER = '000010'
               SCHED_LINE = '0002'
               REQ_DATE   = '20120104'
               REQ_QTY = '1'
    SCHEDULE_LINESX
               ITM_NUMBER = '000010'
               SCHED_LINE = '0002'
               UPDATEFLAG = 'I'
               REQ_DATE   = 'X'
               REQ_QTY = 'X'.

  • BAPI_SALESORDER_CHANGE schedule_lines

    Hi experts.
    I'm doing a simple order update, using FM BAPI_SALESORDER_CHANGE.
    The goal is to change header data (with order_header_in and order_header_inx structures), schedule lines data (with schedule_lines and schedule_linesx structures) and  text data (with order_text structure).
    The problem is that header and text data is actually changed, but schedulle data doesn't.
    Can anyone help?
    Best regards.
    Valter Oliveira.
    SAMPLE CODE:
    HEADER
        CLEAR: wa_header_in.
        wa_header_in-po_dat_s   = wa_pub-data.
        wa_header_in-ref_1      = wa_pub-diario.
        wa_header_in-ref_1_s    = wa_pub-suplemento.
        wa_header_in-dlv_block  = space.
        CLEAR: wa_header_inx.
        wa_header_inx-updateflag  = 'U'.
        wa_header_inx-po_dat_s    = 'X'.
        wa_header_inx-ref_1       = 'X'.
        wa_header_inx-ref_1_s     = 'X'.
        wa_header_inx-dlv_block   = 'X'.
    SCHEDULE
        SELECT posnr FROM vbap
          INTO (vl_posnr)
         WHERE vbeln = wa_pub-vbeln.
          SELECT etenr FROM vbep
            INTO (vl_etenr)
           WHERE vbeln = wa_pub-vbeln
             AND posnr = vl_posnr.
            ti_sched-itm_number = vl_posnr.
            ti_sched-sched_line = vl_etenr.
            ti_sched-req_dlv_bl = space.
            ti_sched-req_date = wa_pub-data.
            ti_sched-sched_type = 'CN'.
            ti_schedx-itm_number = vl_posnr.
            ti_schedx-sched_line = vl_etenr.
            ti_schedx-req_dlv_bl = 'X'.
            ti_schedx-sched_type = 'X'.
            ti_schedx-req_date = 'X'.
            APPEND ti_sched. APPEND ti_schedx.
          ENDSELECT.
        ENDSELECT.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
          EXPORTING
            salesdocument    = wa_pub-vbeln
            order_header_in  = wa_header_in
            order_header_inx = wa_header_inx
          TABLES
            schedule_lines   = ti_sched
            schedule_linesx  = ti_schedx
            order_text       = ti_texts
            return           = ti_ret.

    Hi experts.
    I'm doing a simple order update, using FM BAPI_SALESORDER_CHANGE.
    The goal is to change header data (with order_header_in and order_header_inx structures), schedule lines data (with schedule_lines and schedule_linesx structures) and  text data (with order_text structure).
    The problem is that header and text data is actually changed, but schedulle data doesn't.
    Can anyone help?
    Best regards.
    Valter Oliveira.
    SAMPLE CODE:
    HEADER
        CLEAR: wa_header_in.
        wa_header_in-po_dat_s   = wa_pub-data.
        wa_header_in-ref_1      = wa_pub-diario.
        wa_header_in-ref_1_s    = wa_pub-suplemento.
        wa_header_in-dlv_block  = space.
        CLEAR: wa_header_inx.
        wa_header_inx-updateflag  = 'U'.
        wa_header_inx-po_dat_s    = 'X'.
        wa_header_inx-ref_1       = 'X'.
        wa_header_inx-ref_1_s     = 'X'.
        wa_header_inx-dlv_block   = 'X'.
    SCHEDULE
        SELECT posnr FROM vbap
          INTO (vl_posnr)
         WHERE vbeln = wa_pub-vbeln.
          SELECT etenr FROM vbep
            INTO (vl_etenr)
           WHERE vbeln = wa_pub-vbeln
             AND posnr = vl_posnr.
            ti_sched-itm_number = vl_posnr.
            ti_sched-sched_line = vl_etenr.
            ti_sched-req_dlv_bl = space.
            ti_sched-req_date = wa_pub-data.
            ti_sched-sched_type = 'CN'.
            ti_schedx-itm_number = vl_posnr.
            ti_schedx-sched_line = vl_etenr.
            ti_schedx-req_dlv_bl = 'X'.
            ti_schedx-sched_type = 'X'.
            ti_schedx-req_date = 'X'.
            APPEND ti_sched. APPEND ti_schedx.
          ENDSELECT.
        ENDSELECT.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
          EXPORTING
            salesdocument    = wa_pub-vbeln
            order_header_in  = wa_header_in
            order_header_inx = wa_header_inx
          TABLES
            schedule_lines   = ti_sched
            schedule_linesx  = ti_schedx
            order_text       = ti_texts
            return           = ti_ret.

Maybe you are looking for

  • Potentialy serious problem with Oracle 11g R1

    Today i have download to try Oracle 11g , my system supports database system requirerments and into installation progress my antivirus software find some troyan horses and my antivirus software is ordinary not powerfull .Do someone have the same prob

  • ABAP Dump in ME28

    Hi All, Now I Get an ABAP Dump on Transaction ME28 release of purchaseorder,  Actually the reason for this dump comes from purchase order print out program in Transaction ME23N we made a custom program to print the purchaseorder and after taking the

  • SAP ABAP Online Training | Online SAP ABAP Training in usa, uk, Canada, Malaysia, Australia, India, Singapore.

    SAP ABAP (Advanced Business Application Programming) is one of the most sought-after modules of SAP. In accordance with its manifold returns the trend for training of SAP ABAP Online Training  is constantly on a sharp upsurge. In the first phase of t

  • Error Trying to get a managed server connected to the admin server

    I am getting the following error when I try starting up a managed server. I put -Dweblogic.management.server=http://host:port The managed server starts with out setting the management.server setting. It gives the error below when I put the management

  • DAQ ActiveX-Co​ntrols Borland Delphi

    Hi @All, I'm working with NI-DAQ 6.9.3 Version by using Borland Delphi Software. I have the ActiveX-Control Komponents on my Form, for example the AO, AI, DIO, CWGraph. My Problem is if i run the Programm i get the Message as shown in the Attachment.