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

different data with another structure in ALV

Former Member
0 Likes
498

Hello everyone,

I'm having trouble with my ALV grid.

In my functiongroup i have a screen, in the PAI of that screen i have 3 flagvariables to display 3 different types of data.

In my PBO i check those flags and display the desired data.

Now, in each if statement i have:

IF container IS INITIAL.

CREATE OBJECT container

EXPORTING

container_name = 'CONTROL_AREA'.

CREATE OBJECT grid

EXPORTING

i_parent = container.

  • get fieldcatalog

PERFORM create_workitem_fieldcatalog.

CALL METHOD grid->set_table_for_first_display

EXPORTING

i_default = 'X'

CHANGING

it_outtab = lt_wrkitm

it_fieldcatalog = lt_fieldcat

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4.

IF sy-subrc <> 0.

ENDIF.

ELSE.

CALL METHOD grid->refresh_table_display.

ENDIF.

Now, my question is: is it possible to change the data and fieldcatalog in the alv during runtime.

I have twice the same structure, so that ain't the problem. But the third one has another structure and another fieldcatalog.

When i run the program, all the code works fine, but the output is still the initial one.

I tried to FREE container and grid and create a new alv to display the third option, still no luck.

I will give another overview of the problem.

Situation A: (1 and 2 has the same structure)

Option 1

option 2

option 3

chosing 1: display correct data

chosing 2: display correct data

chosing 3: display data of option 2

chosing 1:display correct data

Situation B: : (1 and 2 has the same structure)

Option 1

option 2

option 3

chosing 3: display correct data

chosing 2: display data of option 3

chosing 1: display data of option 3.

Hope you understand my problem and you're able to help me.

Greetings

Merijn.

Hello everyone,

I'm having trouble with my ALV grid.

In my functiongroup i have a screen, in the PAI of that screen i have 3 flagvariables to display 3 different types of data.

In my PBO i check those flags and display the desired data.

Now, in each if statement i have:

IF container IS INITIAL.

CREATE OBJECT container

EXPORTING

container_name = 'CONTROL_AREA'.

CREATE OBJECT grid

EXPORTING

i_parent = container.

  • get fieldcatalog

PERFORM create_workitem_fieldcatalog.

CALL METHOD grid->set_table_for_first_display

EXPORTING

i_default = 'X'

CHANGING

it_outtab = lt_wrkitm

it_fieldcatalog = lt_fieldcat

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4.

IF sy-subrc <> 0.

ENDIF.

ELSE.

CALL METHOD grid->refresh_table_display.

ENDIF.

Now, my question is: is it possible to change the data and fieldcatalog in the alv during runtime.

I have twice the same structure, so that ain't the problem. But the third one has another structure and another fieldcatalog.

When i run the program, all the code works fine, but the output is still the initial one.

I tried to FREE container and grid and create a new alv to display the third option, still no luck.

I will give another overview of the problem.

Situation A: (1 and 2 has the same structure)

Option 1

option 2

option 3

chosing 1: display correct data

chosing 2: display correct data

chosing 3: display data of option 2

chosing 1:display correct data

Situation B: : (1 and 2 has the same structure)

Option 1

option 2

option 3

chosing 3: display correct data

chosing 2: display data of option 3

chosing 1: display data of option 3.

Hope you understand my problem and you're able to help me.

Greetings

Merijn.

2 REPLIES 2
Read only

Former Member
0 Likes
441

Hi,

i think we need ot create the field catalog also dynamically depending on the selections.

thanks,

teja.

Read only

0 Likes
441

Well, I found the solution...

I just didn't use the grid->refresh_table_display.

So i created the container and the grid object once and just used the set_table_for_first_display whenever i wanted to display the alv.

Hopefully my solution can help others.

Thanks anyway Teja