Application Development 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: 

How to trigger a message box?

Former Member
0 Kudos

Hello Gurus,

I have created one screen in which i am having 10 input/output fields where if i have entered data in 4 or any number of fields i dont want to enter at that time so when i click back a message box should trigger saying data will lost do you want to continue YES or NO? Please can any one tell me procedure for triggering this message box.

Thks will be rewarded for helpful answer.

6 REPLIES 6

Sm1tje
Active Contributor
0 Kudos

the standard message boxes can be found in function group SPO1, in which most of them are obsolete. But you can use this one:POPUP_TO_CONFIRM

You can trigger this pop-up in your module pool by using the CHAIN ENDCHAIN block. Within this statement define all your ten fields and a module which can trigger the message box.

For example:

Call dialog modules to check input values. The screen fields input1 and input2 are checked in individual dialog modules check_1 and check_2. The screen fields input3 to input5 are checked in a processing chain in a shared dialog module check_chain. Warning or error messages in the dialog modules either make only one input field input1 or input2 ready for input again or all three input fields input3 to input5.

PROCESS AFTER INPUT.

MODULE leave_dynpro AT EXIT-COMMAND.

FIELD input1 MODULE check_1 ON REQUEST.

FIELD input2 MODULE check_2 ON REQUEST.

CHAIN.

FIELD input3.

FIELD input4.

FIELD input5.

MODULE check_chain ON CHAIN-REQUEST.

ENDCHAIN.

MODULE handle_user_command.

Only the part between CHAIN and ENDCHAIN if of interest to you.

Good luck.

Former Member
0 Kudos

Hello thks for responding i got the logic but i am unable to make it can you explain me more pricisely with any example.

Sm1tje
Active Contributor
0 Kudos

What exactly is it you do not understand? The way the module check_chain will look like, or the part between CHAIN end ENDCHAIN?

Former Member
0 Kudos

Hello Sir,

I am not geeting how my message box will trigger where i have to give text in my message box like Data will be lost do you want to continue? YES or NO tabs and all i have implemented your code as ..

&----


*& Module leave_dynpro INPUT

&----


  • text

----


module leave_dynpro input.

PATNO input1 MODULE check_1 ON REQUEST.

PATWT input2 MODULE check_2 ON REQUEST.

CHAIN.

NOPIC input3.

PATNO input4.

PATWT input5.

MODULE check_chain ON CHAIN-REQUEST.

ENDCHAIN.

endmodule. " leave_dynpro INPUT

where PATNO and PATWT are me fields...in my table and ZTABLE-patno and ZTABLE-PATWT is my input/outpur field name..

Thks

Sm1tje
Active Contributor
0 Kudos

CHAIN.

NOPIC input3.

PATNO input4.

PATWT input5.

MODULE check_chain ON CHAIN-REQUEST.

ENDCHAIN.

Should be:

CHAIN.

FIELD NOPIC.

FIELD PATNO.

FIELD PATWT.

MODULE check_chain ON CHAIN-REQUEST.

ENDCHAIN.

Now double click on check_chain and module will be created.

In this module use Pattern button and enter the name of the function module I mentioned above.

You can test this function module in SE37 and you will see that it is self explanatory.

There are text lines, question line, title and options for buttons. Read the Documentation and you will find out.

I would give you some coding if I had a SAP system available, but I don't right now.

hope this works out.

Good luck.

Former Member
0 Kudos

Hello,

when i am double clicking on check_chain it is showing warning message like your source code is restricted to 72 lines. Can you tell me where i am going error here.

Thks