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

Help need on ALV Report Program

Former Member
0 Likes
1,199

Hi all.....

im facing problem in the following code....it shows 'No records found' (as same as my coding generated)whenever i give wrong vendor no:(lifnr), but if i gives the correct one(as in table lfa1)...it shows Runtime error as <b>"the occupied line length in the program text must not exceed the width of the internal table"</b>..

pls verify...

just go thru my code and revert me the feedback of what i did wrong and pls i dont want any example codes from u guys since i've seen so much and couldnt solve it with that...

hope u understand......what i need

Rewards based on the above reuirements....only

*******************************CODING***********************************************

REPORT ZALV_MERGE.

TABLES:lfa1.

DATA:BEGIN OF itab OCCURS 100,

lifnr LIKE lfa1-lifnr,

land1 LIKE lfa1-land1,

name1 LIKE lfa1-name1,

ort01 LIKE lfa1-ort01,

regio LIKE lfa1-regio,

sortl LIKE lfa1-sortl,

END OF itab.

data: i_repid like sy-repid,

i_tabix like sy-tabix.

TYPE-POOLS: slis.

DATA: fcat TYPE slis_t_fieldcat_alv.

SELECT-OPTIONS: LIFNR FOR LFA1-LIFNR.

SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE itab WHERE lifnr IN LIFNR.

clear i_tabix.

describe table itab lines i_tabix.

if i_tabix lt 1.

write:/ 'No materials found'.

exit.

endif.

i_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = i_repid

I_INTERNAL_TABNAME = 'ITAB'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = I_REPID

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = 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 = i_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

I_STRUCTURE_NAME = 'ITAB'

  • IS_LAYOUT =

IT_FIELDCAT = 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.

12 REPLIES 12
Read only

Former Member
0 Likes
1,142

Hi

There is no problem in your coding it is working fine ok. Do one thing change your internal table declaration

Reward all helpfull answers

Regards

Pavan

Read only

Pawan_Kesari
Active Contributor
0 Likes
1,142

remove/comment this line I_STRUCTURE_NAME = 'ITAB' , while calling FM

Read only

Former Member
0 Likes
1,142

hi

this code is working fine i tested ... if u r getting this eroor try to change the declaration of the internal table and please check once.....

thanks,

maheedhar.t

Read only

Former Member
0 Likes
1,142

Copy Paste the below code, the errors are corrected....

TABLES:lfa1.

DATA:BEGIN OF itab OCCURS 100,

lifnr LIKE lfa1-lifnr,

land1 LIKE lfa1-land1,

name1 LIKE lfa1-name1,

ort01 LIKE lfa1-ort01,

regio LIKE lfa1-regio,

sortl LIKE lfa1-sortl,

END OF itab.

data: i_repid like sy-repid,

i_tabix like sy-tabix.

TYPE-POOLS: slis.

DATA: fcat TYPE slis_t_fieldcat_alv.

SELECT-OPTIONS: LIFNR FOR LFA1-LIFNR.

SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE itab WHERE lifnr

IN LIFNR.

clear i_tabix.

describe table itab lines i_tabix.

if i_tabix lt 1.

write:/ 'No materials found'.

exit.

endif.

i_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = i_repid

I_INTERNAL_TABNAME = 'ITAB'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

I_INCLNAME = I_REPID

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = 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 = i_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

*I_STRUCTURE_NAME = 'ITAB'

  • IS_LAYOUT =

IT_FIELDCAT = 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.

Regards,

Pavan

Read only

Former Member
0 Likes
1,142

this error is coming due to fm 'REUSE_ALV_FIELDCATALOG_MERGE' here it is reading the report. So check any of your line width is more than 72 or not. Just reduce the length of each line(in your code) below 72. it will work. even for commented lines also reduce the length less than 72.

regards

shiba dutta

Read only

Former Member
0 Likes
1,142

Hi all.....

No way, im facing the same problem again here and though it didnt work after i've changed the internal table decalration.....

Reply me the clear one....

thanks

sankar

Read only

0 Likes
1,142

Hi,

think inthis program in the function module REUSE_ALV_FIELDCATALOG_MERGE

in exporting parameter you are using -->

I_INTERNAL_TABNAME = <itab_name>

this <itab_name> is not like any physical structure .So make a structure through SE11 like <itab_name>.

u have to create a structure in SE11 with the fields, and then pass that structure into the REUSE_ALV_FIELDCATALOG_MERGE , in the parameter

I_internal_tabname = ' structure name '.

even though u create a structure, u need to pass it to the table parameter.

then it will work.

Otherwise manually build the fieldcatalog.

find the following code as an example.

DATA : l_pos TYPE i VALUE 1.

ist_fieldcat-fieldname = 'POSID'.

ist_fieldcat-tabname = 'IT_FINAL'.

ist_fieldcat-outputlen = 24.

ist_fieldcat-col_pos = l_pos.

  • ist_fieldcat-ddictxt = 'L'.

ist_fieldcat-key = 'X'.

ist_fieldcat-seltext_l = 'Appropriation Request Number'.

APPEND ist_fieldcat.

CLEAR ist_fieldcat.

l_pos = l_pos + 1.

ist_fieldcat-fieldname = 'TXT04'.

ist_fieldcat-tabname = 'IT_FINAL'.

ist_fieldcat-outputlen = 4.

ist_fieldcat-col_pos = l_pos.

ist_fieldcat-ddictxt = 'L'.

  • ist_fieldcat-key = 'X'.

ist_fieldcat-seltext_l = 'Status'.

ist_fieldcat-EMPHASIZE = 'C400'.

APPEND ist_fieldcat.

CLEAR ist_fieldcat.

l_pos = l_pos + 1.

ist_fieldcat-fieldname = 'UDATE'.

ist_fieldcat-tabname = 'IT_FINAL'.

ist_fieldcat-outputlen = 8.

ist_fieldcat-col_pos = l_pos.

ist_fieldcat-ddictxt = 'L'.

ist_fieldcat-key = 'X'.

ist_fieldcat-seltext_l = 'Status Date'.

  • IST_FIELDCAT-EMPHASIZE = 'C600'.

APPEND ist_fieldcat.

CLEAR ist_fieldcat.

<i><b>Reward point if find helpful

Debjani</b></i>

Read only

Former Member
0 Likes
1,142

Hi,

do like below.this it_structure we will in this example case

<b>TABLES:MARA.

DATA ITAB LIKE MARA OCCURS 0 WITH HEADER LINE.

SELECT * FROM MARA INTO TABLE ITAB UP TO 25 ROWS.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

I_STRUCTURE_NAME = 'MARA'

TABLES

T_OUTTAB = ITAB.</b>

ur program

************************************

TABLES:lfa1.

DATA:BEGIN OF itab OCCURS 100,

lifnr LIKE lfa1-lifnr,

land1 LIKE lfa1-land1,

name1 LIKE lfa1-name1,

ort01 LIKE lfa1-ort01,

regio LIKE lfa1-regio,

sortl LIKE lfa1-sortl,

END OF itab.

data: i_repid like sy-repid,

i_tabix like sy-tabix.

TYPE-POOLS: slis.

DATA: fcat TYPE slis_t_fieldcat_alv.

SELECT-OPTIONS: LIFNR FOR LFA1-LIFNR.

SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF

TABLE itab WHERE lifnr IN LIFNR.

clear i_tabix.

describe table itab lines i_tabix.

if i_tabix lt 1.

write:/ 'No materials found'.

exit.

endif.

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 = fcat.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = i_repid

IT_FIELDCAT = fcat

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

I_SAVE = 'A'

TABLES

T_OUTTAB = ITAB.

rgds,

bharat.

Read only

0 Likes
1,142

Sorry.....Bharat

the one u said,i did it already and its working fine.....

but i want to do it in a structure defined datatype......if u can,pls revert me so...

bye n thanks

sankar

Read only

Former Member
0 Likes
1,142

Hi Sankar,

If you are using the FM - REUSE_FIELDCATALOG_MERGE, you can use only a structure/ table existing in the data dictionary.

You cannot use the name of the structure/ table created during RUNTIME.

So create a ZStructure in SE11 and then use that for structure in the FM. It will work. I had same problem some time ago and after creating a structure in data dictionary, the issue was resolved.

Reward points if answer is informatory.

Best Regards,

Ram.

Read only

0 Likes
1,142

Hi RAM,

Sorry for the late reply.....

i'll do it like what u said and back to reward u if it goes well....

wait for my points...sorry

sankar

Read only

0 Likes
1,142

Hi Sankar,

Were you able to resolve the issue with ALV Field catalog using the Zstructure?

Just curious about the output

Best Regards.

Ram.