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 tree

Former Member
0 Kudos

Hi everyone..

I have one problem, please help me out.

scenario: first screen : selection screen

Second screen : list of data in ALV GRID format and in application bar there is Two buttons (1. Summery , 2. Detail)

Third screen : one container (to display data in tree format).

Problem:

After coming in third screen by pressing summery button if i do press expand all node button from toolbar and after this i am press back button, so i m coming into second screen. now from this screen in i want to display tree view by pressing any button. to do this i am pressing detail button, but in third screen it will display same output as displayed before for summery button. this problem is coming only if i do use any button from toolbar of alv tree. otherwise both the time data is coming as per expectation.

please help me in this and if you want any further explanation of problem then ask me.

Thanks,

Siddharth

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

This probaly is because in the secondary list.

You check for the control and then get the data some thing like this

If G_CONT is intiail.

Get data

Create Object

etc.

endif.

this condition fails.

hence always before leaving the second screen

Clear G_CONT.

santhosh

11 REPLIES 11

Former Member
0 Kudos

Hi,

This probaly is because in the secondary list.

You check for the control and then get the data some thing like this

If G_CONT is intiail.

Get data

Create Object

etc.

endif.

this condition fails.

hence always before leaving the second screen

Clear G_CONT.

santhosh

0 Kudos

In secondary list, I am creating objects again as i am clearing objects while pressing back button.

Former Member
0 Kudos

I do clear / free object by this code.

IF NOT G_ALV_TREE IS INITIAL.

CALL METHOD G_ALV_TREE->FREE.

IF SY-SUBRC NE 0.

MESSAGE I999(YMFA) WITH 'Error While Getting Free'.

ENDIF.

CLEAR G_ALV_TREE.

IF SY-SUBRC NE 0.

MESSAGE I999(YMFA) WITH 'Error While Getting Clear'.

ENDIF.

ENDIF.

WHILE G_CUSTOM_CONTAINER IS NOT INITIAL.

IF NOT G_CUSTOM_CONTAINER IS INITIAL.

CALL METHOD G_CUSTOM_CONTAINER->FREE.

IF SY-SUBRC NE 0.

MESSAGE I999(YMFA) WITH 'Error While Getting Free'.

ENDIF.

CLEAR G_CUSTOM_CONTAINER.

IF SY-SUBRC NE 0.

MESSAGE I999(YMFA) WITH 'Error While Getting Clear'.

ENDIF.

ENDIF.

ENDWHILE.

because of this code I am able to display both tables(summery and detail) one by one. But the problem is occur while i press the toolbar button like expand subtree or collapse subtree.

0 Kudos

G_ALV_TREE TYPE REF TO CL_GUI_ALV_TREE,

G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

0 Kudos

Hi,

How do you differentiate btw these to lists.

Case OK_CODE.

When 'L1'.

DATA1.

When 'L2'.

DATA2.

EndCase.

?????

if yes can you debug and check whats in the OK_CODE.

santhosh

0 Kudos

Hi Siddharth,

You have to call Expand_root_nodes method..

Please check this thread

and this thread too

Hope this would help you.

Good luck

Narin

0 Kudos

button code : SUMMERY or DETAIL

0 Kudos

Thats fine,

Can you debug and see if the OK_CODES are corect in case where you are having the problem

santhosh

0 Kudos

I think while pressing toolbar button from alv tree, there must some object may created which i need to free before using it again. but i dont know how?

0 Kudos

If anyone can not get my problem clearly then please ask, i'll explain....but please help me

Former Member
0 Kudos

yes Santhosh. it is correct. even whatever data i want to pass is also correct. for summery i am passing table for summery and for detail tree i have table for detail. problem is only coming if i use toolbar buttons. otherwise because of i am calling FREE method for both objects, output is coming correct.