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 report

Former Member
0 Kudos

Hi,

how to divide one column into subrows in output of ALV. For example below column name: Catagory , we r having number of sub rows like Basicpay, NI, pension, Healthbenifit ect. Can any one reply to this pls.

Thanks & Regards,

Moderator message: please choose more descriptive subject lines for your posts.

Edited by: Thomas Zloch on Nov 4, 2011 11:27 PM

4 REPLIES 4

Former Member
0 Kudos

hi Bheema Thulasi ,

I don't think so it is possible but you can use write statement to achieve that. We have the same problem over there as well we used the write statement to achieve this.

Regards,

0 Kudos

HI,

wafieldcat-col_pos = 4 .

wafieldcat-fieldname = 'CATEGORY'.

wafieldcat-seltext_l = 'CATAGORY'.

APPEND wafieldcat TO fieldcat.

CLEAR wafieldcat.

i am trying to add sub rows Basicpay , pension ,healthbenifits below Catagory.

Can i know Where I have to use write statement for this.

Thanks .

Former Member
0 Kudos

Hi,

FM 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' will work for you i think. You have to fill two internal tables; header and item. Then create a relation with keyinfo.

Çağatay

naresh_bammidi
Contributor
0 Kudos

Hi Tulasi ,

here you have to delete the standard column headings and use write statement print column headings as per your requirement.

here is the sample code.

TYPE-POOLS:SLIS.

DATA:BEGIN OF TS_TEST OCCURS 0,
     MATNR TYPE MARA-MATNR,
     ERSDA TYPE MARA-ERSDA,
     ERNAM TYPE MARA-ERNAM,
     PSTAT TYPE MARA-PSTAT,
     END OF TS_TEST.

DATA:TS_FIELDCAT TYPE  SLIS_T_FIELDCAT_ALV.
DATA:E_FC TYPE SLIS_FIELDCAT_ALV.
DATA:Alv_Layout TYPE SLIS_LAYOUT_ALV .
 DATA:it_evt TYPE slis_t_event.
 DATA:wa_evt TYPE slis_alv_event .

READ TABLE it_evt INTO wa_evt
       WITH KEY name = slis_ev_after_line_output .
  wa_evt-form = slis_ev_after_line_output .
  MODIFY it_evt FROM wa_evt INDEX sy-tabix .

  READ TABLE it_evt INTO wa_evt
       WITH KEY name = slis_ev_top_of_page .
  wa_evt-form = slis_ev_top_of_page .
  MODIFY it_evt FROM wa_evt INDEX sy-tabix .


  PERFORM F_BUILD_FC USING 'MATNR' 'MATERIAL NUMBER'.
  PERFORM F_BUILD_FC USING 'ERSDA' 'DATE CREATED ON'.
  PERFORM F_BUILD_FC USING 'ERNAM' 'MATERIAL NAME'.
  PERFORM F_BUILD_FC USING 'PSTAT' 'STATUS'.

" here we are deleting the standard column heading.
ALV_LAYOUT-no_colhead = 'X'.

 TOP-OF-PAGE.
 ULINE AT 1(45) .

 END-OF-SELECTION.

  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
   EXPORTING
     I_CALLBACK_PROGRAM             = sy-repid
IS_LAYOUT                      = ALV_LAYOUT
     IT_FIELDCAT                    = TS_FIELDCAT
I_SAVE                         = 'A'
IT_EVENTS                      = IT_EVT
TABLES
      T_OUTTAB                       = TS_TEST

  FORM top_of_page .

"Uline for creating a horizontal line

ULINE AT 1(45) .

"Format color for header background

FORMAT COLOR 7 .
"This is where we manually create the header text,
"in this example I'm using 2 lines header, if you
"want to have 3 lines header or more, you can just
"add new write command.

*WRITE: / sy-vline , 02 'material number',
*23 SY-VLINE, 25 'PLANE & SEATS MAX', 45 SY-VLINE.
*
*WRITE: / sy-vline , 02 'type' ,12 sy-vline, 14 'desc',
*23 SY-VLINE, 25 'PLANE ', 34 SY-VLINE, 36 'SEATS MAX', 45 SY-VLINE.

write:/ sy-vline,02 'Material Number',sy-vline.
uline.

write:/ sy-vline,02 'type',sy-vline,09 'desc',sy-vline.

ENDFORM.

*&---------------------------------------------------------------------*
*&      Form  F_BUILD_FC
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_FN       text
*      -->P_VAL      text
*----------------------------------------------------------------------*
FORM F_BUILD_FC USING P_FN P_VAL.

  E_FC-FIELDNAME = P_FN.
  E_FC-SELTEXT_L = P_VAL.

  APPEND E_FC TO TS_FIELDCAT.
  CLEAR E_FC.

ENDFORM.                    "F_BUILD_FC.

Edited by: naresh bammidi on Nov 10, 2011 2:21 PM