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

Rollback all changes under save button if confirmation for adding data is accepted

sanjeev_mishra_15aug
Active Participant
0 Likes
2,611

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

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,393

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

  • mmpur_metafield  -> link to dynpro field
  • mmpur_message_forced -> raise an error message

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

20 REPLIES 20
Read only

sanjeev_mishra_15aug
Active Participant
0 Likes
2,393

Any suggestions guys??

Read only

0 Likes
2,393

HI Sanjeev,

Make use of SET CURSOR FIELD syntax in your user exit. After clicking yes, set cursor on that custom field.

Read only

0 Likes
2,393

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.

Read only

0 Likes
2,393

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

Read only

0 Likes
2,393

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

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,393

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.

Read only

sanjeev_mishra_15aug
Active Participant
0 Likes
2,392

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

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,394

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

  • mmpur_metafield  -> link to dynpro field
  • mmpur_message_forced -> raise an error message

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

Read only

0 Likes
2,392

Hi Reymond,

While saving the Badis are not working. The cursor is not stopping at breakpoints.

Read only

0 Likes
2,392

This shouldn't be the case, CHECK method is always executed before SAVE...

Did you forget to activate your implementation?

Regards,

Raymond

Read only

0 Likes
2,392

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.

Read only

0 Likes
2,392

Share your code in CHECK Method and check if the BAdI's implementation is active...

Read only

0 Likes
2,392

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

Read only

0 Likes
2,392

Typo: Method to map dynpro field to metafield is MAP_DYNPRO_FIELDS

Read only

0 Likes
2,392

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

Read only

0 Likes
2,392

i'm unsure your requirement can be fulfilled with old customer-exit usage.

For old technology, as far as I remember, also better use EXIT_SAPMM06E_012 than 013 which is only intended to update customer database table and not a PAI/error message exit.

Regards,

Raymond

Read only

0 Likes
2,392

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

Read only

0 Likes
2,392

This message was moderated.

Read only

sanjeev_mishra_15aug
Active Participant
0 Likes
2,392

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

Read only

0 Likes
2,392

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.