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 and

Former Member
0 Kudos
134

Hi all,

I'm using BAPI_SALESORDER_CHANGE to update the Item Category. Everything is ok, but after update, the field Customer Material has been initialized (and I don' want it). What I'm doing wrong?

Thanx in advance.

That's my code:

data: aux_matnr type matnr.

aux_matnr = '000000000000007873'.

loop at in_pepo into lw_pepo.

lw_bapisditm-ITM_NUMBER = lw_pepo-posnr.

lw_bapisditm-ITEM_CATEG = in_tipo_posicion.

lw_bapisditm-MATERIAL = aux_matnr.

append lw_bapisditm to lt_bapisditm.

clear lw_bapisditm.

endloop.

lw_bapisdh1x-UPDATEFLAG = 'U'.

lw_bapisditmx-ITEM_CATEG = 'X'.

append lw_bapisditmx to lt_bapisditmx.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = lw_pepo-vbeln

  • ORDER_HEADER_IN =

order_header_inx = lw_bapisdh1x

tables

return = lt_bapiret2

ORDER_ITEM_IN = lt_bapisditm

ORDER_ITEM_INX = lt_bapisditmx

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
85

Hi,

Check this code..This is working fine for me..It is not clearing the customer material..

DATA: T_ITEM LIKE BAPISDITM OCCURS 0 WITH HEADER LINE.

DATA: T_ITEMX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE.

DATA: T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.

DATA: BAPISDH1X LIKE BAPISDH1X.

PARAMETERS: P_VBELN LIKE VBAK-VBELN.

PARAMETERS: P_PSTYV LIKE VBAP-PSTYV.

BAPISDH1X-UPDATEFLAG = 'U'.

T_ITEM-ITM_NUMBER = '000010'.

T_ITEM-ITEM_CATEG = P_PSTYV.

APPEND T_ITEM.

T_ITEMX-ITM_NUMBER = '000010'.

T_ITEMX-UPDATEFLAG = 'U'.

T_ITEMX-ITEM_CATEG = 'X'.

APPEND T_ITEMX.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = P_VBELN

order_header_inx = BAPISDH1X

tables

return = T_RETURN

ORDER_ITEM_IN = T_ITEM

ORDER_ITEM_INX = T_ITEMX

.

COMMIT WORK.

Thanks,

Naren

9 REPLIES 9

Former Member
0 Kudos
85

Hi,

Select the customer material from the table and pass it again to the BAPI, if it is getting cleared..

Thanks,

Naren

0 Kudos
85

Yes Naren it will work... but I would like to know why, and if could happen with another field...

I mean, I would prefer not to pass all the vbap.

Thanx anyway

former_member181962
Active Contributor
0 Kudos
85

lw_bapisditmx-MATERIAL = 'X'.

lw_bapisditmx-ITEM_CATEG = 'X'.

append lw_bapisditmx to lt_bapisditmx.

try passing X to material as well in bapisditmx structure.

Regards,

ravi

0 Kudos
85

but I don't want to update nor material neither customer material. I just want to update the ItemCat. and only the ItemCat.

Thank you anyway

Former Member
0 Kudos
85

Hi,

I will check it and get back to you..

Thanks

Naren

Former Member
0 Kudos
86

Hi,

Check this code..This is working fine for me..It is not clearing the customer material..

DATA: T_ITEM LIKE BAPISDITM OCCURS 0 WITH HEADER LINE.

DATA: T_ITEMX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE.

DATA: T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.

DATA: BAPISDH1X LIKE BAPISDH1X.

PARAMETERS: P_VBELN LIKE VBAK-VBELN.

PARAMETERS: P_PSTYV LIKE VBAP-PSTYV.

BAPISDH1X-UPDATEFLAG = 'U'.

T_ITEM-ITM_NUMBER = '000010'.

T_ITEM-ITEM_CATEG = P_PSTYV.

APPEND T_ITEM.

T_ITEMX-ITM_NUMBER = '000010'.

T_ITEMX-UPDATEFLAG = 'U'.

T_ITEMX-ITEM_CATEG = 'X'.

APPEND T_ITEMX.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = P_VBELN

order_header_inx = BAPISDH1X

tables

return = T_RETURN

ORDER_ITEM_IN = T_ITEM

ORDER_ITEM_INX = T_ITEMX

.

COMMIT WORK.

Thanks,

Naren

0 Kudos
85

Great!

Former Member
0 Kudos
85

Sorry, I forget to thank you

Former Member
0 Kudos
85

Hi,

No problem..:-))

Thanks,

Naren