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

XD02 - User Exit- Check before Saving

Former Member
0 Likes
1,947

I am using this user exit in transaction XD02 (customer..) and there is a user exit check before saving.

If there is an error, how should I popup this message in user exit?

I saw a function module which the same transaction is using MESSAGE_STORE. Can I use this function module ? Is there any setting that I need to do in SPRO for message collection ?

Regards,

Subramanian V.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,769

This program example shows how to display messages in a message popup using function modules of function group SMSG. It's quite simple.

Good luck

Volker

DATA: BEGIN OF lt_nachrichten OCCURS 0,

arbgb LIKE smesg-arbgb,

msgty LIKE smesg-msgty,

msgv1(50),

msgv2(50),

msgv3(50),

msgv4(50),

txtnr(03),

END OF lt_nachrichten.

*...Activate Message-Handler

CALL FUNCTION 'MESSAGES_INITIALIZE'.

*...Store message

LOOP AT lt_nachrichten.

CALL FUNCTION 'MESSAGE_STORE'

EXPORTING

arbgb = lt_nachrichten-arbgb

msgty = lt_nachrichten-msgty

msgv1 = lt_nachrichten-msgv1

msgv2 = lt_nachrichten-msgv2

msgv3 = lt_nachrichten-msgv3

msgv4 = lt_nachrichten-msgv4

txtnr = lt_nachrichten-txtnr.

ENDLOOP.

*...Display messages

CALL FUNCTION 'MESSAGES_SHOW'

EXPORTING

object = 'Error messages'

EXCEPTIONS

inconsistent_range = 1

no_messages = 2

OTHERS = 3.

I am using this user exit in transaction XD02 (customer..) and there is a user exit check before saving.

If there is an error, how should I popup this message in user exit?

I saw a function module which the same transaction is using MESSAGE_STORE. Can I use this function module ? Is there any setting that I need to do in SPRO for message collection ?

Regards,

Subramanian V.

8 REPLIES 8
Read only

Former Member
0 Likes
1,769

Hi Subramanian,

As far as I know the only way to generate a message in this exit is using MESSAGE (if you want to prevent the customer is saved) of a FM like POPUP_TO_INFORM if it's only informational.

Regards,

John.

Read only

0 Likes
1,769

Hi John,

Thanks for your reply, but I am not sure whether it will work, but I will definitely give it a shot.

In ME21N transaction, I had used an user exit and even there the messages were stacked up and on clicking the save button, SAP automatically showed all the messages. I can't recollect which function module I had used(then I didn't have that excel sheet). It used to show 3 error messages, 4 warnings. So similarly, I am looking for a function module which is being used by XD02 for stacking up messages and showing them in final display.

Regards,

Subramanian V.

Read only

0 Likes
1,769

Hi Subramanian,

In ME21N the functions MESSAGE_STORE (to store messages in global table) and MESSAGES_SHOW are used. But as far as I'm aware of this functionality is not used (yet?) for customer maintenance.

Regards,

John.

Read only

nablan_umar
Product and Topic Expert
Product and Topic Expert
0 Likes
1,769

Not all application is using the message store. To check whether that application is using it, put a break-point in those message function modules. Execute your application and generate some errors. See whether it stop in that function.

If that application is not using similar message storing technique, you might want to popup the error message in that user exit, then call back that transaction and skip the initial screen.

Read only

Former Member
0 Likes
1,770

This program example shows how to display messages in a message popup using function modules of function group SMSG. It's quite simple.

Good luck

Volker

DATA: BEGIN OF lt_nachrichten OCCURS 0,

arbgb LIKE smesg-arbgb,

msgty LIKE smesg-msgty,

msgv1(50),

msgv2(50),

msgv3(50),

msgv4(50),

txtnr(03),

END OF lt_nachrichten.

*...Activate Message-Handler

CALL FUNCTION 'MESSAGES_INITIALIZE'.

*...Store message

LOOP AT lt_nachrichten.

CALL FUNCTION 'MESSAGE_STORE'

EXPORTING

arbgb = lt_nachrichten-arbgb

msgty = lt_nachrichten-msgty

msgv1 = lt_nachrichten-msgv1

msgv2 = lt_nachrichten-msgv2

msgv3 = lt_nachrichten-msgv3

msgv4 = lt_nachrichten-msgv4

txtnr = lt_nachrichten-txtnr.

ENDLOOP.

*...Display messages

CALL FUNCTION 'MESSAGES_SHOW'

EXPORTING

object = 'Error messages'

EXCEPTIONS

inconsistent_range = 1

no_messages = 2

OTHERS = 3.

Read only

0 Likes
1,769

Thanks a lot all.

Problem was solved incredibly easily.

All I need to write is :


MESSAGE E563(F2) with 'my message'.

Regards,

Subramanian V.

Read only

0 Likes
1,769

Hi Subramanian,

Would like to give points regarding to SDN customs.

You can give points by clicking to the yellow star icon at the header of each post. By this way, you can give;

-one 10 points (solved)

-two 6 points (very helpful answer)

-many 2 points (helpful answer)

Thanks...

John.

Read only

0 Likes
1,769

John, I do understand about the points, and I never forget to give points. I have given points to every answer. I am always reminded of Mark Finnern's weblog about 'Good Karma'.

Regards,

Subramanian V.