cancel
Showing results for 
Search instead for 
Did you mean: 

new to abap programming and has a query

Former Member
0 Kudos

hi frens this is my new query, so please help me in getting the solution.

In screen programming if we use obligatoary to an output field., then an user must enter a value on the selection screen. if we want to exit(or abort) from the selection screen without entering a value then what is the programming that i have to perform.

waiting for ur reply

REGARDS

PRASAD

Accepted Solutions (1)

Accepted Solutions (1)

former_member183804
Active Contributor
0 Kudos

Hello Prasad,

with the standard gui-Status this should be no problem. So I assume you use a own pf-Status. In this case you should change the command from application to exit commands. This will suppress the execution of the value checks.

Best Regards

Klaus

Answers (4)

Answers (4)

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

You can do so by using GUI status by making use of EXIT and CANCEL. In PAI of the screen you have to write the following coding.

DATA : o_alvgrid TYPE REF TO cl_gui_alv_grid,

o_dockingcontainer TYPE REF TO cl_gui_docking_container.

module USER_COMMAND_9001 input.

CASE sy-ucomm.

WHEN 'EXIT' or 'CANCEL'.

perform f9600_free_objects:

using o_Alvgrid 'ALV' text-E02,

using o_Dockingcontainer 'DOCKING'

TEXT-E01.

LEAVE PROGRAM.

ENDCASE.

endmodule. " USER_COMMAND_9001 INPUT

FORM f9600_free_objects USING pobject

value(ptype)

value(ptext).

DATA: l_objectalv TYPE REF TO cl_gui_alv_grid.

CASE ptype.

WHEN 'ALV'.

l_objectalv = pobject.

IF NOT ( l_objectalv IS INITIAL ).

CALL METHOD l_objectalv->free

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

OTHERS = 3.

CLEAR: pobject, l_objectalv.

PERFORM f9700_error_handle USING ptext.

ENDIF.

WHEN 'DOCKING'.

DATA: lobjectdock TYPE REF TO cl_gui_docking_container.

lobjectdock = pobject.

IF NOT ( lobjectdock IS INITIAL ).

CALL METHOD lobjectdock->free

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

OTHERS = 3.

CLEAR: pobject, lobjectdock.

PERFORM f9700_error_handle USING ptext.

ENDIF.

WHEN 'CONTAINER'.

DATA: lobjectcontainer TYPE REF TO cl_gui_container.

lobjectcontainer = pobject.

IF NOT ( lobjectcontainer IS INITIAL ).

CALL METHOD lobjectcontainer->free

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

OTHERS = 3.

CLEAR: pobject, lobjectcontainer.

PERFORM f9700_error_handle USING ptext.

ENDIF.

WHEN OTHERS.

sy-subrc = 1.

PERFORM f9700_error_handle USING

text-e04.

ENDCASE.

ENDFORM. " f9600_free_objects

FORM f9700_error_handle USING value(ptext).

IF sy-subrc NE 0.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

titel = text-e03

txt2 = sy-subrc

txt1 = ptext.

ENDIF.

endform.

Hope this helps.

Regards,

J.Jayanthi

Former Member
0 Kudos

Hi,

I am giving u some sample code for the same

In PAI of the screen,

MODULE user_command_0100 INPUT.

DATA: i_return_code TYPE i .

CALL METHOD cl_gui_cfw=>dispatch

IMPORTING return_code = i_return_code.

ws_save_ok = ok_code.

CASE ws_save_ok.

<b>WHEN 'BACK' OR 'EXIT' OR 'CANC'</b>.

PERFORM exit_program.

ENDCASE.

CLEAR ws_save_ok.

ENDMODULE. " USER_COMMAND_0100 INPUT

FORM exit_program.

CALL METHOD o_grid_container->free.

CALL METHOD cl_gui_cfw=>flush.

IF sy-subrc NE 0.

  • Error in FLush

ENDIF.

LEAVE TO SCREEN 0.

ENDFORM. " EXIT_PROGRAM

Hope this helps.

Thanks & Regards,

Judith.

ssimsekler
Active Contributor
0 Kudos

Hi Prasad

In your GUI status define a function key (usually BACK, EXIT and CANCEL function keys) as <b>exit</b> commands. To do this double click on the function key name and enter 'E' for the function type.

Then at you PAI insert a module with <b>"AT EXIT-COMMAND"</b> addition.

<u>e.g.</u>


PROCESS AFTER INPUT .
MODULE exit_screen AT EXIT-COMMAND .
...

Inside this module implement your leaving code.

<u>e.g.</u>

MODULE exit_screen .
  ...
  LEAVE TO SCREEN 0 .
ENDMODULE .

This way when user press a button of type 'exit command', the screen will not perform usual checks and immediately triggers the <i>exit_screen</i> module which leaves the screen.

Regards

*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

Former Member
0 Kudos

If your menu status buttons for 'BACK', 'EXIT' or 'CANCEL' are defined as exit functions, then in your PAI you should have a module 'ON EXIT COMMAND'. In that module you will issue a leave screen command.