01-19-2016 10:24 AM
Hi,
I have one requirement , I have custom tab in Me23n. So, i need to update these fields by using the code.
So, i checked in forum, I never did it before(Updating custom Fields). I got some information that.So, I need to fill the bapi structures
BAPI_TE_MEPOITEM,
BAPI_TE_MEPOITEMX.
Bapi Strucutre BAPI_TE_MEPOITEM Is all ready having Include it is having custom fields.
But BAPI_TE_MEPOITEMX Structure is not available . Exactly like BAPI_TE_MEPOITEM I append the include of BAPI_TE_MEPOITEMX
Now Both Structures are same .
Now i am filling the fields and declaration will be like below.
DATA: WA_EXTENSIONIN TYPE BAPIPAREX,
WA_BAPIPAREX TYPE BAPIPAREX,
WA_BAPI_TE_MEPOITEM TYPE BAPI_TE_MEPOITEM,
WA_BAPI_TE_MEPOITEMX TYPE BAPI_TE_MEPOITEMX.
WA_BAPI_TE_MEPOITEM-PO_ITEM = ''.
WA_BAPI_TE_MEPOITEM-ZZPROJECTNUMBER = ''.
WA_BAPI_TE_MEPOITEM-ZZPROJECTNAME = ''.
WA_BAPI_TE_MEPOITEM-ZZMENGE = ''.
WA_BAPI_TE_MEPOITEM-ZZMEINS = ''.
WA_BAPI_TE_MEPOITEM-ZZMCTXT = ''.
WA_BAPI_TE_MEPOITEM-ZZKOSTL = ''.
WA_BAPI_TE_MEPOITEMX-PO_ITEM = 'X'.
WA_BAPI_TE_MEPOITEMX-ZZPROJECTNUMBER = 'X'.
WA_BAPI_TE_MEPOITEMX-ZZPROJECTNAME = 'X'.
WA_BAPI_TE_MEPOITEMX-ZZMENGE = 'X'.
WA_BAPI_TE_MEPOITEMX-ZZMEINS = 'X'.
WA_BAPI_TE_MEPOITEMX-ZZMCTXT = 'X'.
WA_BAPI_TE_MEPOITEMX-ZZKOSTL = 'X'.
WA_EXTENSIONIN-STRUCTURE = 'BAPI_TE_MEREQITEM'.
WA_EXTENSIONIN+30 = WA_BAPI_TE_MEPOITEM.
APPEND WA_EXTENSIONIN TO IT_EXTENSIONIN.
WA_EXTENSIONIN-STRUCTURE = 'BAPI_TE_MEREQITEMX'.
WA_EXTENSIONIN+30 = WA_BAPI_TE_MEPOITEMX.
APPEND WA_EXTENSIONIN TO IT_EXTENSIONIN.
But i need to move Bapi Po item details to the Bapi_Extension. But i am not able to move the data .Please have a look on below attached image.
Can any body tell me how could i move the data. Need valuable suggestions.
01-19-2016 12:30 PM
In Unicode system, you will be required to use either some ASSIGN CASTING or some provided tool like cl_abap_container_utilities=>fill_container_c to map the data.
CLEAR: ls_bapiparex.
ls_bapiparex-structure = 'BAPI_TE_ZZZZZZ'.
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = ls_bapi_te_zzzzzz
IMPORTING
ex_container = ls_bapiparex+30
EXCEPTIONS
OTHERS = 0.
Regards,
Raymond
01-19-2016 11:19 AM
01-19-2016 11:50 AM
Hi...
Thanks for your reply... I tried your code. What ever structure a is having it is moving to the Structure b.
But i need to pass structure name. But A is not having the structure name then b is not getting the structure name.
I attached the Po Update code . I Can able to change the Po. The attached sample code. Will change the quantity of the Po Correctly.
But i am not able to update the Custom fields of the Po line . Can any body tell me How could i update the Custom Fields after adding the Document.
Need your valuable suggestions.
01-19-2016 12:30 PM
In Unicode system, you will be required to use either some ASSIGN CASTING or some provided tool like cl_abap_container_utilities=>fill_container_c to map the data.
CLEAR: ls_bapiparex.
ls_bapiparex-structure = 'BAPI_TE_ZZZZZZ'.
CALL METHOD cl_abap_container_utilities=>fill_container_c
EXPORTING
im_value = ls_bapi_te_zzzzzz
IMPORTING
ex_container = ls_bapiparex+30
EXCEPTIONS
OTHERS = 0.
Regards,
Raymond
01-20-2016 3:41 AM
Hi, Thanks for your reply.
I can able to move the data to Bapi Extension. But Item level Field i am not able to update it.
1)At run time i had checked it, Data is moved to Bapi Extension.
2)Sy-subrc eq 0 .
3)Manually i tried with the Same value, What i given the custom field value through the source code, It is updating No problem, But Through the Bapi not working.
4)Po Line quantity I am trying to updated, This is also Working, I Can able to Update it. But custom field problem.
Any help appreciated.
01-20-2016 4:41 AM
Need one more clarification also.
WA_EXTENSION+30 = WA_TE_MEQITEM.
I have one sample code. Which is updating the PR line level Custom Fields.
The above line is working fine. PR Line level is also having the 4 Custom Fields.
But while updating the Po Custom Fields it is failing. Please have a look on below attached Images.
01-20-2016 5:01 AM
01-20-2016 5:19 AM
HI, Thanks For your reply. Enhancement At Table level.
Yes. Screen exit. Cmod.
01-20-2016 5:26 AM
I have Two enhancements at Me21n .
one is At header level , and another one is Row level.
At Header Level, I have two fields. (Not mandatory while adding po)
Through the Code i am passing only one. By using the below code, I am able to update it. Working fine.
At Row level i am having I have 6 fields. (No fields are mandatory while adding po)
Through the code i am passing only one. By using the below code. But not working.
sy-subrc eq 0.
You can find the code from the below code. Thanks for your reply.
01-20-2016 12:15 PM
If every customer field is a character type, there won't be any problem, Unicode check are okay, once one charcter of another type is appended to structure problems may (and will) arise.
Regards,
Raymond
01-20-2016 12:31 PM
Hi, Thanks for your reply.Little bit confusion. As per the above. How could i pass the value
'X' to the ZZMENGE field.
01-20-2016 3:30 PM
Dear Chintu adi and Raymond Giuseppi.
I checked in the return code.
Error message is ME 887 . The appended Structure fields should be Char , should not be other.
I need to implement the badi ::ME_BAPI_PO_CUST
Please have a look on below attached image. I implemented other badis. But this time this is different.
1)I open se18 Badi name ME_BAPI_PO_CUST
2)In left side under badi definations ,Double click on ME_Bapi_po_cust. then i right click On it and Create the badi.
3) here Implementation Name and Text i entered then i press the right symbol.
4)Again it is asking the Badi Implementaiton and Description It is asking the implementation class
5)Which class should i give here, Need small suggestion.
01-20-2016 3:48 PM
First new BAd implementation ?
Copy Sample class
...
(I didn't paste the package/transport pop-up)
Regards,
Raymond
01-21-2016 3:07 AM
01-22-2016 6:22 AM
Hi, Thanks for your reply.
According to your suggestions i Was created Badi, Calss name is also same as Ztest1. You can see from the above Screen Shot.
Both are Activated, I checked in Se24 with the Class name that is also Active mode.
But While running the code Updating Custom fields. While calling the Bapi Po_chage. Dump file is Created Automatically.
It is telling that
Implementation class does not exist: Implementation "ZTEST1" in enhanc"
ement "ZTEST1" of the BAdI "ME_BAPI_PO_CUST" points to the nonexistent"
class"ZTEST1""
As per my analysts. While Executing the Bapi_po_Change. the program SAPL2012 and Include L2012F23 Are running.
At particular line error is throwing.
I am trying to put the break point but, I am not able to put the break point. 2 days before i am able to put the break point but now , If i try it is showing the information as The main program SAPL2012 must be generated. Information is coming.
I open the Se80 and I Try to Activate the main program SAPL2012 , It is showing the Syntax Error , You can have a look on below attached images.
May i know should i do any thing. In code Or Some where else. Need your valuable suggestions.
01-22-2016 7:17 AM
Check if class is active and carry interfaces IF_BADI_INTERFACE and IF_EX_ME_BAPI_PO_CREATE_01.
Regards,
Raymond
01-22-2016 8:54 AM
Hi,
Thanks for your reply.Please Have a look on below attached image. Class is Active But If i press Check button.
It is showing some Information message.
And
interfaces IF_BADI_INTERFACE .
interfaces IF_EX_ME_BAPI_PO_CREATE_02 . Both are active.
Any further information ..
01-22-2016 10:28 AM
What did happen when you double-clicked on method IF_EX_ME_BAPI_PO_CREATE_02~TOGGLE_ORDER_UNIT of your implementing class?
01-22-2016 12:07 PM
Hi,
Thanks For your reply.
In Se24 If i double click on the Information message. It is Opening the Public Section Below attached image Proro1 Is opening.
If i click on the IF_BADI_INTERFACE proof2 Image is Coming.
If i clikc on the IF_EX_ME_BAPI_PO_CREATE_02 IS Coming.
01-22-2016 12:17 PM
Go to the "method" tab of your class and double-click on the method mentionned in the warning message
(Create and activate all missing methods, don't input code if not required just method/endmethod statements, seels you broke the flow of object creation, an exit function code during a pop-up for confirmation or package?)
01-22-2016 12:32 PM
If I open the the Class at Se24 and Double Click on the Method. It is Telling that Method is not Implemented. Please have a look on below attached Images. Only I can able to open method MAP2I_Extension.
01-22-2016 1:35 PM
Hi,The above errors are coming Because i had not implemented the methods(While creating the Class i need to double click on all the methods)
Now again i created new class , delete the old one, While creating i just double click on each methods Now If i activate the zclass or Badi,
There is No error or Information message. But if i execute the Bapi_po_Change same type of error is coming.
I have one doubt , If i execute the Zclass. IN Se24 The below error is coming. May be this is the problem.
Error Occured During the Abap generation of the test frame for Ztest1. Has Any body knows What is the problem. Please Inform me if u knows.
01-20-2016 10:39 AM
Hi,
as per the SAP note
and try to use BAPI_TRANSACTION_COMMIT and check RETURN table it will give you the idea of the error.
WA_EXTENSIONIN-STRUCTURE = 'BAPI_TE_MEREQITEM'. << use BAPI_TE_MEPOITEMX
follow this>>
WA_BAPI_TE_MEPOITEM-PO_ITEM = '<give item number here>'.
WA_BAPI_TE_MEPOITEM-ZZPROJECTNUMBER = ''. << pass the values to the fields populate them
WA_BAPI_TE_MEPOITEM-ZZPROJECTNAME = ''.
WA_BAPI_TE_MEPOITEM-ZZMENGE = ''.
WA_BAPI_TE_MEPOITEM-ZZMEINS = ''.
WA_BAPI_TE_MEPOITEM-ZZMCTXT = ''.
WA_BAPI_TE_MEPOITEM-ZZKOSTL = ''.
WA_BAPI_TE_MEPOITEMX-PO_ITEM = <give item number here>
WA_BAPI_TE_MEPOITEMX-ZZPROJECTNUMBER = 'X'.
WA_BAPI_TE_MEPOITEMX-ZZPROJECTNAME = 'X'.
WA_BAPI_TE_MEPOITEMX-ZZMENGE = 'X'.
WA_BAPI_TE_MEPOITEMX-ZZMEINS = 'X'.
WA_BAPI_TE_MEPOITEMX-ZZMCTXT = 'X'.
WA_BAPI_TE_MEPOITEMX-ZZKOSTL = 'X'.
WA_EXTENSIONIN-STRUCTURE = 'BAPI_TE_MEREQITEM'.
WA_EXTENSIONIN-value1+10 = WA_BAPI_TE_MEPOITEM-zzfield1. use offset as per the length of field.
WA_EXTENSIONIN-value1+20 = WA_BAPI_TE_MEPOITEM-zzfield2.
ans so on if value1 length is not sufficient use value2 as well in same way.
APPEND WA_EXTENSIONIN TO IT_EXTENSIONIN.
WA_EXTENSIONIN-STRUCTURE = BAPI_TE_MEPOITEMX'. <<<< this is structure must have zzfields with same name and length 1
WA_EXTENSIONIN+30 = WA_BAPI_TE_MEPOITEMX.
APPEND WA_EXTENSIONIN TO IT_EXTENSIONIN.
thanks!!
01-20-2016 11:19 AM
Thanks For your reply.
Need Small Clarification
In this BAPI_TE_MEPOITEMX. Some Custom Fields are available.
Which fields i need to update, That fields i need to pass as 'X'. Which means i am going to update this fields.
I have 5 fields out of 5 fields, One field is quantity. so, i passed as.
WA_BAPI_POITEM-ZZMENGE = 'X'.
But while running the program, i am getting the error as Unable to interpret "X" as a number.
Actually it is quantity fields, I can not pass X as value. But as per the Code. I need to pass the Field as 'X'.
How could i pass X.
01-20-2016 11:21 AM
01-20-2016 11:22 AM
read the above solution carefully you need to provide 'PO item' in corresponding X structure.
follow the link for your better understanding in BAPI Extension..
thanks!!
01-20-2016 11:38 AM
01-20-2016 11:46 AM
Hi, I Read the above document.
In 4th point mentioned like below.
4) VBAPKOZ: In the append structure here also add the ZZFIELD with the data type as needed with limitations. No decimals. Try and stick to char characters
BAPI_TE_MEPOITEM and BAPI_TE_MEPOITEMX
I need to maintain Same , I did the Same
But as per the 4th point. No decimals this point i did not understood. Should i change
Field ===== ZZMENGE Quant Type and Length 13 Decimals 3 To Char Type.
Only Components names should be same in both BAPI_TE_MEPOITEM ,BAPI_TE_MEPOITEMX , Data types Does not a matter. Am i correct.