cancel
Showing results for 
Search instead for 
Did you mean: 

Data not display in the Report using REUSE_ALV_HIERSEQ_LIST_DISPLAY

Former Member
0 Kudos

Hi Expert,

This is first time i am using REUSE_ALV_HIERSEQ_LIST_DISPLAY but here the problem is without going to selection screen to goes execute directly without data and fileds headings. while coming back then selection screen is appears please help me .

If any wrong code in my program please do the modications

Thanks in advance .

{*&----


*

*& Report ZTEST_HERI_1

*&

*&----


*

*&

*&

*&----


*

REPORT ztest_heri_1.

TYPE-POOLS:slis.

TABLES:makt,ekpo,mseg,kna1.

TYPES: BEGIN OF ty_makt,

matnr TYPE makt-matnr,

maktx TYPE makt-maktx,

END OF ty_makt.

TYPES: BEGIN OF ty_ekpo,

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

matnr TYPE ekpo-matnr,

menge TYPE ekpo-menge,

END OF ty_ekpo.

TYPES: BEGIN OF ty_mseg,

ebeln TYPE mseg-ebeln,

ebelp TYPE mseg-ebelp,

matnr TYPE mseg-matnr,

menge TYPE mseg-menge,

bwart TYPE mseg-bwart,

lifnr TYPE mseg-lifnr,

END OF ty_mseg.

TYPES: BEGIN OF ty_item,

ebeln TYPE ebeln,

ebelp TYPE ebelp,

matnr TYPE matnr,

maktx TYPE maktx,

qtysup TYPE menge_d,

qtyact TYPE menge_d,

qtyrej TYPE menge_d,

lifnr TYPE lifnr,

name1 TYPE name1,

land1 TYPE land1,

ort01 TYPE ort01,

END OF ty_item.

TYPES: BEGIN OF ty_header,

lifnr TYPE lfa1-lifnr,

name1 TYPE lfa1-name1,

land1 TYPE lfa1-land1,

ort01 TYPE lfa1-ort01,

END OF ty_header.

DATA: it_makt TYPE TABLE OF ty_makt WITH HEADER LINE,

it_mseg TYPE TABLE OF ty_mseg WITH HEADER LINE,

it_ekpo TYPE TABLE OF ty_ekpo WITH HEADER LINE,

it_header TYPE TABLE OF ty_header WITH HEADER LINE,

it_item TYPE TABLE OF ty_item WITH HEADER LINE.

CONSTANTS:

GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.

DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

GS_LAYOUT TYPE SLIS_LAYOUT_ALV,

GS_KEYINFO TYPE SLIS_KEYINFO_ALV,

GT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV,

GT_EVENTS TYPE SLIS_T_EVENT.

DATA: GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.

DATA: G_REPID LIKE SY-REPID.

DATA: G_TABNAME_HEADER TYPE SLIS_TABNAME,

G_TABNAME_ITEM TYPE SLIS_TABNAME.

SELECT-OPTIONS:matnr FOR makt-matnr NO INTERVALS NO-EXTENSION.

SELECT-OPTIONS:bwart FOR mseg-bwart DEFAULT '122' NO INTERVALS NO-EXTENSION.

START-OF-SELECTION.

SELECT matnr maktx FROM makt

INTO TABLE it_makt

WHERE matnr IN matnr.

IF it_makt[] IS NOT INITIAL.

SELECT ebeln ebelp matnr menge FROM ekpo

INTO TABLE it_ekpo

FOR ALL ENTRIES IN it_makt[]

WHERE matnr = it_makt-matnr.

ENDIF.

IF it_ekpo[] IS NOT INITIAL.

SELECT ebeln ebelp matnr menge bwart lifnr FROM mseg

INTO TABLE it_mseg

FOR ALL ENTRIES IN it_ekpo[]

WHERE matnr EQ it_ekpo-matnr

AND ebelp EQ it_ekpo-ebelp

AND bwart EQ '122'.

ENDIF.

LOOP AT it_mseg .

READ TABLE it_ekpo WITH KEY ebeln = it_mseg-ebeln.

IF sy-subrc EQ 0.

it_item-qtysup = it_ekpo-menge.

it_item-qtyrej = it_mseg-menge.

it_item-ebeln = it_mseg-ebeln.

it_item-ebelp = it_mseg-ebelp.

it_item-matnr = it_mseg-matnr.

it_item-lifnr = it_mseg-lifnr.

ENDIF.

IF sy-subrc EQ 0.

it_item-qtyact = ( it_item-qtysup ) - ( it_item-qtyrej ).

ENDIF.

READ TABLE it_makt WITH KEY matnr = it_mseg-matnr.

IF sy-subrc EQ 0.

it_item-maktx = it_makt-maktx.

ENDIF.

SELECT lifnr name1 land1 ort01 FROM lfa1

INTO TABLE it_header

WHERE lifnr EQ it_mseg-lifnr.

READ TABLE it_header WITH KEY lifnr = it_mseg-lifnr.

  • IF sy-subrc EQ 0.

  • it_header-lifnr = it_lfa1-lifnr.

  • it_header-name1 = it_lfa1-name1.

  • it_header-land1 = it_lfa1-land1.

  • it_header-ort01 = it_lfa1-ort01.

  • ENDIF.

APPEND it_header.

ENDLOOP.

INITIALIZATION.

G_REPID = SY-REPID.

G_TABNAME_HEADER = 'IT_HEADER'.

G_TABNAME_ITEM = 'IT_ITEM'.

CLEAR GS_KEYINFO.

GS_KEYINFO-HEADER01 = 'LIFNR'.

GS_KEYINFO-ITEM01 = 'LIFNR'.

GS_KEYINFO-HEADER02 = 'NAME1'.

GS_KEYINFO-ITEM02 = 'NAME1'.

PERFORM E01_FIELDCAT_INIT USING GT_FIELDCAT[].

PERFORM E03_EVENTTAB_BUILD USING GT_EVENTS[].

PERFORM E04_COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[].

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

I_CALLBACK_PROGRAM = G_REPID

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • IS_LAYOUT =

IT_FIELDCAT = GT_FIELDCAT[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = GT_EVENTS[]

  • IT_EVENT_EXIT =

i_tabname_header = G_TABNAME_HEADER

i_tabname_item = G_TABNAME_ITEM

  • I_STRUCTURE_NAME_HEADER =

  • I_STRUCTURE_NAME_ITEM =

is_keyinfo = GS_KEYINFO

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

  • IR_SALV_HIERSEQ_ADAPTER =

  • IT_EXCEPT_QINFO =

  • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

tables

t_outtab_header = IT_HEADER

t_outtab_item = IT_ITEM

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*----


*

  • FORM E01_FIELDCAT_INIT *

*----


*

  • ........ *

*----


*

  • --> E01_LT_FIELDCAT *

*----


*

FORM E01_FIELDCAT_INIT USING E01_LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

*

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'PURCHASE DOC'.

LS_FIELDCAT-TABNAME = G_TABNAME_ITEM.

LS_FIELDCAT-NO_OUT = 'X'.

LS_FIELDCAT-NO_SUM = 'X'.

LS_FIELDCAT-SP_GROUP = 'A'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

*

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'ITEM'.

LS_FIELDCAT-TABNAME = G_TABNAME_ITEM.

LS_FIELDCAT-NO_OUT = 'X'.

LS_FIELDCAT-NO_SUM = 'X'.

LS_FIELDCAT-SP_GROUP = 'A'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

*

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'MATERIAL'.

LS_FIELDCAT-TABNAME = G_TABNAME_ITEM.

LS_FIELDCAT-TECH = 'X'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

*

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'MATERIAL DESCRIPTION'.

LS_FIELDCAT-TABNAME = G_TABNAME_ITEM.

LS_FIELDCAT-NO_OUT = 'X'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'QUALITYSUPPLIED'.

LS_FIELDCAT-TABNAME = G_TABNAME_ITEM.

LS_FIELDCAT-NO_OUT = 'X'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'QUALITYACCEPTED'.

LS_FIELDCAT-TABNAME = G_TABNAME_ITEM.

LS_FIELDCAT-NO_OUT = 'X'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'QUALITY REJECTED'.

LS_FIELDCAT-TABNAME = G_TABNAME_ITEM.

LS_FIELDCAT-NO_OUT = 'X'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

  • CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

  • EXPORTING

    • I_PROGRAM_NAME =

  • I_INTERNAL_TABNAME = G_TABNAME_HEADER

  • I_STRUCTURE_NAME = 'IT_HEADER'

    • I_CLIENT_NEVER_DISPLAY = 'X'

  • CHANGING

  • CT_FIELDCAT = E01_LT_FIELDCAT[].

*

  • CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

  • EXPORTING

    • I_PROGRAM_NAME =

  • I_INTERNAL_TABNAME = G_TABNAME_ITEM

  • I_STRUCTURE_NAME = 'IT_ITEM'

    • I_CLIENT_NEVER_DISPLAY = 'X'

  • CHANGING

  • CT_FIELDCAT = E01_LT_FIELDCAT[].

  • APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

ENDFORM.

*&----


*

*& Form E03_EVENTTAB_BUILD

*&----


*

  • text

*----


*

  • -->P_GT_EVENTS[] text

*----


*

FORM E03_EVENTTAB_BUILD USING E03_LT_EVENTS TYPE SLIS_T_EVENT.

DATA: LS_EVENT TYPE SLIS_ALV_EVENT.

*

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = E03_LT_EVENTS.

READ TABLE E03_LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE

INTO LS_EVENT.

IF SY-SUBRC = 0.

MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.

APPEND LS_EVENT TO E03_LT_EVENTS.

ENDIF.

endform. " E03_EVENTTAB_BUILD

*----


*

  • FORM E04_COMMENT_BUILD *

*----


*

  • ........ *

*----


*

  • --> E04_LT_TOP_OF_PAGE *

*----


*

FORM E04_COMMENT_BUILD USING E04_LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.

DATA: LS_LINE TYPE SLIS_LISTHEADER.

*

  • Listenüberschrift: Typ H

CLEAR LS_LINE.

LS_LINE-TYP = 'H'.

  • LS_LINE-KEY: not used for this type

LS_LINE-INFO = TEXT-001.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

  • Kopfinfo: Typ S

CLEAR LS_LINE.

LS_LINE-TYP = 'S'.

LS_LINE-KEY = IT_HEADER-LIFNR.

  • LS_LINE-INFO = TEXT-010.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

  • LS_LINE-KEY = TEXT-051.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

  • Aktionsinfo: Typ A

CLEAR LS_LINE.

LS_LINE-TYP = 'A'.

  • LS_LINE-KEY: not used for this type

LS_LINE-INFO = IT_HEADER-NAME1.

APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.

ENDFORM.}

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

helpful

Former Member
0 Kudos

please format the code

cant make out the head and tail

Former Member
0 Kudos

hi,

please format your code first

regards

rahul

Former Member
0 Kudos

try to put line END-OF-SELECTION.

after START-OF-SELECTION.

format abap code next time before posting, its quite hard to read