on 07-05-2010 6:07 PM
Hi all,
I have a requirement to update the custom fields in EKPO using BAPI_PO_CHANGE.
How to use the Extensionin Parameter and what are the structures i need to use.
Provide me sample code to populate EKPO fields.
Thanks,
Suresh
Sample code to populate EKPO fields:
method bapi_update_po_item.
data: lt_item type table of bapimepoitem,
str_item type bapimepoitem,
lt_itemx type table of bapimepoitemx,
str_itemx type bapimepoitemx,
lt_extensionin type table of bapiparex,
str_extensionin type bapiparex,
str_bapi_te_mepoitem type bapi_te_mepoitem,
str_bapi_te_mepoitemx type bapi_te_mepoitemx.
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 -*
*------------------------*
str_bapi_te_mepoitemx-po_item = ebelp.
str_bapi_te_mepoitemx-zi_expdate = 'X'.
str_bapi_te_mepoitem-po_item = ebelp.
str_bapi_te_mepoitem-zi_expdate = sy-datum.
str_extensionin-structure = 'BAPI_TE_MEPOITEM'.
str_extensionin-valuepart1(114) = str_bapi_te_mepoitem(114).
append str_extensionin to lt_extensionin.
str_extensionin-structure = 'BAPI_TE_MEPOITEMX'.
str_extensionin-valuepart1(12) = str_bapi_te_mepoitemx(12).
append str_extensionin to lt_extensionin.
clear return_t[].
call function 'BAPI_PO_CHANGE'
exporting
purchaseorder = ebeln
tables
return = return_t
* poitem = lt_item
* poitemx = lt_itemx
extensionin = lt_extensionin.
commit work and wait.
endmethod.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Erik thanx for this code almost i did for 5 fields but next 6th field i was unable to update.
plesae see below code and send me sample code for all the fields,
thanks alot.
Thanks for your reply. the below is the code i have used to change Customfields
ZZKUNNR(10),
ZZORDTYP(4),
ZZDATE(8),
ZZSTOKBASE(8),
ZZVERSION(4),
ZZSTOCDESC(60).
but its giving error when i try to change ZZSTOCDESC(60). field under VALUE PART1,
its saying LEngth exceeds.
please provide me sample code to add all these fields
method bapi_update_po_item.
data: lt_item type table of bapimepoitem,
str_item type bapimepoitem,
lt_itemx type table of bapimepoitemx,
str_itemx type bapimepoitemx,
lt_extensionin type table of bapiparex,
str_extensionin type bapiparex,
str_bapi_te_mepoitem type bapi_te_mepoitem,
str_bapi_te_mepoitemx type bapi_te_mepoitemx.
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 -
-
str_bapi_te_mepoitemx-po_item = ebelp.
str_bapi_te_mepoitemx-zzkunnr = 'X'.
str_bapi_te_mepoitem-po_item = ebelp.
str_bapi_te_mepoitem-zzkunnr = sy-datum.
str_extensionin-structure = 'BAPI_TE_MEPOITEM'.
str_extensionin-valuepart1(240) = str_bapi_te_mepoitem(240).
append str_extensionin to lt_extensionin.
str_extensionin-structure = 'BAPI_TE_MEPOITEMX'.
str_extensionin-valuepart1(10) = str_bapi_te_mepoitemx(10).
append str_extensionin to lt_extensionin.
-
Field 2----
str_bapi_te_mepoitemx-po_item = ebelp.
str_bapi_te_mepoitemx-zzordtyp = 'X'.
str_bapi_te_mepoitem-po_item = ebelp.
str_bapi_te_mepoitem-zzordtyp = sy-datum.
str_extensionin-structure = 'BAPI_TE_MEPOITEM'.
str_extensionin-valuepart1(240) = str_bapi_te_mepoitem(240).
append str_extensionin to lt_extensionin.
str_extensionin-structure = 'BAPI_TE_MEPOITEMX'.
str_extensionin-valuepart1(4) = str_bapi_te_mepoitemx(4).
append str_extensionin to lt_extensionin.
-
field3---
;;;
;;
;
;
;so on
clear return_t[].
call function 'BAPI_PO_CHANGE'
exporting
purchaseorder = ebeln
tables
return = return_t
poitem = lt_item
poitemx = lt_itemx
extensionin = lt_extensionin.
commit work and wait.
endmethod.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.