07-03-2008 4:29 AM
Hi Experts,
I need to create an Custom field in EKKO table through Include Structure.
Now I have to update that custom field in my program.
I have gone through the following but could not solve my question.
I don't need to update when I hit the save button or any thing
I have the PO's which needs to be updated with that field...
Any suggestions would be greatly helpful.
Thanks,
Chaithanya...
<removed_by_moderator>
Edited by: Julius Bussche on Jul 7, 2008 10:47 PM
07-03-2008 5:09 AM
Hi there..
in the BAPI if you check the tables tab you have
EXTENSIONIN LIKE BAPIPAREX Customer's Own Fields (Import Parameters)
EXTENSIONOUT LIKE BAPIPAREX Customer's Own Fields (Export Parameters)
parameter names.. using that you can solve ur issue.
07-03-2008 4:59 AM
Hi,
You can use the BAPI BAPI_PO_CHANGE and fill the Extension strucutre of this BAPI.
Here in how you have to use it . Say fro examople you have a field ZZBUY
declare lt_bapipoitem like bapi_te_mepoitem
lt_bapipoitemx LIKE bapi_te_mepoitemx
lt_bapipoitem-ZZBUY = '23232323'.
lt_bapipoitemx-zzbuy = 'X'.
lt_bapiparex-structure = 'BAPI_TE_MEPOITEM'.
lt_bapiparex-valuepart1 = lt_bapipoitem.
lt_bapiparex-structure = 'BAPI_TE_MEPOITEMX'.
lt_bapiparex-valuepart1 = lt_bapipoitemx.
APPEND lt_bapiparex.
Pass extensionin = lt_bapiparex
Edited by: Siva Prakash on Jul 3, 2008 4:02 AM
07-03-2008 5:09 AM
Hi there..
in the BAPI if you check the tables tab you have
EXTENSIONIN LIKE BAPIPAREX Customer's Own Fields (Import Parameters)
EXTENSIONOUT LIKE BAPIPAREX Customer's Own Fields (Export Parameters)
parameter names.. using that you can solve ur issue.
07-03-2008 1:33 PM
Prakash,
I could not clearly understand. Where should the field ZZBUY declared?? In EKKO or in some structure....
Can you please explain ....
Thanks for your reply...
Hi Jay,
I have the parameters
EXTENSIONIN LIKE BAPIPAREX Customer's Own Fields (Import Parameters)
EXTENSIONOUT LIKE BAPIPAREX Customer's Own Fields (Export Parameters)
in BAPI_PO_CHANGE.
So Can I declare the include structure in EKKO table??
OR
where should I declare my custom fields...??
Thanks,
Chaithanya K
07-07-2008 8:04 PM
Hi Experts,
I have added a new field to EKKO table(I need to update Header level data).
Now I need to update that field.(Say ZZBUY)
How can I do that??
I was trying to figure out whether BAPI_PO_CHANGE could help me out??
Thanks,
Chaitanya
07-07-2008 9:22 PM
Hi,
You need to add new field in EKKO table. Since you want to update it thru Bapi, You need to create that field in BAPIEKKO structure.
This new field is not available in other bapi structures to update. So you have to use the following tables.
*" EXTENSIONIN STRUCTURE BAPIPAREX OPTIONAL
*" EXTENSIONOUT STRUCTURE BAPIPAREX OPTIONAL
If EXTENSIONIN is your internal table,then populate it as below.Check the bapiekko structure and count where your field starts.All fields in EKKO will be in BAPIEKKO. so add all the field lengths and if the length of all fields is 221. Suppose if your field lenth is 7 chars. then the Extn structure should be populated in this way
EXTENSIONIN-STRUCTURE = 'BAPIEKKO'.
EXTENSIONIN-VALUEPART1+221(7) = 'test'.
append EXTENSIONIN.
clear EXTENSIONIN.
Populate all the required fields of BAPI and call it.
If the length exceeds 240, calculate the offset consider EXTENSIONIN-VALUEPART2...
Thanks,
Vamshi.
07-07-2008 9:39 PM
Hi Vamshi,
Thanks for your reply.
I have already created the field ZZBUY in EKKO Table.
So should I also create the same field in BAPIEKKO structure?????
I don't find BAPIEKKO structure in BAPI_PO_CHANGE
Waiting for your reply....
Thanks,
Chaitanya K
07-07-2008 10:24 PM
Hi,
Yes, you have to go to se11 and create the field in BAPIEKKO structure. All Custom fields of standard database tables should be created in these structures. like if you have custom fields in EKPO, you need to create them in BAPIEKPO and populate them in extninn and out structures.
Thats how you populate custom fields using BAPI's.
You will not find it in BAPI_PO_CHANGE. BAPIEKKO is a structure similar to EKKO and this is a process to update or create entries for custom fields in standard tables.
Thanks,
Vamshi.
07-08-2008 3:43 PM
Hi Vamshi,
Thanks for your reply.
As you mentioned I have created a field in EKKO (ZZBUY using a structure ZZXML_BUY) and I have also created the same field in BAPIEKKO structure.
I have added all the lengths in BAPIEKKO and the value comes to 463 including the ZZBUY field.
it_extensionin-structure = 'BAPIEKKO'.
it_extensionin-valuepart2223(1) = 'X'. " I have also tried it_extensionin-valuepart2222(1) = 'X'.
APPEND it_extensionin.
Clear it_extensionin.
No I have called the BAPI_PO_CHANGE
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
PURCHASEORDER = wa_data-ebeln
POHEADER = it_bapi_poheader
* POHEADERX =
* POADDRVENDOR =
* TESTRUN =
* MEMORY_UNCOMPLETE =
* MEMORY_COMPLETE =
* POEXPIMPHEADER =
* POEXPIMPHEADERX =
* VERSIONS =
* NO_MESSAGING =
* NO_MESSAGE_REQ =
* NO_AUTHORITY =
* NO_PRICE_FROM_PO =
* IMPORTING
* EXPHEADER =
* EXPPOEXPIMPHEADER =
TABLES
* RETURN =
* POITEM =
* POITEMX =
* POADDRDELIVERY =
* POSCHEDULE =
* POSCHEDULEX =
* POACCOUNT =
* POACCOUNTPROFITSEGMENT =
* POACCOUNTX =
* POCONDHEADER =
* POCONDHEADERX =
* POCOND =
* POCONDX =
* POLIMITS =
* POCONTRACTLIMITS =
* POSERVICES =
* POSRVACCESSVALUES =
* POSERVICESTEXT =
EXTENSIONIN = it_extensionin
* EXTENSIONOUT =
* POEXPIMPITEM =
* POEXPIMPITEMX =
* POTEXTHEADER =
* POTEXTITEM =
* ALLVERSIONS =
* POPARTNER =
* POCOMPONENTS =
* POCOMPONENTSX =
* POSHIPPING =
* POSHIPPINGX =
* POSHIPPINGEXP =
* POHISTORY =
* POHISTORY_TOTALS =
* POCONFIRMATION =
.
if sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
* IMPORTING
* RETURN = .
endif.
But it is not updating the ZZBUY field in EKKO Table.
Can you pls help me out where I am doing wrong..
Thanks,
Chaitanya K
07-08-2008 3:48 PM
friend,
i dont think it can update from BAPI cause it is custom field.
you have to use BADI instead of BAPI.
use ME_PROCESS_PO_CUST badi.
Amit.
07-08-2008 4:40 PM
Hi Amit,
How can you update through BADI. can you please explain me the process..In SE19 should I use
for creating the method New BADI or Classic BADI..
When I run the BAPI_PO_CHANGE
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
PURCHASEORDER = wa_xml-ebeln
POHEADER = wa_bapi_poheader
POHEADERX = wa_bapi_poheaderx
* POADDRVENDOR =
* TESTRUN =
* MEMORY_UNCOMPLETE =
* MEMORY_COMPLETE =
* POEXPIMPHEADER =
* POEXPIMPHEADERX =
* VERSIONS =
* NO_MESSAGING =
* NO_MESSAGE_REQ =
* NO_AUTHORITY =
* NO_PRICE_FROM_PO =
* IMPORTING
* EXPHEADER =
* EXPPOEXPIMPHEADER =
TABLES
RETURN = it_bapireturn
* POITEM =
* POITEMX =
* POADDRDELIVERY =
* POSCHEDULE =
* POSCHEDULEX =
* POACCOUNT =
* POACCOUNTPROFITSEGMENT =
* POACCOUNTX =
* POCONDHEADER =
* POCONDHEADERX =
* POCOND =
* POCONDX =
* POLIMITS =
* POCONTRACTLIMITS =
* POSERVICES =
* POSRVACCESSVALUES =
* POSERVICESTEXT =
EXTENSIONIN = it_extensionin
* EXTENSIONOUT =
.
if sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
* IMPORTING
* RETURN = it_bapireturn
.
endif.
in the BAPIRETURN I have the following messages
1. W Please also populate interface parameter POHEADERX
2. S No data changed
Can any one help me out...
Thanks,
Chaitanya K
Edited by: chaithanya k on Jul 8, 2008 11:41 AM
07-08-2008 5:16 PM
Hi,
You do not need to use a BADI. The structures you need to append are BAPI_TE_MEPOHEADER and BAPI_TE_MEPOHEADERX. Populate in a similar way to Siva's post.
Regards,
Patrick.
07-08-2008 6:31 PM
Hi,
But I need to update at the header level....
Not at the item level...
Is there a way to do it..
Regards,
Chaitanya.
07-08-2008 7:08 PM
Hello,
You have to do the save logic what siva had told you in your earier thread and pass the item number "0000".
Thanks,
Greetson
07-09-2008 9:13 AM
Hi Chaithanya,
You will be updating at header level; look at the structure.
Regards,
Patrick.
07-09-2008 3:36 PM
Hi Patrick,
Sorry Patrick you are right.. The structure is at header level.
I have made the changes still I could not achieve it.
I have made the following
In EKKO table I have append the structure with a custom field ZZBUY.
Now I have also appended BAPI_TE_MEPOHEADER and BAPI_TE_MEPOHEADERX with the custom field
ZZBUY.
Here is my program
Data: wa_bapi_poheader type BAPIMEPOHEADER,
wa_bapi_poheaderx type BAPIMEPOHEADERX.
Data: it1_bapi_poheader like BAPI_TE_MEPOHEADER,
it1_bapi_poheaderx like BAPI_TE_MEPOHEADERX.
CALL FUNCTION 'BAPI_PO_GETDETAIL1'
EXPORTING
PURCHASEORDER = wa_DATA-ebeln
* ACCOUNT_ASSIGNMENT = ' '
* ITEM_TEXT = ' '
* HEADER_TEXT = ' '
* DELIVERY_ADDRESS = ' '
* VERSION = ' '
* SERVICES = ' '
IMPORTING
POHEADER = wa_bapi_poheader
* POEXPIMPHEADER =
TABLES
RETURN = it_bapireturn
.
it1_bapi_poheader-ZZBUY = 'X'.
it1_bapi_poheaderx-ZZBUY = 'X'.
it_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
it_extensionin-valuepart1 = it1_bapi_poheader.
append it_extensionin.
Clear it_extensionin.
it_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.
it_extensionin-valuepart1 = it1_bapi_poheaderx.
append it_extensionin.
Clear it_extensionin.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
PURCHASEORDER = wa_data-ebeln
POHEADER = wa_bapi_poheader
POHEADERX = wa_bapi_poheaderx
* POADDRVENDOR =
* TESTRUN =
* MEMORY_UNCOMPLETE =
* MEMORY_COMPLETE =
* POEXPIMPHEADER =
* POEXPIMPHEADERX =
* VERSIONS =
* NO_MESSAGING =
* NO_MESSAGE_REQ =
* NO_AUTHORITY =
* NO_PRICE_FROM_PO =
* IMPORTING
* EXPHEADER =
* EXPPOEXPIMPHEADER =
TABLES
RETURN = it_bapireturn
* POITEM =
* POITEMX =
* POADDRDELIVERY =
* POSCHEDULE =
* POSCHEDULEX =
* POACCOUNT =
* POACCOUNTPROFITSEGMENT =
* POACCOUNTX =
* POCONDHEADER =
* POCONDHEADERX =
* POCOND =
* POCONDX =
* POLIMITS =
* POCONTRACTLIMITS =
* POSERVICES =
* POSRVACCESSVALUES =
* POSERVICESTEXT =
EXTENSIONIN = it_extensionin
* EXTENSIONOUT =
* POEXPIMPITEM =
* POEXPIMPITEMX =
* POTEXTHEADER =
* POTEXTITEM =
* ALLVERSIONS =
* POPARTNER =
* POCOMPONENTS =
* POCOMPONENTSX =
* POSHIPPING =
* POSHIPPINGX =
* POSHIPPINGEXP =
* POHISTORY =
* POHISTORY_TOTALS =
* POCONFIRMATION =
.
It gives me messages saying that
Please also populate interface parameter POHEADERX
No data changed
Where am I going wrong..
Waiting for your replies....
Thanks,
Chaitanya
07-09-2008 3:43 PM
Hi Chaithanya,
The only structures you need to append are BAPI_TE_MEPOHEADER and BAPI_TE_MEPOHEADERX with your ZZBUY field.
You do not need to use the POHEADER and POHEADERX structures but you need to fill the PO_NUMBER field in the BAPI_TE_MEPOHEADER and BAPI_TE_MEPOHEADERX structures.
Regards,
Patrick.
07-09-2008 4:13 PM
Hi Patrick,
Thanks for your reply,
So I don't need to append structure in EKKO
But in which table the zzbuy field will be updated. (I need it in EKKO because I need to check the field again)
I have commented POHEADER and POHEADERX structures
Now my code looks like this and still it doesn't update
it1_bapi_poheader-PO_NUMBER = wa_data-ebeln.
it1_bapi_poheader-ZZXMLSENT = 'X'.
it1_bapi_poheaderx-PO_NUMBER = 'X'.
it1_bapi_poheaderx-ZZXMLSENT = 'X'.
it_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
it_extensionin-valuepart1 = it1_bapi_poheader.
append it_extensionin.
Clear it_extensionin.
it_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.
it_extensionin-valuepart1 = it1_bapi_poheaderx.
append it_extensionin.
Clear it_extensionin.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
PURCHASEORDER = wa_data-ebeln
* POHEADER = wa_bapi_poheader
* POHEADERX = wa_bapi_poheaderx
* EXPHEADER =
* EXPPOEXPIMPHEADER =
TABLES
RETURN = it_bapireturn
* POITEM =
* POITEMX =
* POADDRDELIVERY =
* POSCHEDULE =
* POSCHEDULEX =
* POACCOUNT =
* POACCOUNTPROFITSEGMENT =
* POACCOUNTX =
* POCONDHEADER =
* POCONDHEADERX =
* POCOND =
* POCONDX =
* POLIMITS =
* POCONTRACTLIMITS =
* POSERVICES =
* POSRVACCESSVALUES =
* POSERVICESTEXT =
EXTENSIONIN = it_extensionin
.
Waiting for your reply,
Thanks,
Chaitanya
07-09-2008 4:21 PM
Hi Chaithanya,
You will need the append in EKKO but not the others you mentioned before.
You are nearly there:
it1_bapi_poheaderx-PO_NUMBER = 'X'.
Should be:
it1_bapi_poheaderx-PO_NUMBER = wa_data-ebeln.
And don't forget this at the end of your processing:
call function 'BAPI_TRANSACTION_COMMIT'.
Regards,
Patrick..
07-09-2008 4:34 PM
Hi Patrick,
As you mentioned I have made the changes. But still doesn't update..
it1_bapi_poheader-PO_NUMBER = wa_data-ebeln.
it1_bapi_poheader-ZZXMLSENT = 'X'.
it1_bapi_poheaderx-PO_NUMBER = wa_data-ebeln.
it1_bapi_poheaderx-ZZXMLSENT = 'X'.
it_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
it_extensionin-valuepart1 = it1_bapi_poheader.
append it_extensionin.
Clear it_extensionin.
it_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.
it_extensionin-valuepart1 = it1_bapi_poheaderx.
append it_extensionin.
Clear it_extensionin.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
PURCHASEORDER = wa_data-ebeln
* POHEADER = wa_bapi_poheader
* POHEADERX = wa_bapi_poheaderx
* POADDRVENDOR =
* TESTRUN =
* MEMORY_UNCOMPLETE =
* MEMORY_COMPLETE =
* POEXPIMPHEADER =
* POEXPIMPHEADERX =
* VERSIONS =
* NO_MESSAGING =
* NO_MESSAGE_REQ =
* NO_AUTHORITY =
* NO_PRICE_FROM_PO =
* IMPORTING
* EXPHEADER =
* EXPPOEXPIMPHEADER =
TABLES
RETURN = it_bapireturn
* POITEM =
* POITEMX =
* POADDRDELIVERY =
* POSCHEDULE =
* POSCHEDULEX =
* POACCOUNT =
* POACCOUNTPROFITSEGMENT =
* POACCOUNTX =
* POCONDHEADER =
* POCONDHEADERX =
* POCOND =
* POCONDX =
* POLIMITS =
* POCONTRACTLIMITS =
* POSERVICES =
* POSRVACCESSVALUES =
* POSERVICESTEXT =
EXTENSIONIN = it_extensionin
.
*************it_bapireturn displays No data changed*****
if sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = ' '
IMPORTING
RETURN = it_bapireturn
.
endif.
Still it doesn't update the EKKO Table
Thanks Patrick for all your help...
Thanks,
Chaitanya
Edited by: chaithanya k on Jul 9, 2008 11:47 AM
07-09-2008 4:50 PM
Hi Chaithanya,
One last thing to try:
Change this:
it_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
it_extensionin-valuepart1 = it1_bapi_poheader.
append it_extensionin.
To this:
data: lv_container type me_max_container,
ls_extensionin type bapiparex.
catch system-exceptions conversion_errors = 1.
clear lv_container.
call method cl_abap_container_utilities=>fill_container_c
exporting
im_value = it1_bapi_poheader
importing
ex_container = lv_container
exceptions
illegal_parameter_type = 1
others = 2.
clear ls_extensionin.
move lv_container to ls_extensionin.
shift ls_extensionin right by 30 places.
ls_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
append ls_extensionin to it_extensionin.
endcatch.
Regards,
Patrick.
07-09-2008 5:05 PM
Hi Patrick,
I have made the changes as per your guidelines. But still no luck...
Data: it1_bapi_poheader like BAPI_TE_MEPOHEADER,
it1_bapi_poheaderx like BAPI_TE_MEPOHEADERX.
it1_bapi_poheader-PO_NUMBER = wa_xml-ebeln.
it1_bapi_poheader-ZZXMLSENT = 'X'.
it1_bapi_poheaderx-PO_NUMBER = wa_xml-ebeln.
it1_bapi_poheaderx-ZZXMLSENT = 'X'.
*it_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
*it_extensionin-valuepart1 = it1_bapi_poheader.
*append it_extensionin.
*Clear it_extensionin.
data: lv_container type me_max_container,
ls_extensionin type bapiparex.
catch system-exceptions conversion_errors = 1.
clear lv_container.
call method cl_abap_container_utilities=>fill_container_c
exporting
im_value = it1_bapi_poheader
importing
ex_container = lv_container
exceptions
illegal_parameter_type = 1
others = 2.
clear ls_extensionin.
move lv_container to ls_extensionin.
shift ls_extensionin right by 30 places.
ls_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
append ls_extensionin to it_extensionin.
endcatch.
it_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.
it_extensionin-valuepart1 = it1_bapi_poheaderx.
append it_extensionin.
Clear it_extensionin.
Few thoughts....
In EKKO does it matter where I append the structure
I hve appended in EKKO and there is also an include in EKKO which is EKKODATA
I went to the debug mode of BAPI_PO_CHANGE
GET BADI l_badi.
CALL BADI l_badi->extensionin
EXPORTING
extensionin = l_parex
CHANGING
poheader = exs_poheader
poheaderx = exs_poheaderx.
l_parex consists of the it_extensionin what we pass but exs_poheader and exs_poheaderx doesn't consist
ZZBUY field..
Is that some thing we should look at...
Thanks,
Chaitanya K
07-09-2008 5:14 PM
Hi Chaithanya,
You should append in structure CI_EKKODB.
The only thing I can suggest is debugging to find out why it is not populating your field.
You don't mention which release you are on, but SAP Note 1033925 may be of interest if you on anything later than ERP 2005.
Regards,
Patrick.
07-09-2008 5:41 PM
Hi Patrick.....
Hurrayyyyyyy..Atlast the value got appended into the table..
I am in ECC 6.0
The reason is I have created a new append Z structure in EKKO. Now I have used CI_EKKODB to create my custom field.
The same structure is also used in BAPI_TE_MEPOHEADER So I did not enhance the structure in BAPI_TE_MEPOHEADER
and I have used CI_EKKODBX in BAPI_TE_MEPOHEADERX created my custom field.
Now it has taken the value and EKKO table got the value...
Thanks to Patrick and others for there support in this issue..
Points have been awarded.....
Thanks,
Chaitanya K
05-21-2009 6:16 PM
Hello Chaitanya,
I have a similar problem.
I activated the user-exit (include zxmewu08) on that I can see the EXTENSIONIN-structure.
The process starts from the IDoc PORDCR1, filling the segment E1BPPAREX that I will see on the EXTENSIONIN.
I need to update a custom field on EKKO table(already appended).
Could you please explain me how you used CI_EKKODBX in BAPI_TE_MEPOHEADERX?
The IDoc went in 53 but no update see on EKKO table.
Thanks in advance for your feedback.
Regards