2014 Sep 26 10:24 PM
HI Experts,
I have one requirement i.e I have two radio buttons and two internal tables in the prorgram.
I have to pass this internal tables based on the radio button selection as follows.
if rad1 = 'X'.
then i have to pass first internal table to the grid function module.
else.
second internal table.
but here i have to use the grid function module only one time and based on radio button selection
i have to pass appropriate internal table to the function module.plz suggest me some solution.
thanks.
HI Experts,
I have one requirement i.e I have two radio buttons and two internal tables in the prorgram.
I have to pass this internal tables based on the radio button selection as follows.
if rad1 = 'X'.
then i have to pass first internal table to the grid function module.
else.
second internal table.
but here i have to use the grid function module only one time and based on radio button selection
i have to pass appropriate internal table to the function module.plz suggest me some solution.
thanks.
2014 Sep 26 10:36 PM
2014 Sep 27 2:48 AM
Sivakumar,
Max have made the correct suggestion, field-symbols will solve your problem.
DATA: gt_table1 TYPE STANDARD TABLE OF mara,
gt_table2 TYPE STANDARD TABLE OF mseg.
FIELD-SYMBOLS: <fs_table> TYPE any table.
CASE 'X'.
WHEN rad1.
ASSIGN gt_table1 TO <fs_table>.
WHEN rad2.
ASSIGN gt_table2 TO <fs_table>.
ENDCASE.
* now use <fs_table> as datatable to your function module.
2014 Sep 27 5:42 AM
Hi Sivakumar,
hope it help full.
FIELD-SYMBOLS: <table> TYPE ANY TABLE.
IF NOT r1 IS INITIAL.
ASSIGN it_dis to <table>.
ELSE.
ASSIGN it_sum to <table>.
ENDIF.
Regards,
Venkat.
2014 Sep 27 6:08 AM
Hello Sivakumar,
Hope below mentioned logic is help full to you.
Case1: Two itabs are different structures.
If you want to pass two internal tables to same grid function module based on radio button selection. U can take final internal table (having fields from itab1 and itab2) and fill field catalogue for the final internal table first. And then please follow the below logic.
EX:
Itab1—f1,f2,f3
Itab3---f4,f5,f6
Finalitab—f1,f2,f3,f4,f5,f6
1) fetch data into itab1.
2) fetch data into Itab2.
*filling final internal table data
As Per your requirement u can loop which Itab u want.
Loop at itab1 into wa_itab1.
Read itab2 into wa_itab2 with key keyfield = wa_itab1-keyfield.
If rad1 = ‘X’.
Wa_Finalitab-f1 = wa_itab1-f1.
Wa_Finalitab-f2 = wa_itab1-f2.
Wa_Finalitab-f3 = wa_itab1-f3.
Append Wa_Finalitab to Finalitab.
Clear: Finalitab
Wa_Finalitab-f4 = wa_itab1-f4.
Wa_Finalitab-f5 = wa_itab1-f5.
Wa_Finalitab-f6 = wa_itab1-f6.
Append Wa_Finalitab to Finalitab.
*call GRID Function module and pass the Finalitab to FM.
Case2: Two itabs are similar structures.
Just take final internal table similar to itab1 and itab2.
Fill field catalog for final itab.
Ex:
Itab1-f1,f2,f3
Itab2-f1,f2,f3
finalitab-f1,f2,f3
if rad1 = ‘X’.
fect data into itab1.
Finalitab[] = itab1[].
Fetch data into itab2.
Finalitab[] = itab2[].
*call GRID Function module and pass the Finalitab to FM.
Thanks,
Nagalakshmi.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |