Skip to Content
author's profile photo Former Member
Former Member

calling same form multiple times

Hi, i need to call a single form with different table names as parameters depending on conditions.

for eg here is the approach

if flag1_is_set

call form1 multiple times with table1, table2....... as parameters

"and i can avoid this

" form 1 using table 1

" form 1 using table 2

" form 1 using table 3

" form 1 using table 4

" form 1 using table 5



form 1 using table 2



form 1 using table 3.


but i cannot call forms like this. can someone suggest

an equivalent implementation on how to do this.

if i dont implement in the above mentioned approach i have to code the same thing with minor changes multiple times


your help would be appreciated.


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 15, 2005 at 01:01 AM

    I dont think you have any other option but to use perform several times with different tables .OR if you like

    Loop at internal tables (of difftable names )

    Perform < >> using inttab-intabname.


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 15, 2005 at 03:43 AM


    I assume that you want to call the form at the maximum 3 times if flag1 is set.

    if ( flag1 = 'X' or flag2 = 'X' or flag3 = 'X').

    Perform form1 tables

    table1 table2 table3.


    If flag2 is set,then I assume that you are refreshing table1 and table3.Then in that case those tables are initial.So it won't affect.Similarly for flag3.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 15, 2005 at 05:17 AM

    Hi Kranthi,

    You have mentioned that you are calling the sub-routine using different tablenames.Sadly enough you have to call the perform several times.We could help you out if you could give us the exact requirements.You can use the solution suggested by Jayanthi as long as you have values passed to all the formal parameters or the one suggested by Bhandari.

    Please close the thread by awarding some reward points.In case you have any more questions please post the same.



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      You might try passing a field symbol (itab) in the tables.

      And assign the filed symbol with your itab as per the condition.

      Check if the program below gives you any idea.

      DATA: lt_users2 type standard table of usr02.
      DATA: lt_users1 type standard table of usr01.
      FIELD-SYMBOLS: <fs_itab> type standard table.
      SELECT * into table lt_users1 FROM usr01.
      SELECT * into table lt_users2 FROM usr02.
       IF P_TAB1 eq 'X'.
         ASSIGN lt_users1 to <fs_itab>.
         ASSIGN lt_users2 to <fs_itab>.
      PERFORM test_form TABLES <fs_itab>.
      FORM test_form TABLES x_itab .
      FIELD-SYMBOLS: <fs_wa> type any.
      FIELD-SYMBOLS: <fs_field> type any.
        LOOP AT x_itab ASSIGNING <fs_wa>.
          DO 5 times.     "Write first 5 fields of itabs.
            ASSIGN COMPONENT sy-index OF STRUCTURE <fs_wa> to <fs_field>.
            WRITE :  <fs_field>.
          WRITE :/.



      Message was edited by: Ram Manohar Tiwari

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.