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

Dynamic radio button selection

Former Member
0 Likes
766

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.

4 REPLIES 4
Read only

Former Member
0 Likes
729

Hi

you can use the field-symbols

Max

Read only

Former Member
0 Likes
729

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.

Read only

VenkatRamesh_V
Active Contributor
0 Likes
729

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.

Read only

Former Member
0 Likes
729

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.

  1. Endif.

*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

  1. Else.

Wa_Finalitab-f4 = wa_itab1-f4.

Wa_Finalitab-f5 = wa_itab1-f5.

Wa_Finalitab-f6 = wa_itab1-f6.

Append  Wa_Finalitab to Finalitab.

  1. Endif.
  2. Endloop.

*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[].

  1. Else.

Fetch data into itab2.

Finalitab[] = itab2[].

*call GRID Function module and pass the Finalitab to FM.

Thanks,

Nagalakshmi.