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

grid display

Former Member
0 Likes
2,084

hELLO FRIENDS,

i have a short dump in this report and the short dump is at

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

attached is the code.

REPORT ZSHEJAL.

TYPE-POOLS: SLIS.

DATA:BEGIN OF I_TAB1 OCCURS 0,

VBELN LIKE VBAK-VBELN,

BSTNK LIKE VBAK-BSTNK,

ERDAT LIKE VBAK-ERDAT,

KUNNR LIKE VBAK-KUNNR,

END OF I_TAB1.

DATA : V_REPID LIKE SY-REPID.

DATA : T_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.

INITIALIZATION.

V_REPID = SY-REPID.

START-OF-SELECTION.

PERFORM GET_FIELDCAT1.

SELECT VBELN BSTNK ERDAT KUNNR FROM VBAK INTO TABLE I_TAB1 UP TO 10 ROWS.

END-OF-SELECTION.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = V_REPID

IT_FIELDCAT = T_FIELDCAT1

TABLES

T_OUTTAB = I_TAB1

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.

  • getting the data from internal table 1 to t_filedcat.

&----


*& Form get_fieldcat1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_FIELDCAT1 .

  • To generate the field catalog

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = V_REPID

I_INTERNAL_TABNAME = 'I_TAB1'

I_INCLNAME = V_REPID

CHANGING

CT_FIELDCAT = T_FIELDCAT1.

ENDFORM. " get_fieldcat1

Thanks,

Shejal

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,040

&----


*& Report ZTEST_ALV

*&

&----


*&

*&

&----


REPORT ZTEST_ALV.

TYPE-POOLS: SLIS.

DATA:BEGIN OF I_TAB1 OCCURS 0,

VBELN LIKE VBAK-VBELN,

BSTNK LIKE VBAK-BSTNK,

ERDAT LIKE VBAK-ERDAT,

KUNNR LIKE VBAK-KUNNR,

END OF I_TAB1.

DATA : V_REPID LIKE SY-REPID.

DATA : T_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.

INITIALIZATION.

V_REPID = SY-REPID.

START-OF-SELECTION.

PERFORM GET_FIELDCAT1.

<u><b><b>SELECT VBELN BSTNK ERDAT KUNNR FROM VBAK INTO TABLE I_TAB1 UP TO 10 ROWS.</b></b></u>

END-OF-SELECTION.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = V_REPID

IT_FIELDCAT = T_FIELDCAT1

TABLES

T_OUTTAB = I_TAB1

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.

  • getting the data from internal table 1 to t_filedcat.

&----


*& Form get_fieldcat1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_FIELDCAT1 .

  • To generate the field catalog

*CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

*EXPORTING

*I_PROGRAM_NAME = V_REPID

*I_INTERNAL_TABNAME = I_TAB1

*I_INCLNAME = V_REPID

*CHANGING

*CT_FIELDCAT = T_FIELDCAT1.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = v_repid

I_INTERNAL_TABNAME = 'I_TAB1'

I_STRUCTURE_NAME = 'I_TAB1'

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = v_repid

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = t_fieldcat1

  • 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. " get_fieldcat1

Pass the Include Structure name and also see the Select statement is after the Field Catalog Merge...it should be before we call Field catalog merge

22 REPLIES 22
Read only

Former Member
0 Likes
2,040

Hi,

I executed this code..It is working for me..

Thanks,

Naren

Read only

0 Likes
2,040

its giving a short dump. i will see again.

thanks.

shejal.

Read only

Former Member
0 Likes
2,040

Where are you building your field catalogue in your program? Make the correction as stated in bold below in your program and try.

Check this link for sample ALV program using this FM:

http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm

FORM GET_FIELDCAT1 .

  • To generate the field catalog

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = V_REPID

I_INTERNAL_TABNAME = 'I_TAB1'

I_INCLNAME = V_REPID

CHANGING

CT_FIELDCAT = <b>T_FIELDCAT1[].</b>

ENDFORM. " get_fieldcat1

Thanks,

Santosh

Read only

Former Member
0 Likes
2,041

&----


*& Report ZTEST_ALV

*&

&----


*&

*&

&----


REPORT ZTEST_ALV.

TYPE-POOLS: SLIS.

DATA:BEGIN OF I_TAB1 OCCURS 0,

VBELN LIKE VBAK-VBELN,

BSTNK LIKE VBAK-BSTNK,

ERDAT LIKE VBAK-ERDAT,

KUNNR LIKE VBAK-KUNNR,

END OF I_TAB1.

DATA : V_REPID LIKE SY-REPID.

DATA : T_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.

INITIALIZATION.

V_REPID = SY-REPID.

START-OF-SELECTION.

PERFORM GET_FIELDCAT1.

<u><b><b>SELECT VBELN BSTNK ERDAT KUNNR FROM VBAK INTO TABLE I_TAB1 UP TO 10 ROWS.</b></b></u>

END-OF-SELECTION.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = V_REPID

IT_FIELDCAT = T_FIELDCAT1

TABLES

T_OUTTAB = I_TAB1

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.

  • getting the data from internal table 1 to t_filedcat.

&----


*& Form get_fieldcat1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_FIELDCAT1 .

  • To generate the field catalog

*CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

*EXPORTING

*I_PROGRAM_NAME = V_REPID

*I_INTERNAL_TABNAME = I_TAB1

*I_INCLNAME = V_REPID

*CHANGING

*CT_FIELDCAT = T_FIELDCAT1.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = v_repid

I_INTERNAL_TABNAME = 'I_TAB1'

I_STRUCTURE_NAME = 'I_TAB1'

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = v_repid

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = t_fieldcat1

  • 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. " get_fieldcat1

Pass the Include Structure name and also see the Select statement is after the Field Catalog Merge...it should be before we call Field catalog merge

Read only

0 Likes
2,040

Hi Srinivas

Checking after making the few changes:

TYPE-POOLS: SLIS.

DATA:BEGIN OF I_TAB1 OCCURS 0,

VBELN LIKE VBAK-VBELN,

BSTNK LIKE VBAK-BSTNK,

ERDAT LIKE VBAK-ERDAT,

KUNNR LIKE VBAK-KUNNR,

END OF I_TAB1.

DATA : V_REPID LIKE SY-REPID.

DATA : T_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.

INITIALIZATION.

V_REPID = SY-REPID.

START-OF-SELECTION.

PERFORM GET_FIELDCAT1.

SELECT VBELN BSTNK ERDAT KUNNR FROM VBAK INTO TABLE I_TAB1 UP TO 10 ROWS

.

END-OF-SELECTION.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = V_REPID

IT_FIELDCAT = T_FIELDCAT1

TABLES

T_OUTTAB = I_TAB1

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.

  • getting the data from internal table 1 to t_filedcat.

&----


*& Form get_fieldcat1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_FIELDCAT1 .

  • To generate the field catalog

*CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

*EXPORTING

*I_PROGRAM_NAME = V_REPID

*I_INTERNAL_TABNAME = I_TAB1

*I_INCLNAME = V_REPID

*CHANGING

*CT_FIELDCAT = T_FIELDCAT1.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = v_repid

I_INTERNAL_TABNAME = 'I_TAB1'

<b>*I_STRUCTURE_NAME = 'I_TAB1'</b>

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = v_repid

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = <b>t_fieldcat1[]</b>

  • 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. " get_fieldcat1

Execute with the above code and let us know, if you still have problems????

Regards

Eswar

Read only

0 Likes
2,040

i thred the code as suggested. It still have the same problem.

Shejal

Read only

0 Likes
2,040

Hi Sheejal

Please try by doing <b>COPY-PASTE</b> of the below code:

TYPE-POOLS: SLIS.

DATA: BEGIN OF I_TAB1 OCCURS 0,
        VBELN LIKE VBAK-VBELN,
        BSTNK LIKE VBAK-BSTNK,
        ERDAT LIKE VBAK-ERDAT,
        KUNNR LIKE VBAK-KUNNR,
      END OF I_TAB1.

DATA : V_REPID LIKE SY-REPID.

DATA : T_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.

INITIALIZATION.

  V_REPID = SY-REPID.

START-OF-SELECTION.

  PERFORM GET_FIELDCAT1.

  SELECT VBELN BSTNK ERDAT KUNNR FROM VBAK
     INTO TABLE I_TAB1 UP TO 10 ROWS.

END-OF-SELECTION.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM = V_REPID
      IT_FIELDCAT = T_FIELDCAT1[]
    TABLES
      T_OUTTAB = I_TAB1
    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.

* getting the data from internal table 1 to t_filedcat.
*&--------------------------------------------------------------------*
*& Form get_fieldcat1
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*---------------------------------------------------------------------*
FORM GET_FIELDCAT1 .

* To generate the field catalog
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      I_PROGRAM_NAME = V_REPID
      I_INTERNAL_TABNAME = 'I_TAB1'
      I_INCLNAME = V_REPID
    CHANGING
      CT_FIELDCAT = T_FIELDCAT1[].

ENDFORM. " get_fieldcat1

Regards

Eswar

Read only

0 Likes
2,040

What release are you working in?

Regards,

Rich Heilman

Read only

0 Likes
2,040

I believe the dump is related to some other part of the code and not with ALV related...

if you are still facing the dump... can you paste the entire dump report.. may be we get some more idea...

Thanks,

Santosh

Read only

0 Likes
2,040

Friends,

Just a doubt, does this dump relate to SETTINGS of ABAP editor???

I mean if the editor is not restricted to 72 chars per row, it can go more than 72 characters and most of the SAP code that were read internally are for 72 characters. I guess this might cause a problem.

Sheetal,

Can you check the settings.

SE38->Utilities->Settings->ABAP Editor->Editor->Downward Compat.Line Length(72).

Can you check if the check box is ON or OFF???

Regards

Eswar

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,040

What exactly does the dump say?

Regards,

RIch Heilman

Read only

0 Likes
2,040

the short dump

ShrtText

The ABAP source code lines are longer than the width of the internal

the dump is at

read report l_prog_tab_local into l_abap_source.

thanks,

Shejal.

Read only

Former Member
0 Likes
2,040

THanks for all the help.

Here is the dump. I am working on version 5.0.

Eashwar, I copied ur program and ran without any modifications. It still has the same dump.

-


Error analysis

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 "ZASH_GRID_DRILL1" 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.

---

How to correct the error

The exception must either be prevented, caught within the procedure

"K_KKB_FIELDCAT_MERGE"

"(FUNCTION)", or declared in the procedure's RAISING clause.

To prevent the exception, note the following:

Probably the only way to eliminate the error is to correct the program.

Shejal.

Read only

Former Member
0 Likes
2,040

When i made the below change it works.

DATA:BEGIN OF I_TAB1 OCCURS 0,

VBELN LIKE VBAK-VBELN,

BSTNK LIKE VBAK-BSTNK,

ERDAT LIKE VBAK-ERDAT,

*KUNNR LIKE VBAK-KUNNR,

END OF I_TAB1.

how can i make it work for more fields.

Shejal

Read only

Former Member
0 Likes
2,040

i checked for the checkbox in utilities-abapeditor and its not checked.

Shejal

Read only

0 Likes
2,040

Please try with Checked(ON)....

Regards

Eswar

Read only

0 Likes
2,040

I definitly think that Eswar is on to something here. But I can't see why it is having a problem with the code above, except for may be that SELECT statement. It has been suggested to split that line in two, have you tried this?

The reason for the problem is that the MERGE function module actually reads the report source code and builds the FC from the source code. It is having trouble reading the source code of your program.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
2,040

Thanks Eswar for all the suggestions.

I tried with check box on. It is displaying only the 3 fields and is skipping KUNNR. i looked in the debug mode and

T_FIELDCAT1 has only 3 rows. It didnt get KUNNR. So i unchecked the box and the same results. I have kunnr in my data declaration for I_TAB1 and this internal table has data for KUnnr.

I dont understand this whats the reason.

ANyways thanks for all the suggestions.

Shejal

Read only

0 Likes
2,040

Make sure that you UNcomment the KUNNR field in your internal table and try again.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
2,040

I have a different system version 4.7 and it aslso had the same problem. I mean it gace the same errror as well. SO in ABAP editor as suggested by ESWAR i checked the box which says about the length as 72. Ran the program again a short dump and then i unchecked itagain and now when i execute it displays the output.

Dosent make sense to me but works.

THanks all for all yiyr suggestions and help.

Shejal.

Read only

0 Likes
2,040

Does it do something with LOG-OFF and LOG-IN again after changing the settings???

Regards

Eswar

Read only

Former Member
0 Likes
2,040

no i didnt log off.

however i did some more experiments..

i added one more field to the internal table. and now when i executed the program it didnt display the added field. i changes the settings and then tried it still didnt work, Logged off and logged in and still dosent work. I dont know why

THanks

ShejAL