<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: BAPI_SALESORDER_CHANGE -Problem in Background in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-salesorder-change-problem-in-background/m-p/7035492#M1499998</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI kavitha&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used the same bapi to update pricing field for sales order.&lt;/P&gt;&lt;P&gt;Please specify which fields you want to update.&lt;/P&gt;&lt;P&gt;are these fields present in bapi import or tables parameters.&lt;/P&gt;&lt;P&gt;If no then these fields are Z fields and they have to be enhanced in tables first and then in exit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below is the demo program to pass z fields (ZZAGMID ) in bapi ( note : tables has to be enhanced before )&lt;/P&gt;&lt;P&gt;this code will help u to understand how to update z fields&lt;/P&gt;&lt;P&gt;let me if you are not able to follow..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
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.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Jul 2010 10:48:16 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-07-21T10:48:16Z</dc:date>
    <item>
      <title>BAPI_SALESORDER_CHANGE -Problem in Background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-salesorder-change-problem-in-background/m-p/7035491#M1499997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a requirement to change pricing conditions in Sales order.The pricing condition is based some values passed in tab &lt;/P&gt;&lt;P&gt;additional data B. Am using the standard BAPI for modifying the value.&lt;/P&gt;&lt;P&gt;But the changed pricing appears only when the SO is opened in Change mode but not in display mode.On adding the &lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Tried adding LOGIC_SWITCH --cond_handl = 'X' but to no avail, still the same. can anyone help me please.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This problemm is faced only wen the BAPI_SALESORDER_CHANGE is run in Background.&lt;/P&gt;&lt;P&gt;Else everything is fine in Foreground.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 May 2010 07:00:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-salesorder-change-problem-in-background/m-p/7035491#M1499997</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-27T07:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_SALESORDER_CHANGE -Problem in Background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-salesorder-change-problem-in-background/m-p/7035492#M1499998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI kavitha&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used the same bapi to update pricing field for sales order.&lt;/P&gt;&lt;P&gt;Please specify which fields you want to update.&lt;/P&gt;&lt;P&gt;are these fields present in bapi import or tables parameters.&lt;/P&gt;&lt;P&gt;If no then these fields are Z fields and they have to be enhanced in tables first and then in exit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below is the demo program to pass z fields (ZZAGMID ) in bapi ( note : tables has to be enhanced before )&lt;/P&gt;&lt;P&gt;this code will help u to understand how to update z fields&lt;/P&gt;&lt;P&gt;let me if you are not able to follow..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
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.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jul 2010 10:48:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-salesorder-change-problem-in-background/m-p/7035492#M1499998</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-21T10:48:16Z</dc:date>
    </item>
  </channel>
</rss>

