REPORT Z_TEST_COL_TO_ROW.
TYPE-POOLS: slis.
TABLES: mseg,mkpf.
DATA: gd_fieldcat TYPE slis_t_fieldcat_alv.
DATA: sla TYPE slis_layout_alv ,
ivariant LIKE disvariant,
i_repid LIKE sy-repid ,
i_excluding TYPE slis_t_extab.
TYPES: BEGIN OF ty_sum ,
werks LIKE mseg-werks ,
matnr LIKE mseg-matnr ,
lgort LIKE mseg-lgort ,
bwart LIKE mseg-bwart ,
menge LIKE mseg-menge ,
END OF ty_sum.
DATA : itab TYPE STANDARD TABLE OF ty_sum WITH HEADER LINE .
DATA : hs_sum TYPE HASHED TABLE OF ty_sum WITH UNIQUE KEY werks matnr lgort bwart WITH HEADER LINE .
DATA : itab_sum TYPE STANDARD TABLE OF ty_sum WITH HEADER LINE .
DATA: BEGIN OF itab_out OCCURS 0,
werks LIKE mseg-werks ,
matnr LIKE mseg-matnr ,
lgort LIKE mseg-lgort ,
menge01 TYPE i ,
menge02 TYPE i ,
menge03 TYPE i ,
menge04 TYPE i ,
menge05 TYPE i ,
menge06 TYPE i ,
menge07 TYPE i ,
menge08 TYPE i ,
menge09 TYPE i ,
menge10 TYPE i ,
menge11 TYPE i ,
menge12 TYPE i ,
menge13 TYPE i ,
menge14 TYPE i ,
menge15 TYPE i ,
menge16 TYPE i ,
menge17 TYPE i ,
menge18 TYPE i ,
menge19 TYPE i ,
menge20 TYPE i ,
menge21 TYPE i ,
menge22 TYPE i ,
menge23 TYPE i ,
menge24 TYPE i ,
menge25 TYPE i ,
menge26 TYPE i ,
line_sum TYPE i ,
END OF itab_out.
TYPES: BEGIN OF ty_bwart ,
bwart LIKE mseg-bwart ,
END OF ty_bwart.
DATA : hs_bwart TYPE HASHED TABLE OF ty_bwart WITH UNIQUE KEY bwart WITH HEADER LINE .
DATA : itab_bwart TYPE STANDARD TABLE OF ty_bwart WITH HEADER LINE .
FIELD-SYMBOLS: <f_fs1> ,
<f_fs2>.
DATA: max_count TYPE i .
SELECT-OPTIONS:
s_mblnr FOR mseg-mblnr ,
s_budat FOR mkpf-budat .
PARAMETERS: p_sum AS CHECKBOX .
START-OF-SELECTION.
PERFORM getdata.
PERFORM fixdata.
IF p_sum = 'X'.
PERFORM outdata