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 FM 'REUSE_ALV_FIELDCATALOG_MERGE' dump

Former Member
0 Kudos

Hi Gurus,

I am a newbie to ABAP. Im trying to use ALV, but there is a dump right after the FM 'REUSE_ALV_FIELDCATALOG_MERGE'. I am pasting the code below. Please look into it and help me out.

REPORT ZSSS.

Tables : VBAP.

DATA: VBELN LIKE VBAP-VBELN,

MATNR LIKE VBAP-MATNR,

I_REPID LIKE SY-REPID,

I_LINES LIKE SY-TABIX.

DATA: BEGIN OF ITAB OCCURS 100,

VBELN LIKE VBAP-VBELN,

MATNR LIKE VBAP-MATNR,

I_REPID LIKE SY-REPID,

I_LINES LIKE SY-TABIX,

END OF ITAB.

WRITE: 'SALES DOCUMENT', 'MATERIAL NUMBER',/."/ puts the next write statement in the next line

SELECT VBELN MATNR FROM VBAP INTO CORRESPONDING FIELDS OF ITAB.

APPEND ITAB.

WRITE : ITAB-VBELN,ITAB-MATNR.

ENDSELECT.

TYPE-POOLS : SLIS.

DATA INT_FCAT TYPE SLIS_T_FIELDCAT_ALV.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = I_REPID

I_INTERNAL_TABNAME = 'ITAB'

I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = I_REPID

CHANGING

CT_FIELDCAT = INT_FCAT

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.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'

I_CALLBACK_PROGRAM = I_REPID

IT_FIELDCAT = INT_FCAT

I_SAVE = 'A'

TABLES

T_OUTTAB = ITAB

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.

Thanks in advance,

Syed.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

REPORT zalvtest.

TYPE-POOLS: slis.

TABLES zprod.

DATA: BEGIN OF product OCCURS 0,

pno LIKE zprod-pno,

pname LIKE zprod-pname,

qty LIKE zprod-qty,

rate LIKE zprod-rate1,

END OF product.

data count like sy-tabix.

"data product TYPE TABLE OF zprod WITH HEADER LINE.

*data a TYPE i VALUE 12.

*

*FIELD-SYMBOLS <f1>.

  • ASSIGN a to <f1>.

*

  • WRITE / <f1>.

DATA i_fieldcat TYPE slis_t_fieldcat_alv.

"product-pno = 10.

product-pname = 'xxx'.

"product-qty = 3.

product-rate = 100.

APPEND product to product.

product-pname = 'yyy'.

product-qty = 3.

"product-rate = 100.

APPEND product to product.

"select-options:

"ppno for zprod-pno. "matchcode object MAT1.

*PARAMETERS ppno like zprod-pno.

*

*SELECT pno pname qty rate1

  • INTO TABLE product

  • FROM zprod

  • WHERE pno = ppno.

*

  • DESCRIBE TABLE product LINES count.

  • if count eq 0.

  • WRITE / 'no records fetched'.

  • endif.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = sy-repid

I_INTERNAL_TABNAME = 'PRODUCT'

I_INCLNAME = sy-repid

CHANGING

ct_fieldcat = i_fieldcat

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3

.

IF sy-subrc <> 0.

WRITE / sy-subrc.

ENDIF.

*

*CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

  • EXPORTING

  • I_CALLBACK_PROGRAM = sy-repid

*

  • IT_FIELDCAT = i_fieldcat

*

  • TABLES

  • t_outtab = product

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

  • .

*IF sy-subrc <> 0.

  • WRITE / sy-subrc.

*WRITE / 'err'.

*ENDIF.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = sy-repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

IT_FIELDCAT = i_fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = product

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.

*CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

  • EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_CALLBACK_PROGRAM =

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = ' '

    • IS_LAYOUT =

    • IT_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 =

    • IT_EVENT_EXIT =

  • i_tabname_header =

  • i_tabname_item =

    • I_STRUCTURE_NAME_HEADER =

    • I_STRUCTURE_NAME_ITEM =

  • "is_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 =

  • t_outtab_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.

8 REPLIES 8

Former Member
0 Kudos

REPORT zalvtest.

TYPE-POOLS: slis.

TABLES zprod.

DATA: BEGIN OF product OCCURS 0,

pno LIKE zprod-pno,

pname LIKE zprod-pname,

qty LIKE zprod-qty,

rate LIKE zprod-rate1,

END OF product.

data count like sy-tabix.

"data product TYPE TABLE OF zprod WITH HEADER LINE.

*data a TYPE i VALUE 12.

*

*FIELD-SYMBOLS <f1>.

  • ASSIGN a to <f1>.

*

  • WRITE / <f1>.

DATA i_fieldcat TYPE slis_t_fieldcat_alv.

"product-pno = 10.

product-pname = 'xxx'.

"product-qty = 3.

product-rate = 100.

APPEND product to product.

product-pname = 'yyy'.

product-qty = 3.

"product-rate = 100.

APPEND product to product.

"select-options:

"ppno for zprod-pno. "matchcode object MAT1.

*PARAMETERS ppno like zprod-pno.

*

*SELECT pno pname qty rate1

  • INTO TABLE product

  • FROM zprod

  • WHERE pno = ppno.

*

  • DESCRIBE TABLE product LINES count.

  • if count eq 0.

  • WRITE / 'no records fetched'.

  • endif.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = sy-repid

I_INTERNAL_TABNAME = 'PRODUCT'

I_INCLNAME = sy-repid

CHANGING

ct_fieldcat = i_fieldcat

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3

.

IF sy-subrc <> 0.

WRITE / sy-subrc.

ENDIF.

*

*CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

  • EXPORTING

  • I_CALLBACK_PROGRAM = sy-repid

*

  • IT_FIELDCAT = i_fieldcat

*

  • TABLES

  • t_outtab = product

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

  • .

*IF sy-subrc <> 0.

  • WRITE / sy-subrc.

*WRITE / 'err'.

*ENDIF.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = sy-repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

IT_FIELDCAT = i_fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = product

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.

*CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

  • EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_CALLBACK_PROGRAM =

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = ' '

    • IS_LAYOUT =

    • IT_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 =

    • IT_EVENT_EXIT =

  • i_tabname_header =

  • i_tabname_item =

    • I_STRUCTURE_NAME_HEADER =

    • I_STRUCTURE_NAME_ITEM =

  • "is_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 =

  • t_outtab_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.

0 Kudos

Hi,

Thanks for the immediate responses. I already took care of those but still i get dump again and i find it difficult in resolving it. I am posting the query again.Please help me out.

Tables : VBAP.

DATA: VBELN LIKE VBAP-VBELN,

MATNR LIKE VBAP-MATNR,

I_REPID LIKE SY-REPID,

I_LINES LIKE SY-TABIX.

DATA: BEGIN OF ITAB OCCURS 100,

VBELN LIKE VBAP-VBELN,

MATNR LIKE VBAP-MATNR,

END OF ITAB.

*WRITE: 'SALES DOCUMENT', 'MATERIAL NUMBER',/."/ puts the next write statement in the next line

SELECT VBELN MATNR FROM VBAP INTO CORRESPONDING FIELDS OF ITAB.

APPEND ITAB.

  • WRITE : ITAB-VBELN,ITAB-MATNR.

ENDSELECT.

TYPE-POOLS : SLIS.

DATA INT_FCAT TYPE SLIS_T_FIELDCAT_ALV.

I_REPID = SY-REPID.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = I_REPID

I_INTERNAL_TABNAME = 'ITAB'

I_INCLNAME = I_REPID

CHANGING

CT_FIELDCAT = INT_FCAT

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.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'

I_CALLBACK_PROGRAM = I_REPID

IT_FIELDCAT = INT_FCAT

I_SAVE = 'A'

TABLES

T_OUTTAB = ITAB

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.

0 Kudos

delete the line

*WRITE: 'SALES DOCUMENT', 'MATERIAL NUMBER',/."/ puts the next write statement in the next line

not comment that the dump is because the length is more thabn 72 for this line.

just delete that line from your code. It will work.

regards

shiba dutta

0 Kudos

Hi,

Thanks for your immediate response. ALV is getting generated but the data is not getting populated. Please help me out.

kiran_k8
Active Contributor
0 Kudos

try like this

Former Member
0 Kudos

first of all i cant see any assignment of value for I_REPID

befor using fieldcatalog merge fm you have to assign the value to I_REPID

I_REPID = SY_REPID.

And another one thing 'REUSE_ALV_FIELDCATALOG_MERGE' fm reads your report and then it create the dieldcatalog. In that fm there is a restriction i.e. any line of your source code should not exceed length of 72 other wise it will give adump. Just check in your code if any line exceed the length more than 72 or not if it is so break the line in two part.

One more thing i cant understand the use of write statement in your program.

specially WRITE: 'SALES DOCUMENT', 'MATERIAL NUMBER',/."/ puts the next write statement in the next line ---> this line may contain length more than 72 just delete that line or split it into two lines.

regards

shiba dutta

Former Member
0 Kudos

here in itab

DATA: BEGIN OF ITAB OCCURS 100,

VBELN LIKE VBAP-VBELN,

MATNR LIKE VBAP-MATNR,

<b>I_REPID LIKE SY-REPID,

I_LINES LIKE SY-TABIX,</b>

END OF ITAB.

two bold fields you are not populating anywhere.

first set a breakpoint and check whther data is fetched from the database or not?

SELECT VBELN MATNR FROM VBAP INTO CORRESPONDING FIELDS OF ITAB. "PUT A BREAK POINT HERE AND CHECK IN DEBUG MODE data is fetching or not?

APPEND ITAB.

WRITE : ITAB-VBELN,ITAB-MATNR.

ENDSELECT.

after that if you want to populate those two fields...

loop at itab.

itab-i_repid = sy-repid.

itab-ilines = sy-tabix.

modify itab.

endloop.

and then show in your alv...

regards

shiba dutta

0 Kudos

Hi,

Thanks for your help. I have got the data populated.

Regards,

Syed.