2007 Sep 07 7:12 PM
Hi,
I have a small peculiar requirement, I have to pass an Internal table dynamically to
a form. Actually, this form should work for four different internal table of different types. But, the logic is same for these four tables. Depending on some condition, I
will pass different internal table to that form.
for example, I have written the code like this:
if cond1..
perform form_name using it_table1.
elseif cond2.
perform form_name using it_table2.
elseif cond3.
perform form_name using it_table3.
elseif cond4.
perform form_name using it_table4.
endif.
form form_name using it_table type any.
loop at it_table.
-
-
endloop.
endform.
This code is giving the error "it_table is not declared as table or Generic type'.
How to handle this scenario?
Could you please anybody help on this...
Thanks,
AJ
Hi,
I have a small peculiar requirement, I have to pass an Internal table dynamically to
a form. Actually, this form should work for four different internal table of different types. But, the logic is same for these four tables. Depending on some condition, I
will pass different internal table to that form.
for example, I have written the code like this:
if cond1..
perform form_name using it_table1.
elseif cond2.
perform form_name using it_table2.
elseif cond3.
perform form_name using it_table3.
elseif cond4.
perform form_name using it_table4.
endif.
form form_name using it_table type any.
loop at it_table.
-
-
endloop.
endform.
This code is giving the error "it_table is not declared as table or Generic type'.
How to handle this scenario?
Could you please anybody help on this...
Thanks,
AJ
2007 Sep 07 7:33 PM
Change this :
form form_name using it_table type any <b>TABLE</b>.
loop at it_table.
-
-
endloop.
endform.
This should do.
Thanks and Regards,
Srihari
2007 Sep 07 7:42 PM
Hi Srihari,
Agaun it is giving error like ' formal parameters and actual parameters are incompatable'
regards,
Ajay
2007 Sep 07 7:50 PM
Have you defined a header line for your internal table ??
If yes, try to avoid it.
If you cant :
Call the perform like this
perform <form_name> using it_table[].
Thanks and Regards,
Srihari
2007 Sep 07 8:02 PM
2007 Sep 07 8:08 PM
Can you please post a part of your code:
1) Your data declarations
2) Perform call
3) Form routine
2007 Sep 07 7:37 PM
Hi,
may be this way.
define form_name.
loop at &1.
----
----
endloop.
endefinition.
if condition eq 'XXXXXXXX'
form_name it_table1.
form_name it_table2.
form_name it_table3.
elseif cond4.
form_name it_table4.
endif.
Only disadvantage by using macro. within the loop you could not debug
aRs
2007 Sep 07 8:11 PM
Hi,
Please try this.
If <cond1>.
perform form_name tables it_table1.
elseif <cond2>.
perform form_name tables it_table2.
elseif <cond3>.
perform form_name tables it_table3.
elseif <cond4>.
perform form_name tables it_table4.
endif.
form form_name tables p_table.
loop at p_table.
...
endloop.
endform.
Regards,
Ferry Lianto
2007 Sep 07 8:29 PM
Hi,
This is one of the way. It uses field symbols.
For Eg:
PERFORM appl_upload USING gv_header 'gt_header[]'.
PERFORM appl_upload USING gv_header1 'gt_header1[]'.
PERFORM appl_upload USING gv_header2 'gt_header1[]'.
Here gt_header, gt_header1 and gt_header2 can have different structures. As you can see you are just passing the name of the table as a constant.
FORM appln_upload USING gv_header type ...
tabname type string.
FIELD SYMBOL: <tab> type any.
ASSIGN (tabname) to <tab>.
LOOP AT <tab>..."can do u r processing.....
ENDFORM.
So in the form as u can see, u pass the tabname to the fieldsymbol.
In this way you can use the same perform though the structurs used in it are different.
Sri
2007 Sep 07 9:18 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |