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

Default Back Button ( F3 ) with mandatory fields ( module pool program )

Former Member
0 Likes
3,509

Guys,

I'm editing another persons dialog program and as mentioned in the subject line, there are mandatory fields. WIthout them being filled, I cannot use the back button to exit the program as it prompts me to first fill the mandatory fields.

How can I get past this?

I did a /h for debug mode and pressed Back but it did not even show the debugger.

Regards,

Kevin

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,069

In screen GUI status : double click on the function code attached with BACK event and assign the function tyoe as "E".

In PAI EVENT:

module "BACK" AT EXIT-COMMAND.

in this module, write the functionality of BACK command.

10 REPLIES 10
Read only

Former Member
0 Likes
2,069

<b>Use AT exit-command.</b>

MODULE mod [ AT {EXIT-COMMAND|CURSOR-SELECTION} ] 
           [ ON {CHAIN-INPUT|CHAIN-REQUEST} ] 
           [ SWITCH switch ]. 



Extras: 
1. ... AT EXIT-COMMAND 


Effect 
The statement MODULE of the dynpro flow logic calls the dialog module mod of the ABAP program. You can use MODULE either as a keyword or as an addition of statement FIELD. When using it as an addition, the call of the dialog module depends on conditions for the screen fields. 

As a keyword, the statement calls the dialog module mod of the respective ABAP program. At the event PAI, you can use the additions AT and ON to specify conditions for the call of the dialog module. 

At the event PBO, you can call any dialog module defined in the ABAP program with the addition OUTPUT. At the events PAI, POH and POV, you can call any dialog module defined with the addition INPUT or without any addition. If the dialog module mod does not exist in the ABAP program, an untreatable exception is triggered. After processing a dialog module in the ABAP program, processing of the dynpro flow logic is resumed after the position of the call, unless the screen processing is completed within the dialog module. 

You can use MODULE as a keyword only at the events PBO and PAI. At the events POH and POV, you can use MODULE only as an addition to the FIELD statement. 

Note 
Do not mix up the MODULE statement of the dynpro flow logic with the identically called statement MODULE for defining dialog modules in the ABAP program. 



Addition 1 
... AT EXIT-COMMAND 


Effect 
Addition AT EXIT-COMMAND at the event PAI causes module mod to be called exactly if: 

The function used to trigger event PAI has function type "E" 

Into the input field of the standard toolbar, the user entered a character string starting with "E" and confirmed it using ENTER. 

The dialog module is called before the automatic input checks defined in the system or in the ABAP Dictionary and independent of its position in the event block. The only screen field transported to the ABAP program is the OK field. If the function that triggered the PAI event does not fulfill any of the above prerequisites, the MODULE statement is not executed. 

If several MODULE statements have the AT EXIT COMMAND addition, only the first one is executed. If no MODULE statement has the addition AT EXIT COMMAND, a normal PAI processing is executed: The predefined input checks are executed and then the PAI event block is processed sequentially. Provided the screen processing is not terminated in the dialog module mod, after the return from the dialog module, the complete PAI processing is executed. You must not use the addition AT EXIT COMMAND in connection with the statement FIELD. 

Note 
The function type of a function is determined in the Screen Painter or Menu Painter. Usually those functions of the user interface are defined with function type "E" that are assigned to the icons Back, Exit and Cancel in the standard toolbar of the GUI status. Therefore, the called dialog module should terminate the screen processing and allow security checks, if required.

Read only

0 Likes
2,069

I have this:

process before output.
  module 0100_init_screen.
*
process after input.
  module exit_100 at exit-command.
  module 0100_user_command.

process on value-request.
  field carea  module f4_carea.
  field matrix module f4_matrix.
  field segm3  module f4_segment.
  field file   module f4_file.

And in my ABAP I have

module exit_100 input.
  leave program.
endmodule.                 " exit_100  INPUT

It does not work.. and when specifying the module declaration as

module exit_100 AT EXIT-COMMAND.

It gives me an error

"." expected after "EXIT_100".	

Read only

gopi_narendra
Active Contributor
0 Likes
2,069

in the PAI of Exit-Module just make sure that none of the mandatory fields are INITIAL.

module exit_0200 at exit-command.

case ok-code.
when 'BACK' or
      'EXIT' or 
      'CANCEL'.
  if not mandatory-field1 is initial or
     not mandatory-field2 is initial or
     not mandatory-field3 is initial.
    leave to screen 0100.
  endif.
endcase.

Regards

Gopi

Read only

Former Member
0 Likes
2,070

In screen GUI status : double click on the function code attached with BACK event and assign the function tyoe as "E".

In PAI EVENT:

module "BACK" AT EXIT-COMMAND.

in this module, write the functionality of BACK command.

Read only

0 Likes
2,069

Gupta,

Where is this screen GUI status? Is it a predefined screen?

Not sure assign the BACK button as type 'E'

Kevin

Read only

0 Likes
2,069

Richa,

Managed to find the GUI status. Its right under my nose.

Changed the Back Button to type "E"

and implemented the AT Exit-Command.

Thanks all!

Read only

Former Member
0 Likes
2,069

HI,

Open the Screen in Screen Painter.

Double click on the field which is Mandatory.

An Attribute window will be opened.

Change the attribute from MANDATORY to REQUIRED.

Now system wont give an error message if you try to click on back when the fields are blank.

Best regards,

Prashant

Read only

0 Likes
2,069

HI Prashant,

All options can be chosen except "Required", because it is greyed out.

I am not sure why...

Kevin

Read only

Former Member
0 Likes
2,069

Please choose RECOMMENDED & activate.

Read only

Former Member
0 Likes
2,069

Hi Kevin,

The earlier Developer might have develop some logic and had the field declared as required.. so if u change this you application may runinto dump or logic may fail..

the good option is you declare the back as func type 'E' from urr menu editor.. and then create a module with at-exit command as suffix..

When u declare a Func code type 'E' it calls the module with at-exit command before duing any automated check (i.e required field check, data format check, foreign key check etc.)

No Reqwards Plz