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

some problems about ALV

Former Member
0 Likes
289

hi everyone:

I have a problem about ALV. The question is I want to show two headers in the gt_item .(Hierachy)

I want to use these in the event "change_fieldcatlog"

LOOP AT I_FIELDCAT.

CASE I_FIELDCAT-FIELDNAME

WHEN 'MESSWERT'.

I_FIELDCAT-ROW_POS = 1.

I_FIELDCAT-SEL_L = '1111'.

I_FIELDCAT-SEL_M = '1111'.

I_FIELDCAT-SEL_S = '1111'.

APPEND I_FIELDCAT.

so I want to add another label in the next row. but I write like this below , it doesn't work .

I_FIELDCAT-ROW_POS = 2

I_FIELDCAT-SEL_L = text-004.

I_FIELDCAT-SEL_M = text-004.

I_FIELDCAT-SEL_S = text-004.

APPEND I_FIELDCAT

ENDCASE.

ENDLOOP.

So who can help me ?

thank you in advacne .

Regards

Nick

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
272

Hii Nick, in your program I found that you have created only one fieldcat structure, actually we need 2 structures one is for workarea and one for body.

like this

It_Fieldcat type SLIS_T_FIELDCAT_ALV

Is_Fieldcat type SLIS_FIELDCAT_ALV

now you can write the code

LOOP AT It_FIELDCAT into Is_Fieldcat.

CASE Is_FIELDCAT-FIELDNAME

WHEN 'MESSWERT'.

Is_FIELDCAT-ROW_POS = 1.

Is_FIELDCAT-SEL_L = '1111'.

Is_FIELDCAT-SEL_M = '1111'.

Is_FIELDCAT-SEL_S = '1111'.

APPEND Is_FIELDCAT to It_Fieldcat.

clear Is_Fieldcat.

Is_FIELDCAT-ROW_POS = 2

Is_FIELDCAT-SEL_L = text-004.

Is_FIELDCAT-SEL_M = text-004.

Is_FIELDCAT-SEL_S = text-004.

APPEND Is_FIELDCAT to It_Fieldcat.

Clear Is_Fieldcat.

Hope it will works.

Reward points if helpful.

1 REPLY 1
Read only

Former Member
0 Likes
273

Hii Nick, in your program I found that you have created only one fieldcat structure, actually we need 2 structures one is for workarea and one for body.

like this

It_Fieldcat type SLIS_T_FIELDCAT_ALV

Is_Fieldcat type SLIS_FIELDCAT_ALV

now you can write the code

LOOP AT It_FIELDCAT into Is_Fieldcat.

CASE Is_FIELDCAT-FIELDNAME

WHEN 'MESSWERT'.

Is_FIELDCAT-ROW_POS = 1.

Is_FIELDCAT-SEL_L = '1111'.

Is_FIELDCAT-SEL_M = '1111'.

Is_FIELDCAT-SEL_S = '1111'.

APPEND Is_FIELDCAT to It_Fieldcat.

clear Is_Fieldcat.

Is_FIELDCAT-ROW_POS = 2

Is_FIELDCAT-SEL_L = text-004.

Is_FIELDCAT-SEL_M = text-004.

Is_FIELDCAT-SEL_S = text-004.

APPEND Is_FIELDCAT to It_Fieldcat.

Clear Is_Fieldcat.

Hope it will works.

Reward points if helpful.