‎2016 Jun 06 4:32 AM
Hi Gurus,
I have a requirement, In this there has been already a screen enhancement has been done to add some custom field in header level.
My requirement is that while creating the PO using tcode ME21N if user forgets to add data to the above mentioned custom field, and clicks Save Button, then system should pop up a message asking whether user wants to add data to the custom field or not.
If YES then instead of proceeding further, the cursor should be in that field under particular tab.
To do this I used user exit 'EXIT_SAPMM06E_013' in which I am successful to pop up the message for asking user to add data in the custom field while saving the PO.
But the problem is that if user clicks 'YES' button, then I am unable to take the cursor back to the custom field without saving the PO. Please help me out.
Your suggestions are awaited.
Thanks in advance.
Sanjeev
ABAPer
‎2016 Jun 06 8:29 AM
Use the more recent BAdIs ME_PROCESS_PO_CUST for check and ME_GUI_PO_CUST for customer screen (tab)
Some metafield values are reserved for such customer fields: mmmfd_cust_01, the ME_GUI_PO_CUST provide a method ME_GUI_PO_CUST to attach fields to metafield values.
For this SAP provided some macros
Use those in method PROCESS_ITEM/HEADER and CHECK of ME_PROCESS_PO_CUST.
Perform some search, there are now many threads and sample at scn on those BAdI.
Regards,
Raymond
‎2016 Jun 06 5:47 AM
‎2016 Jun 06 6:12 AM
HI Sanjeev,
Make use of SET CURSOR FIELD syntax in your user exit. After clicking yes, set cursor on that custom field.
‎2016 Jun 06 6:16 AM
Thnks Pranay for your reply,
Can you please elaborate it a little bit more. Because before using Set cursor field statement I think we need to use call screen statement.
Here I am stuck.
Please suggest.
‎2016 Jun 06 6:28 AM
Hi,
If your userexit is in the PBO then only that statement will work. If it is part of the PAI, than SET CURSOR will not work.
You can implement Field Exit for this screen field to have the validation at the PBO level to place the Cursor on Error Message. To implement field exit, check below thread:
User Exit Validation - Setting Cursor & Set... | SCN
‎2016 Jun 06 7:47 AM
Thanks Pranay,
Following your steps I was able to create upto creation of Field exit. But when i open the field exit in display mode, I get the message that field exit.... doesn't exist.
And when I try to create it, I get message as "changes to are not allowed".
How to proceed further?
Please help me out.
Thanks.
Sanjeev
‎2016 Jun 06 8:02 AM
This is a classic problem in dynpro programming. The cursor is handled using FIELD statement in the dynpro flow logic, which you use to mention a screen field(s) and a PAI module to validate the field. If you send an error message Inside that module, all screen fields become protected except the specified field Under FIELD on which the cursor is automatically located.
If you don't want this behavior, SET CURSOR (for dynpros) works. http://help.sap.com/abapdocu_702/en/?url=ABAPSET_CURSOR.htm
Last one is taken into account. You don't need CALL SCREEN.
A field exit is useful for standard fields (but is obsolete and deactivated at system level by default), but in your case, it's a custom screen, so you don't need it.
‎2016 Jun 06 8:21 AM
I think my requirement is not clear.
this is the screenshot of me21n after filling all the data in which the highlighted field is blank for which I need to populate to ask user does he/she want to add data to this field when clicked on SAVE button. If selected yes then the cursor should be set to this field without saving the po.
Please suggest any solution.
M new to user exit/field exit. so please let me know if field exit is required in this case step by step to work out.
Thanks
Sanjeev
‎2016 Jun 06 8:29 AM
Use the more recent BAdIs ME_PROCESS_PO_CUST for check and ME_GUI_PO_CUST for customer screen (tab)
Some metafield values are reserved for such customer fields: mmmfd_cust_01, the ME_GUI_PO_CUST provide a method ME_GUI_PO_CUST to attach fields to metafield values.
For this SAP provided some macros
Use those in method PROCESS_ITEM/HEADER and CHECK of ME_PROCESS_PO_CUST.
Perform some search, there are now many threads and sample at scn on those BAdI.
Regards,
Raymond
‎2016 Jun 06 8:54 AM
Hi Reymond,
While saving the Badis are not working. The cursor is not stopping at breakpoints.
‎2016 Jun 06 8:57 AM
‎2016 Jun 06 9:11 AM
I checked and activated the implementation for the badi 'ME_PROCESS_PO_CUST' and put the breakpoint on the statement in the check method of the implementation. but while saving the po the cursor doesn't reach to the breakpoint.
‎2016 Jun 06 9:31 AM
Share your code in CHECK Method and check if the BAdI's implementation is active...
‎2016 Jun 06 9:35 AM
Thanks Simone and Raymond, I activated the implementation, I am able to use the validation in the Check method.
But please suggest me the process to set cursor in the highlighted field as shown in the above screenshot.
Thanks In advance.
Sanjeev
‎2016 Jun 06 9:38 AM
‎2016 Jun 06 10:01 AM
Hi Raymond,
Can you please elaborate a little bit, because here the screen is generated using screen exit, so I don't have the Idea how to get cursor in the highlighted position using me_gui_po_cust Badi.
Please suggest me the steps.
Thanks
‎2016 Jun 06 10:25 AM
‎2016 Jun 06 10:35 AM
Thanks Raymond for the reply.
Can you please provide me the code snippet for the same as u suggested to set the cursor field without saving.
Waiting for your reply
Thanks
‎2016 Jun 06 12:09 PM
‎2016 Jun 07 4:59 AM
Hi Experts,
As I have never used the badi for setting the cursor position, So please help me out to get to know how the badi ME_GUI_PO_CUST can be used to set the cursor position.
Thanks in advance
Sanjeev
‎2016 Jun 07 9:43 AM
SAP has provided Example implementation class CL_EXM_IM_ME_GUI_PO_CUST for the same purpose. Inside this class, check method implementation MAP_DYNPRO_FIELDS as Experts have advised and see how SAP is doing. You need to implement in your custom implementation to do the same.