‎2006 Feb 07 1:44 PM
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.
‎2006 Feb 07 2:14 PM
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
‎2006 Feb 07 1:48 PM
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.
‎2006 Feb 07 2:01 PM
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.
‎2006 Feb 07 2:02 PM
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
‎2006 Feb 07 2:14 PM
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
‎2006 Feb 07 4:06 PM
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