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: 

Merge is not working in ALV_BLOCK_LIST_APPEND

0 Kudos
DATA : GV_KUNRG TYPE KUNRG,
GV_FKART TYPE FKART,
GV_FKDAT TYPE FKDAT,
GV_WERKS TYPE WERKS_D,
GV_MATNR TYPE MATNR.

SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME TITLE TEXT-000.
SELECT-OPTIONS : S_KUNRG FOR GV_KUNRG,
S_FKART FOR GV_FKART,
S_FKDAT FOR GV_FKDAT,
S_WERKS FOR GV_WERKS,
S_MATNR FOR GV_MATNR.
SELECTION-SCREEN END OF BLOCK B.

TYPES : BEGIN OF TY_KUN,
KUNNR TYPE KUNNR,
NAME1 TYPE NAME1,
FKIMG TYPE FKIMG,
NETWR TYPE NETWR,
END OF TY_KUN,

BEGIN OF TY_MAT,
MATNR TYPE MATNR,
ARKTX TYPE ARKTX,
FKIMG TYPE FKIMG,
NETWR TYPE NETWR,
END OF TY_MAT,

BEGIN OF TY_DIV,
SPART TYPE SPART,
VTEXT TYPE VTEXT,
FKIMG TYPE FKIMG,
NETWR TYPE NETWR,
END OF TY_DIV,

BEGIN OF TY_VBRK_VBRP,
VBELN TYPE VBELN,
KUNRG TYPE KUNRG,
MATNR TYPE MATNR,
ARKTX TYPE ARKTX,
FKIMG TYPE FKIMG,
NETWR TYPE NETWR,
SPART TYPE SPART,
END OF TY_VBRK_VBRP,

BEGIN OF TY_TSPAT,
SPART TYPE SPART,
VTEXT TYPE VTEXT,
END OF TY_TSPAT,

BEGIN OF TY_KNA1,
KUNNR TYPE KUNNR,
NAME1 TYPE NAME1,
END OF TY_KNA1,

BEGIN OF TY_FINAL,
KUNNR TYPE KUNNR,
NAME1 TYPE NAME1,
MATNR TYPE MATNR,
ARKTX TYPE ARKTX,
SPART TYPE SPART,
VTEXT TYPE VTEXT,
FKIMG TYPE FKIMG,
NETWR TYPE NETWR,
END OF TY_FINAL.


DATA : IT_KNA1 TYPE TABLE OF TY_KNA1,
IT_VBRK_VBRP TYPE TABLE OF TY_VBRK_VBRP,
IT_KUN TYPE TABLE OF TY_KUN,
IT_MAT TYPE TABLE OF TY_MAT,
IT_DIV TYPE TABLE OF TY_DIV,
IT_FINAL TYPE TABLE OF TY_FINAL,
IT_TSPAT TYPE TABLE OF TY_TSPAT,
WA_KUN TYPE TY_KUN,
WA_MAT TYPE TY_MAT,
WA_DIV TYPE TY_DIV,
WA_FINAL TYPE TY_FINAL,
IT_KUN_SORT TYPE TABLE OF TY_KUN,
IT_MAT_SORT TYPE TABLE OF TY_MAT,
IT_DIV_SORT TYPE TABLE OF TY_DIV,
WA_KUN_SORT TYPE TY_KUN,
WA_MAT_SORT TYPE TY_MAT,
WA_DIV_SORT TYPE TY_DIV.



DATA : IT_FCAT_KUN TYPE SLIS_T_FIELDCAT_ALV,
IT_FCAT_MAT TYPE SLIS_T_FIELDCAT_ALV,
IT_FCAT_DIV TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT TYPE SLIS_FIELDCAT_ALV,
IT_EVENT_KUN TYPE SLIS_T_EVENT,
IT_EVENT_MAT TYPE SLIS_T_EVENT,
IT_EVENT_DIV TYPE SLIS_T_EVENT,
WA_EVENT TYPE SLIS_ALV_EVENT,
WA_LAYOUT_kun TYPE SLIS_LAYOUT_ALV,
WA_LAYOUT_mat TYPE SLIS_LAYOUT_ALV,
WA_LAYOUT_div TYPE SLIS_LAYOUT_ALV,
WA_SORT TYPE SLIS_SORTINFO_ALV,
IT_SORT_KUN TYPE SLIS_T_SORTINFO_ALV,
IT_SORT_MAT TYPE SLIS_T_SORTINFO_ALV,
IT_SORT_DIV TYPE SLIS_T_SORTINFO_ALV,
WA_MERGE TYPE LVC_S_SORT,
IT_MERGE_KUN TYPE TABLE OF LVC_S_SORT,
IT_MERGE_MAT TYPE TABLE OF LVC_S_SORT,
IT_MERGE_DIV TYPE TABLE OF LVC_S_SORT.


CONSTANTS : GC_KUNNR TYPE SLIS_FIELDNAME VALUE 'KUNNR',
GC_NAME1 TYPE SLIS_FIELDNAME VALUE 'NAME1',
GC_SPART TYPE SLIS_FIELDNAME VALUE 'SPART',
GC_VTEXT TYPE SLIS_FIELDNAME VALUE 'VTEXT',
GC_MATNR TYPE SLIS_FIELDNAME VALUE 'MATNR',
GC_ARKTX TYPE SLIS_FIELDNAME VALUE 'ARKTX',
GC_FKIMG TYPE SLIS_FIELDNAME VALUE 'FKIMG',
GC_NETWR TYPE SLIS_FIELDNAME VALUE 'NETWR'.

PERFORM GET_KNA1.
PERFORM GET_VBRK.
PERFORM GET_TSPAT.
PERFORM SET_FINAL.
PERFORM SET_KUN.
PERFORM SET_MAT.
PERFORM SET_DIV.
PERFORM SET_FCAT.
PERFORM SET_LAYOUT.
PERFORM SET_EVENTS.
PERFORM SET_SORT.
PERFORM SET_MERGE.
PERFORM ALV_BLOCK_INIT.
PERFORM ALV_BLOCK_APPEND USING 'IT_KUN' WA_LAYOUT_KUN IT_FCAT_KUN IT_EVENT_KUN IT_KUN IT_SORT_KUN." IT_MERGE_KUN.
PERFORM ALV_BLOCK_APPEND USING 'IT_MAT' WA_LAYOUT_MAT IT_FCAT_MAT IT_EVENT_MAT IT_MAT IT_SORT_MAT." IT_MERGE_MAT.
PERFORM ALV_BLOCK_APPEND USING 'IT_DIV' WA_LAYOUT_DIV IT_FCAT_DIV IT_EVENT_DIV IT_DIV IT_SORT_DIV." IT_MERGE_DIV.
PERFORM ALV_BLOCK_DISPLAY.


FORM GET_KNA1.
SELECT KUNNR NAME1 FROM KNA1 INTO TABLE IT_KNA1 WHERE KUNNR IN S_KUNRG.
IF SY-SUBRC NE 0.
MESSAGE TEXT-001 TYPE 'E'.
ENDIF.
ENDFORM.

FORM GET_VBRK.
SELECT VBRK~VBELN KUNRG MATNR ARKTX FKIMG VBRK~NETWR VBRP~SPART INTO TABLE IT_VBRK_VBRP FROM VBRK INNER JOIN VBRP
ON VBRK~VBELN = VBRP~VBELN
WHERE FKART IN S_FKART
AND KUNRG IN S_KUNRG
AND FKDAT IN S_FKDAT
AND MATNR IN S_MATNR
AND VBRP~WERKS IN S_WERKS.
ENDFORM.

FORM GET_TSPAT.
SELECT SPART VTEXT INTO TABLE IT_TSPAT FROM TSPAT FOR ALL ENTRIES IN IT_VBRK_VBRP
WHERE SPART = IT_VBRK_VBRP-SPART
AND SPRAS = SY-LANGU.
ENDFORM.

FORM SET_FINAL.

LOOP AT IT_VBRK_VBRP ASSIGNING FIELD-SYMBOL(<FS_VBRK_VBRP>).
IF <FS_VBRK_VBRP> IS ASSIGNED.
WA_FINAL-MATNR = <FS_VBRK_VBRP>-MATNR.
WA_FINAL-FKIMG = <FS_VBRK_VBRP>-FKIMG.
WA_FINAL-NETWR = <FS_VBRK_VBRP>-NETWR.
WA_FINAL-ARKTX = <FS_VBRK_VBRP>-ARKTX.
WA_FINAL-KUNNR = <FS_VBRK_VBRP>-KUNRG.
WA_FINAL-SPART = <FS_VBRK_VBRP>-SPART.
ENDIF.
READ TABLE IT_KNA1 ASSIGNING FIELD-SYMBOL(<FS_KNA1>) WITH KEY KUNNR = <FS_VBRK_VBRP>-KUNRG.
IF <FS_KNA1> IS ASSIGNED.
WA_FINAL-NAME1 = <FS_KNA1>-NAME1.
ENDIF.
READ TABLE IT_TSPAT ASSIGNING FIELD-SYMBOL(<FS_TSPAT>) WITH KEY SPART = <FS_VBRK_VBRP>-SPART.
IF <FS_TSPAT> IS ASSIGNED.
WA_FINAL-VTEXT = <FS_TSPAT>-VTEXT.
ENDIF.
APPEND WA_FINAL TO IT_FINAL.
CLEAR WA_FINAL.
ENDLOOP.
ENDFORM.

FORM SET_KUN.
LOOP AT IT_FINAL INTO WA_FINAL.
IF WA_FINAL IS NOT INITIAL.
WA_KUN_SORT-KUNNR = WA_FINAL-KUNNR.
WA_KUN_SORT-NAME1 = WA_FINAL-NAME1.
WA_KUN_SORT-FKIMG = WA_FINAL-FKIMG.
WA_KUN_SORT-NETWR = WA_FINAL-NETWR.
APPEND WA_KUN_SORT TO IT_KUN_SORT.
CLEAR WA_KUN_SORT.
ENDIF.
ENDLOOP.

SORT IT_KUN_SORT BY KUNNR.

LOOP AT IT_KUN_SORT ASSIGNING FIELD-SYMBOL(<FS_KUN_SORT>).

* AT NEW KUNNR.
WA_KUN-KUNNR = <FS_KUN_SORT>-KUNNR.
WA_KUN-NAME1 = <FS_KUN_SORT>-NAME1.
* ENDAT.
* WA_KUN-NAME1 = <FS_KUN_SORT>-NAME1.
WA_KUN-FKIMG = <FS_KUN_SORT>-FKIMG.
WA_KUN-NETWR = <FS_KUN_SORT>-NETWR.
APPEND WA_KUN TO IT_KUN.
CLEAR WA_KUN.

ENDLOOP.

ENDFORM.

FORM SET_MAT.

LOOP AT IT_FINAL INTO WA_FINAL.
IF WA_FINAL IS NOT INITIAL AND WA_FINAL-MATNR IS NOT INITIAL.
WA_MAT_SORT-MATNR = WA_FINAL-MATNR.
WA_MAT_SORT-ARKTX = WA_FINAL-ARKTX.
WA_MAT_SORT-FKIMG = WA_FINAL-FKIMG.
WA_MAT_SORT-NETWR = WA_FINAL-NETWR.
APPEND WA_MAT_SORT TO IT_MAT_SORT.
CLEAR WA_MAT_SORT.
ENDIF.
ENDLOOP.
SORT IT_MAT_SORT BY MATNR.

LOOP AT IT_MAT_SORT ASSIGNING FIELD-SYMBOL(<FS_MAT_SORT>).
* AT NEW MATNR.
WA_MAT-MATNR = <FS_MAT_SORT>-MATNR.
WA_MAT-ARKTX = <FS_MAT_SORT>-ARKTX.
* ENDAT.
WA_MAT-FKIMG = <FS_MAT_SORT>-FKIMG.
WA_MAT-NETWR = <FS_MAT_SORT>-NETWR.
APPEND WA_MAT TO IT_MAT.
CLEAR WA_MAT.

ENDLOOP.

ENDFORM.

FORM SET_DIV.

LOOP AT IT_FINAL INTO WA_FINAL.
IF WA_FINAL IS NOT INITIAL.
WA_DIV_SORT-SPART = WA_FINAL-SPART.
WA_DIV_SORT-VTEXT = WA_FINAL-VTEXT.
WA_DIV_SORT-FKIMG = WA_FINAL-FKIMG.
WA_DIV_SORT-NETWR = WA_FINAL-NETWR.
APPEND WA_DIV_SORT TO IT_DIV_SORT.
CLEAR WA_DIV_SORT.
ENDIF.
ENDLOOP.
SORT IT_DIV_SORT BY SPART.

LOOP AT IT_DIV_SORT ASSIGNING FIELD-SYMBOL(<FS_DIV_SORT>).


* AT NEW SPART.
WA_DIV-SPART = <FS_DIV_SORT>-SPART.
WA_DIV-VTEXT = <FS_DIV_SORT>-VTEXT.
* ENDAT.
WA_DIV-FKIMG = <FS_DIV_SORT>-FKIMG.
WA_DIV-NETWR = <FS_DIV_SORT>-NETWR.
APPEND WA_DIV TO IT_DIV.
CLEAR WA_DIV.
ENDLOOP.
ENDFORM.

FORM SET_FCAT.

WA_FCAT-FIELDNAME = GC_KUNNR.
WA_FCAT-SELTEXT_L = TEXT-003.
WA_FCAT-REPTEXT_DDIC = 'Customer Number'.
WA_FCAT-EDIT = ABAP_FALSE.
* WA_FCAT-DO_SUM = ABAP_FALSE.
* WA_FCAT-EMPHASIZE = ABAP_TRUE.

APPEND WA_FCAT TO IT_FCAT_KUN.
CLEAR WA_FCAT.

WA_FCAT-FIELDNAME = GC_NAME1.
WA_FCAT-SELTEXT_L = TEXT-004.
WA_FCAT-REPTEXT_DDIC = 'Customer Name'.
WA_FCAT-TABNAME = 'IT_KUN'.
WA_FCAT-EDIT = ABAP_FALSE.
* WA_FCAT-DATATYPE = 'CHAR'.
* WA_FCAT-DO_SUM = ABAP_FALSE.
* WA_FCAT-EMPHASIZE = ABAP_TRUE.

APPEND WA_FCAT TO IT_FCAT_KUN.
CLEAR WA_FCAT.

WA_FCAT-FIELDNAME = GC_FKIMG.
WA_FCAT-SELTEXT_L = TEXT-005.
WA_FCAT-DO_SUM = ABAP_TRUE.
WA_FCAT-EDIT = ABAP_FALSE.
WA_FCAT-DATATYPE = 'QUAN'. "or 'CURR'
* WA_FCAT-EMPHASIZE = ABAP_TRUE.

APPEND WA_FCAT TO IT_FCAT_KUN.
CLEAR WA_FCAT.

WA_FCAT-FIELDNAME = GC_NETWR.
WA_FCAT-SELTEXT_L = TEXT-006.
WA_FCAT-DO_SUM = ABAP_TRUE.
WA_FCAT-EDIT = ABAP_FALSE.
WA_FCAT-DATATYPE = 'CURR'.
* WA_FCAT-EMPHASIZE = ABAP_TRUE.

APPEND WA_FCAT TO IT_FCAT_KUN.
CLEAR WA_FCAT.

WA_FCAT-FIELDNAME = GC_MATNR.
WA_FCAT-SELTEXT_L = TEXT-007.
* WA_FCAT-DO_SUM = ABAP_FALSE.
* WA_FCAT-EMPHASIZE = ABAP_TRUE.

APPEND WA_FCAT TO IT_FCAT_MAT.
CLEAR WA_FCAT.

WA_FCAT-FIELDNAME = GC_ARKTX.
WA_FCAT-SELTEXT_L = TEXT-008.
* WA_FCAT-DO_SUM = ABAP_FALSE.
* WA_FCAT-EMPHASIZE = ABAP_TRUE.

APPEND WA_FCAT TO IT_FCAT_MAT.
CLEAR WA_FCAT.

WA_FCAT-FIELDNAME = GC_FKIMG.
WA_FCAT-SELTEXT_L = TEXT-005.
WA_FCAT-DO_SUM = ABAP_TRUE.
WA_FCAT-DATATYPE = 'QUAN'.
* WA_FCAT-EMPHASIZE = ABAP_TRUE.

APPEND WA_FCAT TO IT_FCAT_MAT.
CLEAR WA_FCAT.

WA_FCAT-FIELDNAME = GC_NETWR.
WA_FCAT-SELTEXT_L = TEXT-006.
WA_FCAT-DO_SUM = ABAP_TRUE.
WA_FCAT-DATATYPE = 'CURR'.
* WA_FCAT-EMPHASIZE = ABAP_TRUE.

APPEND WA_FCAT TO IT_FCAT_MAT.
CLEAR WA_FCAT.

WA_FCAT-FIELDNAME = GC_SPART.
WA_FCAT-SELTEXT_L = TEXT-009.
* WA_FCAT-DO_SUM = ABAP_FALSE.
* WA_FCAT-EMPHASIZE = ABAP_TRUE.

APPEND WA_FCAT TO IT_FCAT_DIV.
CLEAR WA_FCAT.

WA_FCAT-FIELDNAME = GC_VTEXT.
WA_FCAT-SELTEXT_L = TEXT-010.
* WA_FCAT-DO_SUM = ABAP_FALSE.
* WA_FCAT-EMPHASIZE = ABAP_TRUE.

APPEND WA_FCAT TO IT_FCAT_DIV.
CLEAR WA_FCAT.

WA_FCAT-FIELDNAME = GC_FKIMG.
WA_FCAT-SELTEXT_L = TEXT-005.
WA_FCAT-DO_SUM = ABAP_TRUE.
WA_FCAT-DATATYPE = 'QUAN'.
* WA_FCAT-EMPHASIZE = ABAP_TRUE.

APPEND WA_FCAT TO IT_FCAT_DIV.
CLEAR WA_FCAT.

WA_FCAT-FIELDNAME = GC_NETWR.
WA_FCAT-SELTEXT_L = TEXT-006.
WA_FCAT-DO_SUM = ABAP_TRUE.
WA_FCAT-DATATYPE = 'CURR'.
* WA_FCAT-EMPHASIZE = ABAP_TRUE.

APPEND WA_FCAT TO IT_FCAT_DIV.
CLEAR WA_FCAT.

ENDFORM.


FORM SET_LAYOUT.

WA_LAYOUT_KUN-EDIT_MODE = ABAP_FALSE.
WA_LAYOUT_KUN-ZEBRA = ABAP_TRUE.
WA_LAYOUT_KUN-COLWIDTH_OPTIMIZE = ABAP_TRUE.
WA_LAYOUT_KUN-SUBTOTALS_TEXT = 'Total'.
WA_LAYOUT_KUN-TOTALS_TEXT = 'Grand Total'.
WA_LAYOUT_KUN-CELL_MERGE = 'X'. " cell_merge(1) type c, " not suppress field replication

* WA_LAYOUT_MAT-COLTAB_FIELDNAME = GC_MATNR.
WA_LAYOUT_MAT-ZEBRA = ABAP_TRUE.
WA_LAYOUT_MAT-COLWIDTH_OPTIMIZE = ABAP_TRUE.
WA_LAYOUT_MAT-SUBTOTALS_TEXT = 'Total'.
WA_LAYOUT_MAT-TOTALS_TEXT = 'Grand Total'.
WA_LAYOUT_MAT-CELL_MERGE = 'X'. " cell_merge(1) type c, " not suppress field replication

* WA_LAYOUT_DIV-COLTAB_FIELDNAME = GC_SPART.
WA_LAYOUT_DIV-ZEBRA = ABAP_TRUE.
WA_LAYOUT_DIV-COLWIDTH_OPTIMIZE = ABAP_TRUE.
WA_LAYOUT_DIV-SUBTOTALS_TEXT = 'Total'.
WA_LAYOUT_DIV-TOTALS_TEXT = 'Grand Total'.
WA_LAYOUT_DIV-CELL_MERGE = 'X'. " cell_merge(1) type c, " not suppress field replication

ENDFORM.

FORM SET_SORT.

WA_SORT-UP = ABAP_TRUE.
WA_SORT-FIELDNAME = GC_KUNNR.
WA_SORT-SUBTOT = ABAP_TRUE.
WA_SORT-TABNAME = 'IT_KUN'.
WA_SORT-SPOS = '1'.
* WA_SORT-GROUP = '*'.
WA_SORT-COMP = ABAP_TRUE.
* WA_SORT-EXPA = ABAP_TRUE.
APPEND WA_SORT TO IT_SORT_KUN.
CLEAR WA_SORT.

* WA_SORT-UP = ABAP_TRUE.
* WA_SORT-FIELDNAME = GC_NAME1.
** WA_SORT-SUBTOT = ABAP_TRUE.
* WA_SORT-TABNAME = 'IT_KUN'.
* WA_SORT-SPOS = '2'.
** WA_SORT-GROUP = '*'.
* WA_SORT-COMP = ABAP_TRUE.
** WA_SORT-EXPA = ABAP_TRUE.
* APPEND WA_SORT TO IT_SORT_KUN.
* CLEAR WA_SORT.
*
* WA_SORT-UP = ABAP_TRUE.
* WA_SORT-FIELDNAME = GC_FKIMG.
** WA_SORT-SUBTOT = ABAP_TRUE.
* WA_SORT-TABNAME = 'IT_KUN'.
* WA_SORT-SPOS = '3'.
** WA_SORT-GROUP = '*'.
* WA_SORT-COMP = ABAP_TRUE.
** WA_SORT-EXPA = ABAP_TRUE.
* APPEND WA_SORT TO IT_SORT_KUN.
* CLEAR WA_SORT.
*
* WA_SORT-UP = ABAP_TRUE.
* WA_SORT-FIELDNAME = GC_NETWR.
** WA_SORT-SUBTOT = ABAP_TRUE.
* WA_SORT-TABNAME = 'IT_KUN'.
* WA_SORT-SPOS = '4'.
** WA_SORT-GROUP = '*'.
* WA_SORT-COMP = ABAP_TRUE.
** WA_SORT-EXPA = ABAP_TRUE.
* APPEND WA_SORT TO IT_SORT_KUN.
* CLEAR WA_SORT.

WA_SORT-UP = ABAP_TRUE.
WA_SORT-FIELDNAME = GC_MATNR.
WA_SORT-SUBTOT = ABAP_TRUE.
WA_SORT-TABNAME = 'IT_MAT'.
WA_SORT-SPOS = '1'.
* WA_SORT-GROUP = ABAP_TRUE.
* WA_SORT-EXPA = ABAP_TRUE.
APPEND WA_SORT TO IT_SORT_MAT.
CLEAR WA_SORT.

WA_SORT-UP = ABAP_TRUE.
WA_SORT-FIELDNAME = GC_SPART.
WA_SORT-SUBTOT = ABAP_TRUE.
WA_SORT-TABNAME = 'IT_DIV'.
WA_SORT-SPOS = '1'.
* WA_SORT-GROUP = ABAP_TRUE.
* WA_SORT-EXPA = ABAP_TRUE.
APPEND WA_SORT TO IT_SORT_DIV.
CLEAR WA_SORT.

ENDFORM.

FORM SET_EVENTS.

WA_EVENT-FORM = 'KUN_HEADER'.
WA_EVENT-NAME = 'TOP_OF_PAGE'.
APPEND WA_EVENT TO IT_EVENT_KUN.
CLEAR WA_EVENT.

WA_EVENT-FORM = 'MAT_HEADER'.
WA_EVENT-NAME = 'TOP_OF_PAGE'.
APPEND WA_EVENT TO IT_EVENT_MAT.
CLEAR WA_EVENT.

WA_EVENT-FORM = 'DIV_HEADER'.
WA_EVENT-NAME = 'TOP_OF_PAGE'.
APPEND WA_EVENT TO IT_EVENT_DIV.
CLEAR WA_EVENT.

ENDFORM.


FORM KUN_HEADER.

WRITE : /20 TEXT-011 COLOR 1.
SKIP.
ULINE.

ENDFORM.

FORM MAT_HEADER.

WRITE : /20 TEXT-012 COLOR 1.
SKIP.
ULINE.

ENDFORM.

FORM DIV_HEADER.

WRITE : /20 TEXT-013 COLOR 1.
SKIP.
ULINE.

ENDFORM.

FORM ALV_BLOCK_INIT.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* IT_EXCLUDING =
.
ENDFORM.

FORM ALV_BLOCK_APPEND USING IT_NAME TYPE C
WA_LAYOUT TYPE SLIS_LAYOUT_ALV
IT_FCAT TYPE STANDARD TABLE
IT_EVENTS TYPE STANDARD TABLE
IT_DATA TYPE STANDARD TABLE
IT_SORT TYPE STANDARD TABLE.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FCAT
I_TABNAME = IT_NAME
IT_EVENTS = IT_EVENTS
IT_SORT = IT_SORT
* I_TEXT = ' '
TABLES
T_OUTTAB = IT_DATA
* EXCEPTIONS
* PROGRAM_ERROR = 1
* MAXIMUM_OF_APPENDS_REACHED = 2
* OTHERS = 3
.
ENDFORM.

FORM ALV_BLOCK_DISPLAY.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
ENDFORM.

I'm trying to merge the rows with common data in my output after sorting it but I'm unable to. I tried using Fieldcat, Cellmerge, sort etc., but I'm still unable to merge the rows of the first 2 columns in my output.

4 REPLIES 4

Sandra_Rossi
Active Contributor
0 Kudos

Please edit your question (Actions > Edit), select your code and press the button [CODE], which makes the code appear colored/indented, it will be easier for people to look at it. Thank you!

Sandra_Rossi
Active Contributor
0 Kudos

The component CELL_MERGE of parameter IS_LAYOUT (type SLIS_LAYOUT_ALV) is considered only by ALV Grid, it doesn't work for ABAP List (so, including the Block append feature).

EDIT: there's no cell merge for ABAP List (nor Block append feature).

0 Kudos

Hi Sandra,

Thanks for your input. Does it mean that it is not possible to suppress repeated values in a block list ALV?

0 Kudos

Correct, answer edited.