2011 Feb 09 9:20 PM
Hi Forums,
I have a requirement to look into enhancing a SAP program, in the area I would plan to set my enhancement point is at the beginning of a FORM.
Is there a flag or something I can set that after my code executes I DO NOT execute the SAP code that comes after it?
thank you,
form test.
**************************** enhancement spot here
SAP code.... (do not want to execute)
endform.
2011 Feb 10 12:26 AM
You can try following:
CHECK 1 = 2.The SAP code is never reached.
Best regards.
Rafael Rojas.
2011 Feb 10 12:26 AM
You can try following:
CHECK 1 = 2.The SAP code is never reached.
Best regards.
Rafael Rojas.
2011 Feb 10 3:32 AM
2011 Feb 10 4:23 PM
Hi MSRaju_ABAP,
This is what the documentation of SAP states:
Note
We recommend using EXIT only within loops (see EXIT (loops) ). Instead, use RETURN to leave processing blocks.
So for this particular scenario, SAP recommends to use RETURN.
Kind regards,
Robert
2011 Feb 10 12:41 AM
or RETURN.
Example
Leave the subprogram show_list with RETURN, if one of the required formal parameters structure or data_tab is initial.
FORM show_list USING structure TYPE c
data_tab TYPE ANY TABLE.
DATA alv_list TYPE REF TO cl_gui_alv_grid.
IF structure IS INITIAL OR
data_tab IS INITIAL.
RETURN.
ENDIF.
CREATE OBJECT alv_list
EXPORTING i_parent = cl_gui_container=> screen0.
CALL METHOD alv_list->set_table_for_first_display
EXPORTING i_structure_name = structure
CHANGING it_outtab = data_tab.
CALL SCREEN 100.
ENDFORM.
Regards,
Robert
2011 Feb 10 3:09 AM
you can simply put an 'exit' stateemnt after your code and before the sap standard stuff.
But you must be very careful here. Sometimes it's not obvious where various sap forms are used and it may be risky to do this unless you are sure you understand all the uses of this form.