Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_SALESORDER_CHANGE - how to change item delivery block(VBEP-LIFSP)

Former Member
0 Kudos

HI all,

I have to change on item delivery block (VBEP-LIFSP) and header level delivery block (VBAK-LIFSK) ,

In my report i`am using BAPI_SAILBOARDER_CHANGE,

for header:

LT_BAPISDH1X-UPDATEFLAG = 'X'.
         LT_BAPISDH1X-DLV_BLOCK = 'X'.
        LT_BAPISDH1-DLV_BLock = '

'.

for item

LT_BAPISCHDLX-UPDATEFLAG = 'U'.
      LT_BAPISCHDLX-REQ_DLV_BL = 'X'.
      LT_BAPISCHDLX-SCHED_LINE = '0001'.
      LT_BAPISCHDLX-ITM_NUMBER = '10'.

      LT_BAPISCHDL-REQ_DLV_BL = ' '.
      LT_BAPISCHDL-SCHED_LINE = '0001'.
      LT_BAPISCHDL-ITM_NUMBER = '10'.

For header it`s working properly, but for item - not at all - message: "Field header_inx-updateflag is not an input field"

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        SALESDOCUMENT               = L_SPETAB-vbeln
        ORDER_HEADER_IN             = LT_BAPISDH1
        ORDER_HEADER_INX            = LT_BAPISDH1X
      TABLES
        RETURN                      = LS_RETURN
        SCHEDULE_LINES              = LT_BAPISCHDL
        SCHEDULE_LINESX             = LT_BAPISCHDLX
             .

Any suggestions? Thank you

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

In your code, please change the following:

FROM:

LT_BAPISCHDLX-UPDATEFLAG = 'U'.

LT_BAPISCHDLX-REQ_DLV_BL = 'X'.

LT_BAPISCHDLX-SCHED_LINE = '0001'.

LT_BAPISCHDLX-ITM_NUMBER = '10'.

TO:

LT_BAPISCHDLX-UPDATEFLAG = 'U'.

LT_BAPISCHDLX-REQ_DLV_BL = 'X'.

LT_BAPISCHDLX-SCHED_LINE = 'X'.

LT_BAPISCHDLX-ITM_NUMBER = 'X'.

Please take note that in changing Sales Order, Purchase Orders, etc using BAPI's, there are always two tables to which you need to modify. As you did, you use the table LT_BAPISCHDLX. Take not the suffix "X" of this table. X means "to change". So in this case, you need to change 3 fields. So like what you did, you pass the values into table LT_BAPISCHDL and in table LTBAPISCHDLX, you need to tell that you are changing these fields via marking them with X.

Moreoever, when updating line items, do it one at a time. Clear your tables before filling them again. For example, you have 4 items in your order, and you want to update two of them, you can't update them at the same time. What you need is to update it one at a time.

Finally, you have to commit your work using BAPI_TRANSACTION_COMMIT.

I hope it helps. cheers

9 REPLIES 9

Former Member
0 Kudos

Hi,

Check the status of the item in Status tab, It will allow only the Incomplete and processing status item's delivery block to change.

If the status is completed, then it will be grey out and will allow you to make the changes.

Item Data Incomplete

Item data for deliv. Incomplete

Item billing data... Incomplete

Please check the status before chanigng the delivery block.

Shiva

0 Kudos

The status is 'complete', but still i am not able to change the delivery block.

0 Kudos

If subsequent document (Delivery or Invoice) is created for the entire order quantity (for the line item), Delivery bock field at Schedule line level will not be available for updation. Simulate the scenario with Standard transaction VA02.

Regards, Vinod

0 Kudos

Hi

If the status is complete then it will not allow you to make the changes.

Please check the status in table VBUP for item and the fields for the status LFSTA andLFGSA

If they are equal to C then it will not allowed to change

Shiva

Former Member
0 Kudos

Hi,

In your code, please change the following:

FROM:

LT_BAPISCHDLX-UPDATEFLAG = 'U'.

LT_BAPISCHDLX-REQ_DLV_BL = 'X'.

LT_BAPISCHDLX-SCHED_LINE = '0001'.

LT_BAPISCHDLX-ITM_NUMBER = '10'.

TO:

LT_BAPISCHDLX-UPDATEFLAG = 'U'.

LT_BAPISCHDLX-REQ_DLV_BL = 'X'.

LT_BAPISCHDLX-SCHED_LINE = 'X'.

LT_BAPISCHDLX-ITM_NUMBER = 'X'.

Please take note that in changing Sales Order, Purchase Orders, etc using BAPI's, there are always two tables to which you need to modify. As you did, you use the table LT_BAPISCHDLX. Take not the suffix "X" of this table. X means "to change". So in this case, you need to change 3 fields. So like what you did, you pass the values into table LT_BAPISCHDL and in table LTBAPISCHDLX, you need to tell that you are changing these fields via marking them with X.

Moreoever, when updating line items, do it one at a time. Clear your tables before filling them again. For example, you have 4 items in your order, and you want to update two of them, you can't update them at the same time. What you need is to update it one at a time.

Finally, you have to commit your work using BAPI_TRANSACTION_COMMIT.

I hope it helps. cheers

0 Kudos

thank you very much

0 Kudos

I don't think the codes lines below will work.

LT_BAPISCHDLX-SCHED_LINE = 'X'.
LT_BAPISCHDLX-ITM_NUMBER = 'X'.

See the structure field BAPISCHDLX-ITM_NUMBER (Component type POSNR_VA ( NUMC(6)) & BAPISCHDLX-SCHED_LINE (Component type ETENR (NUMC(4)). These fields should contain Item number & schedule line number while calling the BAPI.

Regards, Vinod

0 Kudos
BAPI part:
  LT_BAPISDH1X-UPDATEFLAG = 'U'.
  LT_BAPISCHDLX-UPDATEFLAG = 'U'.
  ""
  LT_BAPISDH1X-DLV_BLOCK = 'X'.
  LT_BAPISDH1-DLV_BLock = ' '.
  ""
  LT_BAPISCHDL-REQ_DLV_BL = ' '.
  LT_BAPISCHDLX-REQ_DLV_BL = 'X'.
  LT_BAPISCHDL-SCHED_LINE = '0001'.
  LT_BAPISCHDLX-SCHED_LINE = '0001'.
  LT_BAPISCHDL-ITM_NUMBER = '10'.
  LT_BAPISCHDLX-ITM_NUMBER = '10'.
  APPEND LT_BAPISCHDL.
  APPEND LT_BAPISCHDLX.
  "Funkciq za promqna delivery block-a
  CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
      SALESDOCUMENT    = p_vbeln
      ORDER_HEADER_IN  = LT_BAPISDH1
      ORDER_HEADER_INX = LT_BAPISDH1X
    TABLES
      RETURN           = LS_RETURN
      SCHEDULE_LINES   = LT_BAPISCHDL
      SCHEDULE_LINESX  = LT_BAPISCHDLX.

This is the working code

0 Kudos

Hi Vinod,

thank you for the correction. I stand myself corrected. I have mislook the structure of the BAPI. Anyhow, the principle of using this BAPI is to use that two tables.... Marking "X" values for those fields that you need to modify from tableX.

regards,