2009 Sep 10 2:43 AM
Here in this code, I am able to get data from data base but it is creating short dump with this text : field symbol not yet been assignged.
TYPE-POOLS : SLIS.
DATA : IT_EKKO LIKE TABLE OF EKKO,
WA_EKKO LIKE LINE OF IT_EKKO,
IT_EKPO LIKE TABLE OF EKPO,
WA_EKPO LIKE LINE OF IT_EKPO,
IT_EVENTS TYPE SLIS_T_EVENT, " EVENTS TABLE
WA_EVENTS TYPE SLIS_ALV_EVENT,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
LIST_LAYOUT TYPE SLIS_LAYOUT_ALV,
GS_KEYINFO TYPE SLIS_KEYINFO_ALV.
*** START OF SELECTION ***
START-OF-SELECTION.
PERFORM READ_DATA.
PERFORM FILL_KEY_INFO.
PERFORM FILL_FIELDCATALOG USING 'IT_EKKO' 'EKKO'.
PERFORM FILL_FIELDCATALOG USING 'IT_EKPO' 'EKPO'.
PERFORM DISPLAY_HEIRSEQ_ALV.
*----------------------------------------------------------------------*
FORM READ_DATA .
SELECT * FROM EKKO INTO TABLE IT_EKKO UP TO 100 ROWS.
IF NOT IT_EKKO IS INITIAL.
SELECT * INTO TABLE IT_EKPO FROM EKPO FOR ALL ENTRIES IN IT_EKKO
WHERE EBELN = IT_EKKO-EBELN.
ENDIF.
ENDFORM. " READ_DATA
*&---------------------------------------------------------------------*
FORM FILL_KEY_INFO .
*** DEFINE KEY FIELDS
CLEAR GS_KEYINFO.
GS_KEYINFO-HEADER01 = 'EBELN'.
GS_KEYINFO-ITEM01 = 'EBELN'.
GS_KEYINFO-HEADER02 = 'SPACE'.
GS_KEYINFO-ITEM02 = 'EBELP'.
ENDFORM. " FILL_KEY_INFO
*&---------------------------------------------------------------------*
*----------------------------------------------------------------------*
FORM FILL_FIELDCATALOG USING FP_ITAB TYPE C
FP_TAB TYPE C.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-CPROG
I_INTERNAL_TABNAME = FP_ITAB
I_STRUCTURE_NAME = FP_TAB
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_INCLNAME =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = IT_FIELDCAT
* EXCEPTIONS
* INCONSISTENT_INTERFACE = 1
* PROGRAM_ERROR = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " FILL_FIELDCATALOG
*&---------------------------------------------------------------------*
FORM DISPLAY_HEIRSEQ_ALV .
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
IT_FIELDCAT = IT_FIELDCAT
I_TABNAME_HEADER = 'IT_EKKO'
I_TABNAME_ITEM = 'IT_EKPO'
IS_KEYINFO = GS_KEYINFO
TABLES
T_OUTTAB_HEADER = IT_EKKO
T_OUTTAB_ITEM = IT_EKPO
Edited by: jyotsna dm on Sep 10, 2009 3:50 AM
2009 Sep 10 3:33 AM
Hi Jyotsna,
<li>I believe that fieldcatalog creation for Hierarchical ALV is differed. You need to specify which row position and column position.
<li>I have changed your program to work. Try it.
<font color=blue><b><pre>REPORT ZTEST_NOTEPAD.
DATA: BEGIN OF IT_EKKO OCCURS 0,
EBELN TYPE EKKO-EBELN,
BUKRS TYPE EKKO-BUKRS,
BSTYP TYPE EKKO-BSTYP,
BSART TYPE EKKO-BSART,
END OF IT_EKKO.
DATA: BEGIN OF IT_EKPO OCCURS 0,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
LOEKZ TYPE EKPO-LOEKZ,
TXZ01 TYPE EKPO-TXZ01,
MATNR TYPE EKPO-MATNR,
END OF IT_EKPO.
TYPE-POOLS : SLIS.
DATA : IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS TYPE SLIS_ALV_EVENT,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT LIKE LINE OF IT_FIELDCAT,
LIST_LAYOUT TYPE SLIS_LAYOUT_ALV,
GS_KEYINFO TYPE SLIS_KEYINFO_ALV.
DATA:PROGRAM TYPE SY-REPID.
START-OF-SELECTION.
PROGRAM = SY-REPID.
SELECT * FROM EKKO INTO CORRESPONDING FIELDS OF TABLE IT_EKKO UP TO 100 ROWS.
IF NOT IT_EKKO[] IS INITIAL.
SELECT * INTO CORRESPONDING FIELDS OF TABLE IT_EKPO FROM EKPO FOR ALL ENTRIES IN IT_EKKO
WHERE EBELN = IT_EKKO-EBELN.
ENDIF.
GS_KEYINFO-HEADER01 = 'EBELN'.
GS_KEYINFO-ITEM01 = 'EBELN'.
DEFINE FIELDCATALOG.
WA_FIELDCAT-ROW_POS = &1.
WA_FIELDCAT-COL_POS = &2.
WA_FIELDCAT-FIELDNAME = &3.
WA_FIELDCAT-TABNAME = &4.
WA_FIELDCAT-SELTEXT_M = &5.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
END-OF-DEFINITION.
FIELDCATALOG: '1' '1' 'EBELN' 'IT_EKKO' 'EKKO-EBELN',
'1' '2' 'BUKRS' 'IT_EKKO' 'EKKO-BUKRS',
'1' '3' 'BSTYP' 'IT_EKKO' 'EKKO-BSTYP',
'1' '4' 'BSART' 'IT_EKKO' 'EKKO-BSART'.
FIELDCATALOG: '2' '1' 'EBELN' 'IT_EKPO' 'EKPO-EBELN',
'2' '2' 'EBELP' 'IT_EKPO' 'EKPO-EBELP',
'2' '3' 'LOEKZ' 'IT_EKPO' 'EKPO-LOEKZ',
'2' '4' 'TXZ01' 'IT_EKPO' 'EKPO-TXZ01',
'2' '5' 'MATNR' 'IT_EKPO' 'EKPO-MATNR'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = PROGRAM
IT_FIELDCAT = IT_FIELDCAT
I_TABNAME_HEADER = 'IT_EKKO'
I_TABNAME_ITEM = 'IT_EKPO'
IS_KEYINFO = GS_KEYINFO
TABLES
T_OUTTAB_HEADER = IT_EKKO
T_OUTTAB_ITEM = IT_EKPO.</pre></b></font>
Let me know if you have any doubt.
Thanks
Venkat.O
2009 Sep 10 3:33 AM
Hi Jyotsna,
<li>I believe that fieldcatalog creation for Hierarchical ALV is differed. You need to specify which row position and column position.
<li>I have changed your program to work. Try it.
<font color=blue><b><pre>REPORT ZTEST_NOTEPAD.
DATA: BEGIN OF IT_EKKO OCCURS 0,
EBELN TYPE EKKO-EBELN,
BUKRS TYPE EKKO-BUKRS,
BSTYP TYPE EKKO-BSTYP,
BSART TYPE EKKO-BSART,
END OF IT_EKKO.
DATA: BEGIN OF IT_EKPO OCCURS 0,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
LOEKZ TYPE EKPO-LOEKZ,
TXZ01 TYPE EKPO-TXZ01,
MATNR TYPE EKPO-MATNR,
END OF IT_EKPO.
TYPE-POOLS : SLIS.
DATA : IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS TYPE SLIS_ALV_EVENT,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT LIKE LINE OF IT_FIELDCAT,
LIST_LAYOUT TYPE SLIS_LAYOUT_ALV,
GS_KEYINFO TYPE SLIS_KEYINFO_ALV.
DATA:PROGRAM TYPE SY-REPID.
START-OF-SELECTION.
PROGRAM = SY-REPID.
SELECT * FROM EKKO INTO CORRESPONDING FIELDS OF TABLE IT_EKKO UP TO 100 ROWS.
IF NOT IT_EKKO[] IS INITIAL.
SELECT * INTO CORRESPONDING FIELDS OF TABLE IT_EKPO FROM EKPO FOR ALL ENTRIES IN IT_EKKO
WHERE EBELN = IT_EKKO-EBELN.
ENDIF.
GS_KEYINFO-HEADER01 = 'EBELN'.
GS_KEYINFO-ITEM01 = 'EBELN'.
DEFINE FIELDCATALOG.
WA_FIELDCAT-ROW_POS = &1.
WA_FIELDCAT-COL_POS = &2.
WA_FIELDCAT-FIELDNAME = &3.
WA_FIELDCAT-TABNAME = &4.
WA_FIELDCAT-SELTEXT_M = &5.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
END-OF-DEFINITION.
FIELDCATALOG: '1' '1' 'EBELN' 'IT_EKKO' 'EKKO-EBELN',
'1' '2' 'BUKRS' 'IT_EKKO' 'EKKO-BUKRS',
'1' '3' 'BSTYP' 'IT_EKKO' 'EKKO-BSTYP',
'1' '4' 'BSART' 'IT_EKKO' 'EKKO-BSART'.
FIELDCATALOG: '2' '1' 'EBELN' 'IT_EKPO' 'EKPO-EBELN',
'2' '2' 'EBELP' 'IT_EKPO' 'EKPO-EBELP',
'2' '3' 'LOEKZ' 'IT_EKPO' 'EKPO-LOEKZ',
'2' '4' 'TXZ01' 'IT_EKPO' 'EKPO-TXZ01',
'2' '5' 'MATNR' 'IT_EKPO' 'EKPO-MATNR'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = PROGRAM
IT_FIELDCAT = IT_FIELDCAT
I_TABNAME_HEADER = 'IT_EKKO'
I_TABNAME_ITEM = 'IT_EKPO'
IS_KEYINFO = GS_KEYINFO
TABLES
T_OUTTAB_HEADER = IT_EKKO
T_OUTTAB_ITEM = IT_EKPO.</pre></b></font>
Let me know if you have any doubt.
Thanks
Venkat.O