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

Enhancement Framework - Is it possible?

Former Member
0 Likes
670

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
642

You can try following:

CHECK 1 = 2.

The SAP code is never reached.

Best regards.

Rafael Rojas.

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.

5 REPLIES 5
Read only

Former Member
0 Likes
643

You can try following:

CHECK 1 = 2.

The SAP code is never reached.

Best regards.

Rafael Rojas.

Read only

0 Likes
642

EXIT is suggested over RETURN.

Thank you

Read only

0 Likes
642

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

Read only

Former Member
0 Likes
642

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

Read only

former_member186741
Active Contributor
0 Likes
642

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.