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: 

ALV using class

Former Member
0 Kudos
130

I hve radio button in selection screen . if i executet his prog by selecting any of this radio button it shuld go to alv list. here alv list using the concept of oop.

whether i need to add 2 screens to display this 2 ALV list.since the method to display the ALV is writing in PBO output of the screen.

is it possible to pass the internal table to same screen depends on the selection of radio button.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
95

Hi Anu,

yes u can use the same screen, in PBO Passthe internal table to the method used for creating alv, based on the radiobutton pressed.

for ex:

if p_r1 = 'X'.

call method with itab1.

elseif p_r2 = 'X'.

call method with itab1.

endif.

regards,

Navneeth K.

14 REPLIES 14

Former Member
0 Kudos
96

Hi Anu,

yes u can use the same screen, in PBO Passthe internal table to the method used for creating alv, based on the radiobutton pressed.

for ex:

if p_r1 = 'X'.

call method with itab1.

elseif p_r2 = 'X'.

call method with itab1.

endif.

regards,

Navneeth K.

0 Kudos
95

but wat im doing is

if p_r1 = c_x.

PERFORM fieldcatalog_init.

perform alv_grid_class.

elseif p_r2 = c_x.

endif.

perform alv_grid_class this perform will call screen 100. so PBO will call automatically. so how can i pass itab.

0 Kudos
95

Hi Anu,

Can you paste the code of your perform "alv_grid_class" here.

regards,

Navneeth K.

0 Kudos
95

FORM alv_grid_class .

CALL SCREEN 100.

ENDFORM. " alv_grid_class

0 Kudos
95

Hi Anu,

what u could do is declare the internal table used in the screen 100 as global so that any screen in that program can use it. Once the radiobutton is pressed populate the inetrnal table you are using during creation of ALV and then call the fieldcatalog & alv_grid_class methods.

regards,

Navneeth K.

0 Kudos
95

but in

MODULE PBO OUTPUT. (of the screen 100)

CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY

exporting

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

  • I_STRUCTURE_NAME =

  • IS_VARIANT =

I_SAVE = 'A'

  • I_DEFAULT = 'X'

IS_LAYOUT = gs_layout

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

IT_OUTTAB = t_output1[]

IT_FIELDCATALOG = w_gt_field

  • IT_SORT =

  • IT_FILTER =

  • EXCEPTIONS

  • INVALID_PARAMETER_COMBINATION = 1

  • PROGRAM_ERROR = 2

  • TOO_MANY_LINES = 3

  • others = 4

will call this method passing t_output1.

but for the next radiobutton internal table dat shuld pass to this method is t_output2.

can i pass internal table to module PBO output?

0 Kudos
95

Hi,

do like this.

CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY

exporting

I_SAVE = 'A'

IS_LAYOUT = gs_layout

CHANGING<b>

IT_OUTTAB = t_output1

IT_FIELDCATALOG = w_gt_field[]</b>.

rgds,

bharat.

0 Kudos
95

Hi Anu,

If the structure of t_output1 and t_output2 is same then create a common internal table say t_output_common and pass this to the method. Populate this method once the radio butoon is clicked.

for ex:

if p_r1 = 'X'.

<b>t_output_common[] = t_output1[].</b>

//cal performs as above

elseif p_r2 = 'X'.

<b>t_output_common[] = t_output2[].</b>

//cal performs as above

endif.

Message was edited by:

Navneeth Bothra

0 Kudos
95

NO itab structure is not same..

0 Kudos
95

ok then what u can do is call this method

GRID->SET_TABLE_FOR_FIRST_DISPLAY itself based on radiobutton selected.

capture which radiobutton selected in the first screen and store it in a variable and in the screen 100. use that variable to trigger this method.

0 Kudos
95

so based on radio button selected , will this GRID->SET_TABLE_FOR_FIRST_DISPLAY need to write twice??

0 Kudos
95

yes u need to write it twice with diff based on radio button selected. but will be triggered only one based on radiobutton.

0 Kudos
95

navneeth thx..

Former Member
0 Kudos
95

Hi,

see the system defined programs

BCALV_GRID_* and BCALV_EDIT_* programs to learn Object Oriented ALV(alv using class).

rgds,

bharat.