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

Passing INLCUDE name dynamically

Former Member
0 Likes
449

Hi,

Is there any way of passing the INCLUDE name dynamically?

Scenario is as follows

Requirement is to consolidate approx 6 enhancements (user exits) of the same name from 6 different systems into 1system . Objective is to put each of the code in an INCLUDE and then call the relevant INCLUDE based on some data maintained in a z-table

Z-table would have entries like this

Scenario Include

S1 I1

S2 I2

S3 I3

.......

Hence final enhancement code should read the entry from z-table and accordingly pass the relevant INCLUDE name

INCLUDE <include name from z-table>

Valuable suggestions are needed.

Poonam

Hi,

Is there any way of passing the INCLUDE name dynamically?

Scenario is as follows

Requirement is to consolidate approx 6 enhancements (user exits) of the same name from 6 different systems into 1system . Objective is to put each of the code in an INCLUDE and then call the relevant INCLUDE based on some data maintained in a z-table

Z-table would have entries like this

Scenario Include

S1 I1

S2 I2

S3 I3

.......

Hence final enhancement code should read the entry from z-table and accordingly pass the relevant INCLUDE name

INCLUDE <include name from z-table>

Valuable suggestions are needed.

Poonam

2 REPLIES 2
Read only

venkat_o
Active Contributor
0 Likes
413

Hi Poonam, <li> Create one function group. <li> Write your 6 includes code in 6 function modules. function module is nothing but include in Function group. <li>Try to give importing and exporting parameters are same. <li>Try the below way.


REPORT ZTEST_NOTEPAD.

DATA: BEGIN OF IT_FUNC OCCURS 0,
        NAME TYPE RS38L-NAME,
      END OF IT_FUNC.

"Build your it_func with function modules.
LOOP AT IT_FUNC.
  CALL FUNCTION IT_FUNC-NAME "You can call fm dynamically
    EXPORTING
      DAY_IN            = IMPORTING
      LAST_DAY_OF_MONTH = EXCEPTIONS
      DAY_IN_NO_DATE    = 1
      OTHERS            = 2.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDLOOP.
Thanks venkat.O

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
413

Hello Poonam,

In your project we use this concept as well & we named it a sweet "User Exit Strategy" )

In the Z-Table instead of maintaining the INCLUDE names, maintain FM names as suggested by Venkat.

Scenario FMName

S1 FM1

S2 FM2

S3 FM3

Select the FM name based on the scenario & call the FM in your user-exit.

BR,

Suhas

Tip: The FM params have to be same as the SAP provided Exit Module.