Application Development and Automation 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: 
Read only

BAPI_SALESORDER_CHANGE -Problem in Background

Former Member
0 Likes
1,036

Hi all,

There is a requirement to change pricing conditions in Sales order.The pricing condition is based some values passed in tab

additional data B. Am using the standard BAPI for modifying the value.

But the changed pricing appears only when the SO is opened in Change mode but not in display mode.On adding the

LOGIC_SWITCH -PRICING = 'B', this problem was eliminated.But now wat happens is if there are two pricing conditions, only the first condition appears in display mode whereas both conditions appear in change mode.

Tried adding LOGIC_SWITCH --cond_handl = 'X' but to no avail, still the same. can anyone help me please.

This problemm is faced only wen the BAPI_SALESORDER_CHANGE is run in Background.

Else everything is fine in Foreground.

Thanks in advance.

Hi all,

There is a requirement to change pricing conditions in Sales order.The pricing condition is based some values passed in tab

additional data B. Am using the standard BAPI for modifying the value.

But the changed pricing appears only when the SO is opened in Change mode but not in display mode.On adding the

LOGIC_SWITCH -PRICING = 'B', this problem was eliminated.But now wat happens is if there are two pricing conditions, only the first condition appears in display mode whereas both conditions appear in change mode.

Tried adding LOGIC_SWITCH --cond_handl = 'X' but to no avail, still the same. can anyone help me please.

This problemm is faced only wen the BAPI_SALESORDER_CHANGE is run in Background.

Else everything is fine in Foreground.

Thanks in advance.

1 REPLY 1
Read only

Former Member
0 Likes
575

HI kavitha

I used the same bapi to update pricing field for sales order.

Please specify which fields you want to update.

are these fields present in bapi import or tables parameters.

If no then these fields are Z fields and they have to be enhanced in tables first and then in exit.

below is the demo program to pass z fields (ZZAGMID ) in bapi ( note : tables has to be enhanced before )

this code will help u to understand how to update z fields

let me if you are not able to follow..


REPORT  ZTEST_BAPI.

PARAMETERS: P_VBELN TYPE VBAK-VBELN,
            p_posnr TYPE vbap-posnr,
            P_AGMID type BAPE_VBAP-ZZAGMID.

DATA: T_LINE LIKE BAPISDITM OCCURS 0 WITH HEADER LINE.
DATA: T_LINEX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE.
DATA: T_EXTEN LIKE BAPIPAREX OCCURS 0 WITH HEADER LINE.
DATA: T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
DATA: BAPE_VBAP LIKE BAPE_VBAP.
DATA: BAPE_VBAPX LIKE BAPE_VBAPX.
DATA: ORDER_HEADERX LIKE BAPISDH1X.
DATA: BAPE_VBAK type BAPE_VBAK .
DATA: BAPE_VBAKX LIKE BAPE_VBAKX.
DATA: W_RETURN LIKE BAPIRET2.
data: v_val TYPE BAPIPAREX-VALUEPART1.
data: v_number(5) TYPE c.

ORDER_HEADERX-UPDATEFLAG = 'U'.


T_LINE-ITM_NUMBER = p_posnr.
T_LINE-PLANT = '5AP1'.
APPEND T_LINE.

T_LINEX-ITM_NUMBER = p_posnr.
T_LINEX-UPDATEFLAG = 'U'.
T_LINEX-PLANT = 'X'.
APPEND T_LINEX.

T_EXTEN-STRUCTURE = 'BAPE_VBAP'.
BAPE_VBAP-vbeln = p_vbeln.
BAPE_VBAP-posnr = p_posnr.
BAPE_VBAP-ZZAGMID = P_AGMID.
T_EXTEN+30 = BAPE_VBAP.
APPEND t_exten.

BAPE_VBAPX-VBELN = P_VBELN.
BAPE_VBAPX-POSNR = p_posnr.
BAPE_VBAPX-ZZAGMID = 'X'.
T_EXTEN-STRUCTURE = 'BAPE_VBAPX'.
T_EXTEN+30 = BAPE_VBAPX.
APPEND T_EXTEN.

IMPORT v_number from MEMORY ID v_number.
BREAK-POINT.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = p_vbeln
order_header_inx = ORDER_HEADERX
tables
return = T_RETURN
ORDER_ITEM_IN = T_LINE
ORDER_ITEM_INX = T_LINEX
EXTENSIONIN = T_EXTEN.

call function 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
.

CLEAR: W_RETURN.
LOOP AT T_RETURN INTO W_RETURN.
WRITE: W_RETURN-MESSAGE,/.
ENDLOOP.