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: 

BAPI PO change - Custom fields modification

itabhishek9
Participant
0 Kudos

Hi SDNites,

I have enhanced EKPO table where the table has quantity custom field as well. So when I am using BAPI_PO_CHANGE, it is not allowing me to do due to the quanity fields in enhanced EKPO table.

In order to achieve the above, I am trying to implement method MAP2I_EXTENSIONIN of BADI ME_BAPI_PO_CUST. Can you please help me how do I convert th quantity field in changing structure CH_STRUC. When I am trying to do the same it is giving a short dump. Can you please advise or provide a sample code.

Regards,

Abhi

5 REPLIES 5

raymond_giuseppi
Active Contributor
0 Kudos

Did you copy from demo class CL_EXM_IM_ME_BAPI_PO_CUST, also did you read the EXTENSIONIN documentation.

If you "played" with numeric data... then look for class on data container like CL_ABAP_CONTAINER_UTILITIES to map data before extensionin and your structure without raising some exception.

Regards,

Raymond

0 Kudos

Thanks Ray for your response.

Yes I have copied from class CL_EXM_IM_ME_BAPI_PO_CUST.

Also when I call BAPI_PO_ChANGE, it will internally call the BADI ME_BAPI_PO_CUST and here within method MAP2I_EXTENSIONIN we get startucture CH_STRUC already populated with EKPO custom fields but without values. Here I have to change the structure itself so that it can hold CHAR values.  Can you please suggest. (I feel CL_ABAP_CONTAINER_UTILITIES can convert the values and not the structure).

Regards,

Abhi

Former Member
0 Kudos

We had a similar requirement to change the value of a Z field added in EKPO table through BAPI_PO_CHANGE.

Here's a code snippet

DATA: ls_extensionin type bapiparex,

            ls_ext_po type bapi_te_mepoitem,

            ls_ext_pox type bapi_te_mepoitemx

IF wa-zzdel is not initial.

ls_extensionin-structure = 'BAPI_TE_MEPOITEM'.

ls_ext_po-po_item = ebelp

ls_ext_po-zzdel = zzdel

ls_extensionin+30(960) = ls_ext_po.

append ls_extensionin to lt_extensionin.

ENDIF.

0 Kudos

Repeat the same 5lines also for 'BAPI_TE_MEPOITEMX'  but pass zzdel flag as 'X' and the next structure would be ls_ext_pox for flags.Rest all remains same.

So you would have 2entries in your lt_extensionin structure.One with values and one with flags.

Pass the table in BAPI.Your Z fields would be updated .

0 Kudos

Thanks Ruchi.

As i mentioned the EKPO custom fields has quantity field due to which I have to convert it to Char before calling BAPI_PO_CHANGE which I have done it.

Within BAPI, the BADI has to be called as enhanced EKPO structure is having quantity field. I am looking after what needs to be written in this BADI to do the necessary structure conversion.

If you have any other approach please let me know.

Regards,

Abhi