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

UNexpected problem with ALV

Former Member
0 Likes
585

Hi all,

I am trying an ALV report. The problem here is, If I define an internal table like this

TYPES: BEGIN OF t_ekko ,

ebeln LIKE ekko-ebeln, " Purchasing Document Number

bukrs LIKE ekko-bukrs, " Company Code

bsart LIKE ekko-bsart, " Purchasing Document Type

ernam LIKE ekko-ernam, " Name of Person who Created

" the Object

lifnr LIKE ekko-lifnr, " Account Number of the Vendor

line_color(4) TYPE c, " Line color

END OF t_ekko.

*---- Table Memory Allocation.

DATA i_ekko TYPE t_ekko OCCURS 0.

*---- Work area Declaration.

DATA wa_ekko LIKE LINE OF i_ekko.

when I call the FM reuse_alv_fieldcatalog_merge the field catalog is not being populated.

But when I change the declaration like this

data : begin of i_ekko occurs 0,

ebeln LIKE ekko-ebeln, " Purchasing Document Number

bukrs LIKE ekko-bukrs, " Company Code

bsart LIKE ekko-bsart, " Purchasing Document Type

ernam LIKE ekko-ernam, " Name of Person who Created

" the Object

lifnr LIKE ekko-lifnr, " Account Number of the Vendor

line_color(4) TYPE c, " Line color

end of i_ekko.

this is working properly. But there are other instances where even the types declaration worked for me. I do not understand the strange behavioUr of ALV. If anyone can explain please explain me this.

Regards,

Varun.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
565

Hi Varun,

You can try to fill the field catalog manually in the program instead of using FM reuse_alv_fieldcatalog_merge.

DATA: ls_fcat type lvc_s_fcat.

clear: ls_fcat.

ls_fcat-fieldname = 'CARRID'.

ls_fcat-inttype = 'C'.

ls_fcat-outputlen = '3'.

ls_fcat-coltext = 'Carrier ID'.

ls_fcat-seltext = 'Carrier ID'.

append ls_fcat to pt_fieldcat.

clear: ls_fcat.

ls_fcat-fieldname = 'CONNID'.

ls_fcat-inttype = 'C'.

ls_fcat-outputlen = '3'.

ls_fcat-coltext = 'Connection ID'.

ls_fcat-seltext = 'Connection ID'.

append ls_fcat to pt_fieldcat.

You can also use a macro for this. Hope it helps.

Regards,

Neeraj Gupta

5 REPLIES 5
Read only

Former Member
0 Likes
565

Hi Varun,

The field catalog will only be built up when refering to Data dictionary structures directly. In the first example you have defined a TYPE locally.

Regards,

John.

Read only

0 Likes
565

Hi,

I did not understand what you mean by saying declaring <b>types locally</b>. But it worked fine the same way for other program. So where do you want me to declare types ?

Regards,

Varun.

Read only

0 Likes
565

Hi,

if you declare the structure Globally (i mean in SE11) then it will come or else it won't.

so if you want to build it based on structure then you need to declare it globally. and use the FM.

regards

vijay

Read only

Former Member
0 Likes
566

Hi Varun,

You can try to fill the field catalog manually in the program instead of using FM reuse_alv_fieldcatalog_merge.

DATA: ls_fcat type lvc_s_fcat.

clear: ls_fcat.

ls_fcat-fieldname = 'CARRID'.

ls_fcat-inttype = 'C'.

ls_fcat-outputlen = '3'.

ls_fcat-coltext = 'Carrier ID'.

ls_fcat-seltext = 'Carrier ID'.

append ls_fcat to pt_fieldcat.

clear: ls_fcat.

ls_fcat-fieldname = 'CONNID'.

ls_fcat-inttype = 'C'.

ls_fcat-outputlen = '3'.

ls_fcat-coltext = 'Connection ID'.

ls_fcat-seltext = 'Connection ID'.

append ls_fcat to pt_fieldcat.

You can also use a macro for this. Hope it helps.

Regards,

Neeraj Gupta

Read only

Former Member
0 Likes
565

HI,

can you define the internal table like the below and try

DATA i_ekko TYPE standard table of t_ekko with header line.

regards

Sai easwar