Application Development 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: 

Calling Prog uses Include Form/Need to pass itab to and from the includ

Former Member
0 Kudos

What is te best method?

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos

Hi,

You can specify the name of a subroutine and, in the case of external calls, the name of the program in which it occurs, dynamically as follows:


PERFORM (<fsubr>)[IN PROGRAM (<fprog>)][USING   ... <pi>... ] 
                                       [CHANGING... <pi>... ] 
                                       [IF FOUND].

The names of the subroutine and the external program are the contents of the fields <fsubr> and <fprog> respectively. By using the option IF FOUND, you can prevent a runtime error from being triggered if <fprog> does not contain a subroutine with the name <fsubr>. If you omit the parentheses, this variant of the PERFORM statement behaves like the static variant.

Regards,

Ferry Lianto

2 REPLIES 2

ferry_lianto
Active Contributor
0 Kudos

Hi,

You can specify the name of a subroutine and, in the case of external calls, the name of the program in which it occurs, dynamically as follows:


PERFORM (<fsubr>)[IN PROGRAM (<fprog>)][USING   ... <pi>... ] 
                                       [CHANGING... <pi>... ] 
                                       [IF FOUND].

The names of the subroutine and the external program are the contents of the fields <fsubr> and <fprog> respectively. By using the option IF FOUND, you can prevent a runtime error from being triggered if <fprog> does not contain a subroutine with the name <fsubr>. If you omit the parentheses, this variant of the PERFORM statement behaves like the static variant.

Regards,

Ferry Lianto

Former Member
0 Kudos

Check the below example :

PERFORM write_2_server TABLES hire_emp_tab.

PERFORM write_2_server TABLES entrance_tab.

PERFORM write_2_server TABLES integration_tab.

PERFORM write_2_server TABLES duty_tab .

PERFORM write_2_server TABLES type_emp_tab.

PERFORM write_2_server TABLES job_part_tab .

PERFORM write_2_server TABLES free_days_tab.

PERFORM write_2_server TABLES status_tab.

PERFORM write_2_server TABLES bank_detailes_tab.

FORM write_2_server TABLES p_tab_data.

FIELD-SYMBOLS: <wa> TYPE ANY.

" MOVE 'D:_pa_test_mmsk_pa1.txt' TO adress.

OPEN DATASET adress IN TEXT MODE

ENCODING DEFAULT FOR OUTPUT.

IF sy-subrc = 0.

no_file = ' '.

LOOP AT p_tab_data ASSIGNING <wa>.

TRANSFER <wa> TO adress.

ENDLOOP.

CLOSE DATASET adress.

ELSE.

no_file = 'X'.

ENDIF.

endform.

you get reusability.

Thanks

Seshu