‎2010 Jan 04 7:16 PM
Hi. I am trying to post to some custom fields in the PO header using this BAPI, and I have read lots of posts on SDN and tried it lots of ways but it never works. Every time I get the message "Error transferring ExtensionIn data for enhancement CI_EKKODB"
The fields I want to post are actually after some decimal fields, so I tried creating a char structure of the same length but that did not work.
I also tried function PI_BP_MOVE_UNICODE which seems to format the extensionin table to match extensionout from BAPI_PO_GETDETAIL but that also ends with the same message.
To try and get it working even basically I tried to post to the first custom field, which is a simple char field length 1, but I get the same error there too.
Does anyone have any idea what I might be doing wrong? My code for the basic test appears very simple:
DATA: te TYPE bapi_te_mepoheader,
tex TYPE bapi_te_mepoheaderx,
ext TYPE TABLE OF bapiparex WITH HEADER LINE.
tex-zzpin_notice = 'X'.
ext-structure = 'BAPI_TE_MEPOHEADER'.
ext-valuepart1+10(1) = 'X'.
APPEND ext.
CLEAR ext.
ext-structure = 'BAPI_TE_MEPOHEADERX'.
ext-valuepart1 = tex.
APPEND ext.
CLEAR ext.
Thanks a lot for your help.
Regards,
Dave.
‎2010 Jan 04 7:29 PM
Hi
Your code should be right, try to use MOVE statament in order to transfer the decimals fields.
Max
‎2010 Jan 04 7:29 PM
Hi
Your code should be right, try to use MOVE statament in order to transfer the decimals fields.
Max
‎2010 Jan 05 9:18 AM
Hi. Thanks, I tried that, it did not work.
I even tried manually entering data in an old PO, then using BAPI_PO_GETDETAIL to get the extensionout data out of the old PO, then I blanked the PO number and used the same structure on my new PO, but that too did not work.
I also tried using BAPI_PO_CHANGE to change the old PO and passed in the exact structure that BAPI_PO_GETDETAIL gave to me and it gave the message too. I might ask SAP to look at that, something does not seem right.
Do you need to append the custom fields onto structures bapimepoheader and bapimepoheaderx? I have actually tried it with and without this and that too seems to make no difference.
Thanks again for your help.
Regards,
Dave.
‎2010 Jan 05 10:33 AM
This is the abap code of the BAPI where the APPEND STRUCTURE is checked before transfering the extensioni data (routine move_container_in):
<MODIFIED BY MODERATOR - RESPECT THE 2,500 CHARS LIMIT>
Max
Edited by: Alvaro Tejada Galindo on Jan 5, 2010 10:12 AM
‎2010 Jan 05 10:34 AM
Hi
This is the abap code of the BAPI where the APPEND STRUCTURE is checked before transfering the extensioni data (routine move_container_in):
* check if the included fields are character like data types
LOOP AT gr_abap->components ASSIGNING <comp>.
CHECK <comp>-type_kind EQ gr_abap->typekind_packed or
<comp>-type_kind EQ gr_abap->TYPEKIND_FLOAT or "1033925
<comp>-type_kind EQ gr_abap->TYPEKIND_INT or "1033925
<comp>-type_kind EQ gr_abap->TYPEKIND_INT1 or "1033925
<comp>-type_kind EQ gr_abap->TYPEKIND_INT2. "1033925
CHECK lf_exit EQ cl_mmpur_constants=>no. "1148689
* message could be customized ME887
MESSAGE w887(me) WITH im_name INTO gl_dummy.
mmpur_message_enaco_forced sy-msgty sy-msgid sy-msgno sy-msgv1
sy-msgv2 sy-msgv3 sy-msgv4.
lf_exit = cl_mmpur_constants=>yes.
ENDLOOP.It seems numeric custom fields are not good, but it can try to use the badi me_bapi_po_cust in order to transfer the value in correct way to BAPI_TE_MEPOHEADER, infact the rest the code is:
........................................
* call customer BAdI for inbound mapping of extensionin
TRY.
CALL BADI lr_badi->map2i_extensionin
EXPORTING
im_container = im_container
im_name = im_name
im_error = lf_exit
CHANGING
ch_struc = ch_struc.
CATCH cx_mmpur_root.
EXIT.
ENDTRY.
CHECK lf_exit EQ cl_mmpur_constants=>no.
TRY.
ASSIGN ch_struc TO <fs>.
* convert container data to target structure
im_nls->cont_to_struc( EXPORTING cont = im_container
langu = sy-langu
IMPORTING struc = <fs> ).
CATCH: cx_root.
ENDTRY.
ENDFORMMax
‎2010 Jan 05 3:11 PM
Hi. Thanks a lot, we are getting there now.
If there are any number fields at all even if they are not used that bit of code you showed creates the warning and stops the extensionin from working.
I changed the number fields to text in a test system and adjusted the database and the BAPI worked fine.
Do you have any idea how the BADI can be used to write with number fields though? I tried it and all I can do is set EXTENSIONIN to match what I was sending originally, and the same bit of code issues the same warning.
Thanks very much for your help.
Regards,
Dave.
‎2010 Jan 05 3:19 PM
Hi again. Is me_bapi_po_cust the right BADI? That BADI allows you to change the structure of the entire BAPI, but the code example you showed had a completely different call structure to me_bapi_po_cust and looked more like it was for altering the fields passed to extensionin?
Thanks again,
Dave.
‎2010 Jan 05 3:48 PM
Hi. I had a look round and I think that method map2i_extensionin of BADI me_bapi_po_cust is only available in ECC 6. We are using ECC 5.
Does anyone have any ideas if it is possible to process custom fields in BAPI_PO_CREATE1 with numeric values on ECC 5?
Thanks a lot,
Dave.
‎2010 Jan 05 4:32 PM
Hi
Yes my release os ECC 6.00
I don't think without to chage the BAPI of course.
U can try to set the values to memory (by IMPORT/EXPORT command ) before calling the BAPI and get them from memory by some user-exit of PO
Max
‎2010 Jan 05 5:03 PM
Hi. Thanks for that, I actually need to change the custom fields when the BAPI is called from SRM, so I do not think the export / import will work.
I have got a work round though, I can change the number fields to text in the database. They are only used in 1 screen and 1 report, so we can just change both places to read in the text then display as a number.
I'll leave this open a couple of days in case anyone has any ideas then close it.
Thanks again for your help.
Dave.
‎2010 Jan 05 9:28 AM
Hi,
In the worst case, once PO is generated, create a BDC for the same PO.
Hope this will work.
‎2010 Jan 05 10:15 AM
Hi. Thanks, I thought of that too, but would be nice to get the BAPI working.
Regards,
Dave.
‎2010 Jan 05 4:47 PM
Steps to update extension :
1. Append custom fields in structure of EKKO in CI_EKKODB or EKPO in CI_EKPODB.
2. Append fields in strucutres BAPI_TE_MEPOHEADER (CI_EKKODB)/ BAPI_TE_MEPOHEADERX(CI_EKKODBX) with same fields as in EKKO or EKPO. The fields in BAPI_TE_MEPOHEADER should have declaration as required but in BAPI_TE_MEPOHEADERX should have declaration of same field with type CHAR1.
3. In code :
(a) declaration lw_extn TYPE BAPIPAREX,
lw_header_x TYPE BAPI_TE_MEPOHEADERX,
lw_header TYPE BAPI_TE_MEPOHEADER.
(b) lw_header-PO_NUMBER = 'XXX' - PO number
lw_header_x-PO_NUMBER = 'XXX' - PO number
As already BAPI_TE_MEPOHEADER/ BAPI_TE_MEPOHEADERX are append with custom fields that can be of any type does not matter.
Eg. for population
lw_header-CUSTFIELD = '10.00'.
lw_header_x-CUSTFIELD = 'X'.
lw_extn-structure = 'BAPI_TE_MEPOHEADER'.
lw_extn+30 = lw_header.
APPEND lw_extn TO ct_extn.
lw_extn-structure = 'BAPI_TE_MEPOHEADERX'.
lw_extn+30 = lw_header_x.
APPEND lw_extn TO ct_extn (type standard table of BAPIPAREX).
In function module documentation you can also find help.
‎2010 Jan 05 5:09 PM
The problem here is not how to transfer custom fields via BAPI, but how to transfer numeric custom fields via BAPI.
The problem is EXTENSIONIN parameter is structured like BAPIPAREX, this is a dictionary structure with character fields only, so a dump can occurs if it tried to transfer the value from a strcture like BAPIPAREX ti a structure like BAPI_TE_MEPOHEADER based on CI_EKKODB having character and numeric fields.
Since the note 828557 was implemented, this note doesn't allow to transfer a value by entensionin if structure BAPI_TE_MEPOHEADER has some numeric fields.
All I can say is it should be better to use character fields only in CI_EKKODB, in OSS note I've seen there are several BAPIs having a similar problem and sometimes SAP has released a particular note in order to manage numeric fields.
If in ECC 5 implicit enhancement is possible u can considere to enhance the BAPI in order to solve the problem
Max
‎2010 Jan 13 9:47 AM
The problem here was that there were numeric custom fields on table EKKO. Before ECC 6 there is no way to use the BAPIs to post to custom fields if any of them are numeric, even if you are trying to post to a different text field. On ECC 6 it is possible using the BADI mentioned in this post. As a work round on ECC 5 I'm going to have to change the number fields to text, luckily they are only for information purposes so it will not affect us too badly.