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 query

Former Member
0 Kudos

In ALV display it's require to print two (ColumnHeading)header row.Let say

In first row it will show |Allowance |

In second |HRA |PA | OTHERS|

Please suggest how to do that?

Regards,

Mini

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi kiran,

At the time of prepare fieldcat you can say the colomn position and row position for a field display in output.

So at the time of prepare field cat you should say colomn 1 and row 2 for HRA and col 2 & row 2 for PA like that.

Cheers,

Bujji.

4 REPLIES 4

Former Member
0 Kudos

Hi kiran,

At the time of prepare fieldcat you can say the colomn position and row position for a field display in output.

So at the time of prepare field cat you should say colomn 1 and row 2 for HRA and col 2 & row 2 for PA like that.

Cheers,

Bujji.

naimesh_patel
Active Contributor
0 Kudos

Hello,

In field catalog,

ST_FIELDCAT-ROW_POS = '2'.

for the second row headings.

It is applicable to only LIST display.

Regards,

Naimesh

0 Kudos

you can not do that in an ALV grid but do in ALV list

example in alv list...

DATA: ET_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

EL_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

ES_LAYOUT TYPE SLIS_LAYOUT_ALV.

DATA: OUTPUTLEN LIKE DD03P-OUTPUTLEN,

POS TYPE I,

LENGHT TYPE I.

DATA TITLE(10).

CALL FUNCTION 'REUSE_ALV_LIST_LAYOUT_INFO_GET'

IMPORTING

ES_LAYOUT = ES_LAYOUT

ET_FIELDCAT = ET_FIELDCAT.

LOOP AT ET_FIELDCAT INTO EL_FIELDCAT

NO_OUT = SPACE.

EXIT.

ENDLOOP.

CHECK SY-SUBRC = 0.

FORMAT COLOR COL_HEADING.

WRITE: / SY-ULINE,

/ SY-VLINE.

OUTPUTLEN = 3.

LOOP AT ET_FIELDCAT INTO EL_FIELDCAT WHERE NO_OUT = SPACE.

IF EL_FIELDCAT-FIELDNAME = 'USER_FIELD_1' OR

EL_FIELDCAT-FIELDNAME = 'USER_FIELD_2'.

POS = OUTPUTLEN + 1.

IF EL_FIELDCAT-FIELDNAME = 'USER_FIELD_1'.

TITLE = 'Documento'.

ELSE.

TITLE = 'Anno doc.'.

ENDIF.

LENGHT = EL_FIELDCAT-OUTPUTLEN.

IF LENGHT > 10. LENGHT = 10. ENDIF.

WRITE AT POS TITLE(LENGHT).

ENDIF.

IF ES_LAYOUT-NO_VLINE = 'X'.

OUTPUTLEN = EL_FIELDCAT-OUTPUTLEN + OUTPUTLEN + 1.

ELSE.

OUTPUTLEN = EL_FIELDCAT-OUTPUTLEN + OUTPUTLEN + 1.

WRITE: AT OUTPUTLEN SY-VLINE NO-GAP.

ENDIF.

ENDLOOP.

FORMAT COLOR OFF.

Former Member
0 Kudos

Hi,

Its not possible to have two headings in ALV, unless you maintain one heading row as the data itself. This will fail when the user tries to sort the data.

Even then you cannot merge columns, for the TOP heading.

Regards,

Ravi

Note : Please close the thread if the question is answered and mark all the helpful answers