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: 

Uploading ZFields with BAPI 'BAPI_PO_CREATE1' using ExtensionIN gives error

Hi friends,

i m using 'BAPI_PO_CREATE1' for uploading my data, it was running fine, but now have to add option to upload some customer fields through this , which i m unable to do.

I read alot , and found ExtensionIN table of BAPI, which can be used to upload the customer fields , but even after using it, gets following error message : -

"Error transferring ExtensionIn data for enhancement CI_EKKODB"

for the reference, here are the structures

-


'BAPI_TE_MEPOHEADER'

-


PO_NUMBER	EBELN		CHAR	10	0	Purchasing Document Number
.INCLUDE	CI_EKKODB		0	0	Extra fields in PO Header
ZZTOTPOVAL	ZBWERT		DEC	13	2	ZBWERT for value (Z field in PO)
ZZBID_VAL	ZZBIDVAL	NUMC	3	0	Bid Validity Perid (in days)
ZZPLANT		WERKS_D		CHAR	4	0	Plant

....

.....

-


'BAPI_TE_MEPOHEADERX'

-


PO_NUMBER	EBELN		CHAR	10	0	Purchasing Document Number
.INCLUDE	CI_EKKODBX		0	0	Extra fields in PO Header (Change Parameter)
ZZTOTPOVAL	BAPIUPDATE	CHAR	1	0	Updated information in related user data field
ZZBID_VAL	BAPIUPDATE	CHAR	1	0	Updated information in related user data field
ZZPLANT		BAPIUPDATE	CHAR	1	0	Updated information in related user data field

-


PROGRAM SRC CODE

-


DATA : ls_headerextn      like bapi_te_mepoheader,
       ls_headerextnx     like bapi_te_mepoheaderx,
       gs_extensionin     TYPE bapiparex,
       lit_extensionin    TYPE TABLE OF bapiparex,
       gs_extensioninx    TYPE bapiparex,
       lit_extensioninx   TYPE TABLE OF bapiparex.
.....
....
"Data is uploaded into ls_purchase structure
.....
.....

"ASSIGN DATA TO Extensionin table
      gs_extensionin-structure             = 'BAPI_TE_MEPOHEADER'.
      gs_extensionin-valuepart1           = ls_purchase-po_number.  
      gs_extensionin-valuepart1+28(4)  = ls_purchase-zzplant.   
      APPEND gs_extensionin TO lit_extensionin.

      gs_extensionin-structure             = 'BAPI_TE_MEPOHEADERX'.
      gs_extensionin-valuepart1           = ls_purchase-po_number.
      gs_extensionin-valuepart1+12(1)  = 'X'.
      APPEND gs_extensionin TO lit_extensionin.

...............
...............

"Call to bapi
CALL FUNCTION 'BAPI_PO_CREATE1'
        EXPORTING
          poheader          = po_header
          poheaderx        = po_headerx
        IMPORTING
          exppurchaseorder = po_number1
        TABLES
          return             = it_return_t
          poitem            = po_item[]
          poitemx          = po_itemx[]
          extensionin      = lit_extensionin
          poschedule       = po_schedule[]
          poschedulex      = po_schedulex[]
          poaccount        = po_account[]
          poaccountx       = po_accountx[]
          pocond           = po_conditions[]
          pocondx          = po_conditionsx[].
...............

But when i execute this code i get following error message :-

"Error transferring ExtensionIn data for enhancement CI_EKKODB"

and PO is created without passing the value to database.

Where i m wrong ,plz help.

Ekam Preet Singh

7 REPLIES 7

Former Member
0 Kudos

Please check this Declaration .

*&&-- PO Custom Fields

rec_extensionin-structure = 'BAPI_TE_MEPOITEM'.

rec_extensionin-valuepart1+0(5) = v_item.

rec_extensionin-valuepart15(235) = rec_podata-value_00120(235).

rec_extensionin-valuepart20(20) = rec_podata-value_0012235(20).

rec_extensionin-valuepart2+20(50) = rec_podata-value_0026.

rec_extensionin-valuepart2+70(50) = rec_podata-value_0027.

rec_extensionin-valuepart2+120(50) = rec_podata-value_0028.

rec_extensionin-valuepart2+170(50) = rec_podata-value_0029.

rec_extensionin-valuepart2220(20) = rec_podata-value_00300(20).

rec_extensionin-valuepart30(30) = rec_podata-value_003020(30).

rec_extensionin-valuepart3+30(50) = rec_podata-value_0031.

rec_extensionin-valuepart3+80(50) = rec_podata-value_0032.

APPEND rec_extensionin TO i_extensionin.

rec_extensionin-structure = 'BAPI_TE_MEPOITEMX'.

rec_extensionin-valuepart1+0(5) = v_item.

rec_extensionin-valuepart1+5(8) = 'XXXXXXXX'.

APPEND rec_extensionin TO i_extensionin.

Please try, I think u did wrong in

gs_extensionin-structure = 'BAPI_TE_MEPOHEADER'.

<b> gs_extensionin-valuepart1 = ls_purchase-po_number. </b> gs_extensionin-valuepart1+28(4) = ls_purchase-zzplant.

APPEND gs_extensionin TO lit_extensionin.

0 Kudos

I already tried this, but doesnt worked.

please it is very urgent.

Ekam

Former Member
0 Kudos

In case you have not resolved this, I think the problem is the incorrect offset ( gs_extensionin-valuepart1+28(4) = ls_purchase-zzplant ) due to the field ZZTOTPOVAL. It's output length is 13 but is stored internally as a packed decimal field with length 7. Also unless you are generating your own po#, do not pass anything in this field.

Hope this helps.

Former Member
0 Kudos

You forgot to populate the extensioninX structure as well.

Data: is_extension LIKE bapi_te_mepoheader,

is_extensionx LIKE bapi_te_mepoheaderx.

  • Fill the extension structure with additional fields

is_extension-zzfield1 = it_tab-field1.

is_extension-zzfield2 = it_tab-field2.

is_extension-zzfield3 = it_tab-field3.

pt_extensionin-structure = 'BAPI_TE_MEPOHEADER'.

pt_extensionin-valuepart1 = is_extension.

APPEND pt_extensionin.

is_extensionx-zzfield1 = 'X'.

is_extensionx-zzofield2 = 'X'.

is_extensionx-zzfield3 = 'X'.

pt_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.

pt_extensionin-valuepart1 = is_extensionx.

APPEND pt_extensionin.

Former Member
0 Kudos

Sorry, I should read better...you did populate the X structure. If you extended the fields in CI_EKKODB then they should exist in 'BAPI_TE_MEPOHEADER' and 'BAPI_TE_MEPOHEADERX'. You should be able to refer to them directly. Also, you will not know the PO number during create so do not try to populate.

Former Member
0 Kudos

Hi,

First of all you should append the Zfields in the

structure 'BAPI_TE_MEPOHEADER'.

Now pass the value of the Zfield in the structure 'BAPI_TE_MEPOHEADER'.

Say the Zfield that you appended in the structure is ZZPLANT.

So pass the Plant value to the structure as BAPI_TE_MEPOHEADER-ZZPLANT = 'ABC'.

Now write gs_extensionin-structure = 'BAPI_TE_MEPOHEADER'.

gs_extensionin-valuepart1 = BAPI_TE_MEPOHEADER.

APPEND gs_extensionin TO lit_extensionin

Do the same for lit_extensioninx table.

Try out this.

Rewards point if this resolves ur query

Former Member
0 Kudos

Hi

I remember an OSS note stating that if the EKKO has Zfields which are of type P/Dec it is not possible to update those values. But we can workaround by using the apposite user exits before assigning to CI_EKKODB structure.

Also try using field symbols for assignment instead of offsets

Something like this.

ASSIGN t_po_extension-valuepart1

TO <fs_bapi_value> CASTING TYPE bapi_te_mepoheader.

<fs_bapi_value> = bapi_te_mepoheader.

Please check for that OSS note you will find a better idea.

Cordially,

Shankar Narayanan.