2007 Mar 12 7:38 AM
hi
i have developed alv and in that i am displaying field names at the top and field values at the bottom.
my question is: i want 2 more fields header at the top i.e. above field names.
-
mat info | mat value
-
matno | plant | mattype | storageloc | value | quantity
-
here values are displayed.
-
in the above alv output matinfo and mat value are extra fields which are above
field name.
how can i bring these 2 fields above fields names in alv..
thanx
rocky
2007 Mar 12 7:45 AM
rocky,
u can try Hierarchical alv for ur requirement.
Use the fm reuse_alv_hierseq_list_display in the program.
Regards...
Arun.
Reward points if useful.
2007 Mar 12 7:52 AM
hi
those 2 fields are not value fields, those are just headers text
rather those two are text i want to add in alv in box above names of fields.
thanx
rocky
2007 Mar 12 8:09 AM
<b>try this one</b>
In your Function Module REUSE_ALV_GRID_DISPLAY, pass 'TOP-OF-PAGE' in the interface of the Function Module.
Step 1.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
<b>i_callback_top_of_page = 'TOP-OF-PAGE'</b>
<b>is_layout = gd_layout</b>
it_fieldcat = fieldcatalog[]
i_save = 'X'
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
Step 2.
Declare a internal table type slis_t_listheader and fill it with your desired heading. as in the routine below:
FORM top_of_page. "#EC CALLED
wa_listheader-typ = 'H'.
wa_listheader-info = sy-title.
<b>APPEND wa_listheader TO i_listheader.</b>
CLEAR wa_listheader.
wa_listheader-typ = 'S'.
wa_listheader-key = text-002.
wa_listheader-info = l_date.
<b>APPEND wa_listheader TO i_listheader.</b>
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
<b>it_list_commentary = i_listheader.</b>
ENDFORM.
regards
vijay pawar
2007 Mar 12 8:11 AM
hi
<b>wa_listheader-info = l_date.</b>
u may give the fields names in list header info
u can attach as many as possible and append into list header
2007 Mar 12 8:02 AM
Hi,
Herewith i am attaching Hierarchical alv test report.
Kindly go through it.
REPORT YMS_HIERALVTEST.
TABLES : EKKO ,EKPO.
TYPE-POOLS SLIS.
DATA GS_KEYINFO TYPE SLIS_KEYINFO_ALV.
DATA : BEGIN OF WA_EKKO.
INCLUDE STRUCTURE EKKO.
DATA : EXPAND,
LIGHTS,
BOX,
END OF WA_EKKO.
DATA: IT_EKKO LIKE TABLE OF WA_EKKO WITH HEADER LINE,
IT_EKPO LIKE TABLE OF EKPO WITH HEADER LINE,
WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
CLEAR GS_KEYINFO.
GS_KEYINFO-HEADER01 = 'EBELN'.
GS_KEYINFO-ITEM01 = 'EBELN'.
WA_LAYOUT-EXPAND_FIELDNAME = 'EXPAND'.
WA_LAYOUT-LIGHTS_FIELDNAME = 'LIGHTS'.
WA_LAYOUT-LIGHTS_TABNAME = 'IT_EKKO'.
SELECT *
FROM EKKO
INTO CORRESPONDING FIELDS
OF TABLE IT_EKKO
WHERE FRGKE IN ('C','1','R')
AND BSTYP = 'A' .
SELECT *
FROM EKPO
INTO CORRESPONDING FIELDS
OF TABLE IT_EKPO.
PERFORM FILL_LIGHTS.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
IS_LAYOUT = WA_LAYOUT
I_TABNAME_HEADER = 'IT_EKKO'
I_TABNAME_ITEM = 'IT_EKPO'
I_STRUCTURE_NAME_HEADER = 'EKKO'
I_STRUCTURE_NAME_ITEM = 'EKPO'
IS_KEYINFO = GS_KEYINFO
TABLES
T_OUTTAB_HEADER = IT_EKKO
T_OUTTAB_ITEM = IT_EKPO
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
CASE SY-SUBRC.
WHEN '1'.
MESSAGE I000(AT) WITH 'PROGRAM ERROR'.
WHEN '2'.
MESSAGE I001(AT) WITH 'ERROR UNKNOWN'.
ENDCASE.
ENDIF.
&----
*& Form FILL_LIGHTS
&----
text
----
FORM FILL_LIGHTS.
LOOP AT IT_EKKO.
IF IT_EKKO-FRGKE = 'C'.
IT_EKKO-LIGHTS = '1'.
ELSEIF IT_EKKO-FRGKE = '1'.
IT_EKKO-LIGHTS = '2'.
ELSEIF IT_EKKO-FRGKE = 'R'.
IT_EKKO-LIGHTS = '3'.
ENDIF.
MODIFY IT_EKKO INDEX SY-TABIX.
ENDLOOP.
ENDFORM. "FILL_LIGHTS
Thanks,
Shankar