Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

BAPI_CONTRACT_CHANGE is not working with extension fields

$
0
0

My Custom requirement is to add a field in contract item level (Me31k/ME32k/Me33k).

To achieve this I have done below steps and working fine.

But My other requirement is to update the field using bapi_contarct_change depending on some logic.

And then my code is not working.

 

FOR MORE DETAILS  GET BACK TO ME.

 

 

Code for updating the zfield is below,

 

REPORT  ZTEST_PO_ITEM_CHANGE.


data:   lt_item              typetableof bapimepoitem,
str_item             
type bapimepoitem,
lt_itemx             
typetableof bapimepoitemx,
str_itemx           
type bapimepoitemx,
lt_extensionin       
typetableof bapiparex WITHHEADERLINE,
str_extensionin     
type bapiparex,
lt_extensionout     
typeTABLEOF BAPIPAREX,
str_bapi_te_mepoitem 
type bapi_te_mepoitem,
str_bapi_te_mepoitemx
type bapi_te_mepoitemx,
return_t
type  BAPIRET2_T,
ebelp
type ebelp,
ebeln
type ebeln.


ebelp =
'00020'.
ebeln =
'4600000004'.


clear: lt_item[], lt_itemx[], lt_extensionin[].


str_item-po_item = str_itemx-po_item = ebelp.
append str_item to lt_item.
append str_itemx to lt_itemx.

*------------------------*
*-New Z-fields in EKPO  -*
*------------------------*

CALLFUNCTION'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input  = ebelp
IMPORTING
OUTPUT = ebelp.

str_bapi_te_mepoitem-po_item     = ebelp.
str_bapi_te_mepoitem-zzlc_no  =
'123456789123'.


str_bapi_te_mepoitemx-po_item    = ebelp.
str_bapi_te_mepoitemx-zzlc_no    =
'X'.



move'BAPI_TE_MEPOITEM'to str_extensionin-structure"str_extensionin-structure        = 'BAPI_TE_MEPOITEM'.
move str_bapi_te_mepoitem to str_extensionin-valuepart1. "str_extensionin-valuepart1(114)  = str_bapi_te_mepoitem.
append str_extensionin to lt_extensionin.

CLEAR:str_extensionin.

move'BAPI_TE_MEPOITEMX'to str_extensionin-structure.      "str_extensionin-structure        = 'BAPI_TE_MEPOITEMX'.
move str_bapi_te_mepoitemx to str_extensionin-valuepart1.  "str_extensionin-valuepart1(12)   = str_bapi_te_mepoitemx.
append str_extensionin to lt_extensionin.

clear return_t[].
CALLFUNCTION'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input  = ebeln
IMPORTING
OUTPUT = ebeln.

*  call function 'BAPI_PO_CHANGE'
*    exporting
*      purchaseorder = ebeln
*    tables
*      return        = return_t
**     poitem        = lt_item
**     poitemx       = lt_itemx
*      extensionin   = lt_extensionin.

CALLFUNCTION'BAPI_CONTRACT_CHANGE'
EXPORTING
purchasingdocument          = ebeln
*     HEADER                      =
*     HEADERX                     =
*     VENDOR_ADDRESS              =
*     TESTRUN                     =
*     TECHNICAL_DATA              =
*   IMPORTING
*     EXP_HEADER                  =
TABLES
*     ITEM                        = lt_item
*     ITEMX                       = lt_itemx
*     ACCOUNT                     =
*     ACCOUNTPROFITSEGMENT        =
*     ACCOUNTX                    =
*     DELIVERY_ADDRESS            =
*     ITEM_COND_VALIDITY          =
*     ITEM_COND_VALIDITYX         =
*     ITEM_CONDITION              =
*     ITEM_CONDITIONX             =
*     ITEM_COND_SCALE_VALUE       =
*     ITEM_COND_SCALE_QUAN        =
*     ITEM_TEXT                   =
*     HEADER_TEXT                 =
*     HEAD_COND_VALIDITY          =
*     HEAD_COND_VALIDITYX         =
*     HEAD_CONDITION              =
*     HEAD_CONDITIONX             =
*     HEAD_COND_SCALE_VAL         =
*     HEAD_COND_SCALE_QUAN        =
*     PARTNER                     =
*     PARTNERX                    =
*     RELEASE_DOCU                =
EXTENSIONIN                 = lt_extensionin
*   EXTENSIONOUT                = lt_extensionout
RETURN                      = return_t
.

data: ls_BAPIRET2 type BAPIRET2.
CALLFUNCTION'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT   = 'X'
IMPORTING
RETURN = ls_BAPIRET2.

 

But the above mentioned code is not working. My zfield is not getting updated.

 

 

Please help it is urgent...........thanks in advance!


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>