‎2005 Jun 21 7:06 AM
Dear all,
I have a situation: A program was coded by "Execute type(type 1)" and have the input criteria as report, and then get data to make a dialog transaction to display. After change some data in dialog screen,call transaction to post document and display the document no. by "LEAVE TO LIST-PROCESSING". But when press 'BACK','EXIT' want to go to the input criteria screen,it seems not work and occurs dump. Can you tell me how to go back to initial screen directly? Tks!
ABAP code flow:
init.scr(criteria)--> dialog trans. --> List
<- --- how to? ------
Regina
‎2005 Jun 21 8:28 AM
Hi,
If you want to go back to the original screen from where you called the list processing, use the following syntax:
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
this returns back to the original screen and then you can use the BACK button to go back to the input screen.
Regards,
Jagath
‎2005 Jun 21 7:33 AM
Hi Regina,
i have two suggestions:
1) use the additional command "AND RETURN TO SCREEN XXX"
of "LEAVE TO LIST-PROCESSING"
or
2) try "LEAVE TO SCREEN XXX"
Regards
Olaf
‎2005 Jun 21 7:39 AM
Hi,
In PAI of the screen,
if the sy-ucomm value equals the ok-code for the BACK & EXIT,code like this.
SET SCREEN '0'.
LEAVE SCREEN.
‎2005 Jun 21 8:28 AM
Hi,
If you want to go back to the original screen from where you called the list processing, use the following syntax:
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
this returns back to the original screen and then you can use the BACK button to go back to the input screen.
Regards,
Jagath
‎2005 Jun 21 9:35 AM
Hi,
Sample from ALV
Try this out
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANC'.
PERFORM exit_program.
ENDCASE.
FORM exit_program.
CALL METHOD o_grid_container->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
Error in FLush
ENDIF.
<b>SET SCREEN '0'.</b> Or
<b>LEAVE TO SCREEN 0.</b>
ENDFORM. " EXIT_PROGRAM
OR
<b>CASE sy-ucomm.
WHEN 'EXIT' OR 'CANC'.</b>
PERFORM f9005_free_objects :
USING o_alvgrid 'ALV' text-e02 ,
USING o_dockingcontainer 'DOCKING' text-e01.<b>
LEAVE PROGRAM.</b>
<b>WHEN 'BACK'.</b>
PERFORM f9005_free_objects :
USING o_alvgrid 'ALV' text-e02 ,
USING o_dockingcontainer 'DOCKING' text-e01.
<b>SET SCREEN '0'.</b>
FORM f9005_free_objects USING pobject
value(ptype)
value(ptext).
CASE ptype.
WHEN 'ALV'.
DATA lobjectalv TYPE REF TO cl_gui_alv_grid.
lobjectalv = pobject.
IF NOT ( lobjectalv IS INITIAL ).
CALL METHOD lobjectalv->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
CLEAR: pobject ,
lobjectalv.
PERFORM f9006_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 f9006_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 f9006_error_handle USING ptext.
ENDIF.
WHEN OTHERS.
sy-subrc = 1.
PERFORM f9006_error_handle USING text-e04.
ENDCASE.
ENDFORM. " f9005_free_objects
Hope this helps.