Application Development and Automation 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: 
Read only

ALV report code dumping

Former Member
0 Likes
1,784

Hello gurus,

I am trying to write a simple ALV report code. I pasted the code below.

The program is getting dumped. I am unable to find where the error is.

Please help me out.

Thanks in advance.

Regards,

Balu

REPORT YBP_ALV1 .

TABLES : MARA.

DATA : BEGIN OF itab OCCURS 500,

matnr LIKE mara-matnr,

ersda LIKE mara-ersda,

ernam LIKE mara-ernam,

END OF itab.

DATA i_repid LIKE sy-repid.

DATA i_lines LIKE sy-tabix.

TYPE-POOLS : slis.

DATA int_fcat TYPE SLIS_T_FIELDCAT_ALV.

SELECT-OPTIONS : s_matnr for mara-matnr matchcode object mat1.

START-OF-SELECTION.

select * FROM mara into CORRESPONDING FIELDS OF itab WHERE matnr in s_matnr.

ENDSELECT.

end-of-SELECTION.

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.

WRITE: / 'RETURNCODE', sy-subrc, 'from function reuse_alv_fieldcatalog_merge'.

ENDIF.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

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.

WRITE 😕 'Returncode', sy-subrc, 'from function reuse_alv_list_display'.

ENDIF.

Edited by: Balu on Jan 3, 2008 12:27 PM

16 REPLIES 16
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,719

In your function call, do not put the name of the field catalog internal table in quotes, just pass the table


IT_FIELDCAT = int_fcat      "<-- Remove quotes

Regards.

Rich Heilman

Read only

0 Likes
1,719

I changed as you suggested but still it dumps.

Regards,

Balu

Read only

0 Likes
1,719

> IT_FIELDCAT = int_fcat[ ] <<<<<< but this square bracket

Read only

0 Likes
1,719

It is still dumping.

Regards,

Balu

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,719

Please try define ITAB like so..



data: begin of xtab, 
        matnr LIKE mara-matnr,
        ersda LIKE mara-ersda,
        ernam LIKE mara-ernam,
        end of xtab.

data: itab like standard table of xtab with header line.

Now in this MERGE call, pass XTAB, instead of ITAB.



CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
           I_PROGRAM_NAME = i_repid
           I_INTERNAL_TABNAME = 'XTAB'
           I_INCLNAME = i_repid
     CHANGING
           CT_FIELDCAT = int_fcat
     EXCEPTIONS
           INCONSISTENT_INTERFACE = 1
           PROGRAM_ERROR = 2
           OTHERS = 3.

BTW, what does the dump say?

Regards,

RIch Heilman

Read only

0 Likes
1,719

After the changes you suggested this is the dump analysis -

An exception occurred. This exception will be dealt with in more detail

below. The exception, assigned to the class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was

not caught, which

led to a runtime error. The reason for this exception is:

The call to the function module "REUSE_ALV_FIELDCATALOG_MERGE" is incorrect:

The function module interface allows you to specify only fields

of a particular type under "I_INTERNAL_TABNAME". The field "XTAB" specified

here

has a different field type.

Regards,

balu

Read only

0 Likes
1,719

Before the changes as you suggested. I.e with the original code I pasted the dump analysis is -

An exception occurred. This exception is dealt with in more detail below

. The exception, which is assigned to the class 'CX_SY_READ_SRC_LINE_TOO_LONG',

was neither

caught nor passed along using a RAISING clause, in the procedure

"K_KKB_FIELDCAT_MERGE" "(FUNCTION)"

.

Since the caller of the procedure could not have expected this exception

to occur, the running program was terminated.

The reason for the exception is:

You tried to read the program "YBP_ALV1" from the database. The READ REPORT

statement allows you to copy a program's source code into an internal

table. The lines of source code must not be longer than the width of the

internal table. The internal table is 72 characters wide. The source

code line is 80 wide.

Regards,

Balu

Read only

0 Likes
1,719

ok, now post your exact cpde again with the updated changes.

Regards,

Rich Heilman

Read only

0 Likes
1,719

Rich,

my code after the suggested changes -

REPORT YBP_ALV1 .

TABLES : MARA.

DATA : BEGIN OF xtab,

matnr LIKE mara-matnr,

ersda LIKE mara-ersda,

ernam LIKE mara-ernam,

END OF xtab,

itab LIKE STANDARD TABLE OF xtab WITH HEADER LINE.

DATA i_repid LIKE sy-repid.

DATA i_lines LIKE sy-tabix.

TYPE-POOLS : slis.

DATA int_fcat TYPE SLIS_T_FIELDCAT_ALV.

SELECT-OPTIONS : s_matnr for mara-matnr matchcode object mat1.

START-OF-SELECTION.

select * FROM mara into CORRESPONDING FIELDS OF itab WHERE

matnr in s_matnr.

ENDSELECT.

describe TABLE itab LINES i_lines.

*if i_lines lt 1.

  • write: / 'no material found'.

  • exit.

*endif.

*clear i_lines.

end-of-SELECTION.

i_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = i_repid

I_INTERNAL_TABNAME = 'XTAB'

I_INCLNAME = i_repid

CHANGING

CT_FIELDCAT = int_fcat

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

WRITE: / 'RETURNCODE', sy-subrc, 'from function reuse_alv_fieldcatalog_merge'.

ENDIF.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

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.

WRITE : / 'Returncode', sy-subrc, 'from function reuse_alv_list_display'.

ENDIF.

The dump analysis is as below. Sorry I pasted the wrong analysis before -

An exception occurred. This exception is dealt with in more detail below

. The exception, which is assigned to the class 'CX_SY_READ_SRC_LINE_TOO_LONG',

was neither

caught nor passed along using a RAISING clause, in the procedure

"K_KKB_FIELDCAT_MERGE" "(FUNCTION)"

.

Since the caller of the procedure could not have expected this exception

to occur, the running program was terminated.

The reason for the exception is:

You tried to read the program "YBP_ALV1" from the database. The READ REPORT

statement allows you to copy a program's source code into an internal

table. The lines of source code must not be longer than the width of the

internal table. The internal table is 72 characters wide. The source

code line is 80 wide.

Regards,

Balu

Read only

0 Likes
1,719

Ahh yes, the problem is the >72 character code editor, it allows you to have code in the ABAP editor which is greater than 72 characters across, this is fine, but in this case the MERGE funciton module is reading the source code of your program and is a little particular how it does it. To fix your issue, you need to make sure that all lines of your source code are 72 characters or less, meaning that the following lines of code should be adjusted in this way.



IF SY-SUBRC = 0.
WRITE: / 'RETURNCODE', sy-subrc,
     'from function reuse_alv_fieldcatalog_merge'.
ENDIF.

And.....



IF SY-SUBRC = 0.
WRITE : / 'Returncode', sy-subrc,
     'from function reuse_alv_list_display'.
ENDIF.

Activate and run and it will work.

Regards,

Rich Heilman

Read only

0 Likes
1,719

Hi Balu,

You need to reset the maximum line width of ABAP Editor.

Goto Utilities => Settings => Select Tab for ABAP Editor => Select Editor => Uncheck the last check box which says that ' Downward -compat Line length 72'.

Or Else..

Ensure that there are no lines with width more than 72...

Lokesh

Read only

0 Likes
1,719

Lokesh,

The box is not checked. But that was a helpful point for me to learn. I gave you points.

Regards,

Balu.

Edited by: Balu on Jan 3, 2008 1:28 PM

Read only

0 Likes
1,719

Rich,

Thanks for your help. I assigned points.

Now the program is not dumping but I do not see any results in the output.

It just shows list contains no data.

But when I go to SE16 and disply the table entries of mara, I get a list.

Any idea why I am not seeing any results in the list.

Regards,

Balu

Read only

0 Likes
1,719

Yes, please make the following changes.



START-OF-SELECTION.

*select * FROM mara into CORRESPONDING FIELDS OF itab WHERE *matnr in s_matnr.
*ENDSELECT.

Select *  into corresponding fields of TABLE itab
            from mara
                   where matnr in s_matnr

Regards,

Rich Heilman

Read only

0 Likes
1,719

Thank you very much for your help Rich.

Points assigned. I

Regards,

Balu

Read only

Former Member
0 Likes
1,719

Hi Lokesh, Hi Guru,

IN SE38 , Goto Utilities => Settings => Select Tab for ABAP Editor => Select Editor => Uncheck the last check box which says that ' Downward -compat Line length 72'.

The last box is not checked, and I've still the ABAP error CX_SY_READ_SRC_LINE_TOO_LONG.

Is there another parameter where the lengh of ABAP line is limited to 72 characters please ?

Ludovic