Application Development and Automation 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: 
Read only

How to use BAPI extensions?

Former Member
0 Likes
19,734

Hi experts,

I read some threads about BAPI extension in this forum, but it is still not clear for me hoe to use them.

Maybe it would be clearer if someone could explain it to me with my own example:

Lets assume, I am in a SRM system. Here I created a customer field ZZ1 and I did the same in table EKPO in my backend system. Now I would like to transfer the field ZZ1 in to table EKPO. Therefore the BAPI BAPI_PO_CREATE is called from the SRM system.

How should I fill the extension parameter of this BAPI that the field ZZ1 is written into table EKPO?

Thanks in advance.

Regards

Tom

Hi experts,

I read some threads about BAPI extension in this forum, but it is still not clear for me hoe to use them.

Maybe it would be clearer if someone could explain it to me with my own example:

Lets assume, I am in a SRM system. Here I created a customer field ZZ1 and I did the same in table EKPO in my backend system. Now I would like to transfer the field ZZ1 in to table EKPO. Therefore the BAPI BAPI_PO_CREATE is called from the SRM system.

How should I fill the extension parameter of this BAPI that the field ZZ1 is written into table EKPO?

Thanks in advance.

Regards

Tom

8 REPLIES 8
Read only

Former Member
0 Likes
7,239

Hi

You have to develop the enhancement MM06E005 (trx CMOD), because you've to active the structure CI_EKPODB where the new Z-fields have to be inserted.

In your program you have to fill the the extension structure in this way:

DATA: WA_EXT_ITEMS TYPE BAPI_TE_MEPOITEM.

WA_EXT_ITEMS-PO_ITEM = <ITEM POSITION>.

WA_EXT_ITEMS-ZZ1 = .....

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

WA_EXT_ITEMS-ZZN = .....

BAPIPAREX-STRUCTURE = 'BAPI_TE_MEPOITEM'.

BAPIPAREX+30 = WA_EXT_ITEMS.

APPEND BAPIPAREX TO T_EXTENSIONIN.

Max

Read only

0 Likes
7,239

Hi Max,

i saw your answer about the extensions, and i need to use the extensions in BAPI_CUSTOMER_CREATEFROMDATA1, it's possible? the according example below, it's necessary find by enhancement, and in my case, I'm find some enhancement too? And how can I use extensions in the bapi?

thank you very much.

Paulo

Read only

0 Likes
7,239

Hi ,

I am doing Like this:

This is structure:

Passing values in extension table

When I show this in debugging mode on PR EXTENSION routine. It shows like this:

Means values not populating form currency column.

Please give some suggestion.

Jitendra

Read only

0 Likes
7,239

Hi Jitendra,

Declare a structure of type BAPI_TE_REQUISITION_ITEM.

DATA: ls_req_item TYPE BAPI_TE_REQUISITION_ITEM.

ls_req_item-preq_item = '00010'.

ls_req_item-zzedate     = '20140910'.

.

.

.

.

ls_req_item-zzcurrn = 'USD'.

t_extn_data-structure = 'BAPI_TE_REQUISITION_ITEM'.

t_extn_data+30 = ls_req_item.

append t_extn_data.

Read only

0 Likes
7,239

Hi Sharmila,

I did the same.

DATA: T_EXTN_DATA LIKE BAPIPAREX OCCURS 0 WITH HEADER LINE  .

DATA: S_EXT TYPE BAPI_TE_REQUISITION_ITEM .

T_EXTN_DATA-STRUCTURE = 'BAPI_TE_REQUISITION_ITEM' .

S_EXT-PREQ_ITEM = '00010' ..

S_EXT-ZZEDATE = '20140910' .

S_EXT-ZZMOSHP = 'ROAD' .

S_EXT-ZZDESTN = 'MUMBAI' .

S_EXT-ZZINCO1 = 'FOB' .

S_EXT-ZZINCO2 = 'FOB' .

S_EXT-ZZNETPR = '1200.00' .

S_EXT-ZZZTERM = 'C001' .

S_EXT-ZZCURRN ='USD' .

T_EXTN_DATA+30 = S_EXT .

APPEND T_EXTN_DATA .

But at the time of program activation showing error:

"T_EXTN_DATA+30(960)" and "S_EXT" are not mutually convertible in a Unicode program. program.

Jitendra

Read only

0 Likes
7,239

Hi Jitendra,

It's because the ZZNETPR component of your WA_BAPI_TE_ITEM structure is defined as

Packed [ P(8) Decimals 2 ]

Unicode can't handle it. Ideally it should be changed to Character type (c) with a length of 16 or 17 to account for the fact that the packed datatype holds two digits per byte. If you can't change the datatype (e.g. because it's also defined as P in CI_EBANDB, and changing it would have an adverse effect elsewhere), then that's where the BAPI's  EXTENSIONIN and EXTENSIONOUT parameters are used.

Mapping of the values from non-Unicode compatible (packed) to Unicode compatible (char) should be performed within the enhancement I believe.

See SAP Note 509898 for generic guideleines.

Read only

Former Member
0 Likes
7,239

Hi

There is a table parameter in BAPI_PO_CREATE (and BAPI_PO_CREATE1)with name Extensionin. This is used to pass the custom field information during PO creation.

You have to do the following things :

1) extend the structure CI_EKPODB with your custom fields. This is available in struture BAPI_TE_MEPOITEM.

2) next is to populate the extensionin table like illustrated below:

extensionin-structure = BAPI_TE_MEPOITEM

extensionin-valuepart1[OF]= value of ZZ1

OF = offset as per the location of field in structure

e.g. ls_extensionin-valuepart1+132(3) = ZZ1

And then pass this as table parameter in BAPI_PO_CREATE

Regards

Alok Pathak

Read only

Former Member
0 Likes
7,239

Dear Thomas,

Go Through the below Link.

http://scn.sap.com/thread/172752

Thanks & Regards

Dinu