10-24-2008 3:05 PM
HI every one,
I want to dispaly alv grid. but i came to know that without designing fieldcat by using the below FM we can display the output in grid formate..buut i didn't grid formate by using the below code..
can any one tell me the wayy.
REPORT Z3MGLALV21.
TYPE-POOLS: slis.
DATA: BEGIN OF itab OCCURS 0,
matnr(18),
werks(4),
ekgrp(3),
END OF itab.
DATA: i_fieldcat TYPE TABLE OF slis_fieldcat_alv,
w_fieldcat TYPE slis_fieldcat_alv.
SELECT matnr
werks
ekgrp
FROM marc
INTO TABLE itab.
WHERE WERKS = '1000'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-CPROG
I_INTERNAL_TABNAME = 'ITAB'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = sy-cprog
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = i_fieldcat
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.
10-24-2008 3:16 PM
you are not calling the ALV function at all , how it will display..?
TYPE-POOLS: slis.
DATA: BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
werks LIKE marc-werks,
ekgrp LIKE marc-ekgrp,
END OF itab.
DATA: i_fieldcat TYPE TABLE OF slis_fieldcat_alv,
w_fieldcat TYPE slis_fieldcat_alv.
SELECT matnr
werks
ekgrp
FROM marc
INTO TABLE itab.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc NE 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_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = i_fieldcat
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1.
10-25-2008 9:24 AM
hi,
try to refer to the following link
http://www.saptechnical.com/Tutorials/ALV/SampleALVGridProgram.htm
i hope it helps
regards
arjun
Edited by: arjun on Oct 25, 2008 10:24 AM
10-25-2008 6:25 PM
Hai try this one
type-pools: slis.
Data: begin of it_mara occurs 2,
matnr like mara-matnr, "material Number
meins like mara-meins, "Bse unit of measurement
ersda like mara-ersda, " on which date was created
end of it_mara,
Data: i_fieldcat type slis_t_fieldcat_alv.
select
matnr "material Number
meins "Bse unit of measurement
ersda " on which date was created
into table it_mara
call function module
ALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'It_mara'
i_inclname = sy-repid
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc NE 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_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = i_fieldcat
TABLES
t_outtab = it_mara
EXCEPTIONS
program_error = 1.
10-25-2008 1:27 PM
Hi,
my dear friend.for displaying the output in alv grid format u have to use CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' along with what u have used.so try as below,u'l definitely get the output
TYPE-POOLS: slis.
DATA: BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
werks LIKE marc-werks,
ekgrp LIKE marc-ekgrp,
END OF itab.
DATA: i_fieldcat TYPE TABLE OF slis_fieldcat_alv,
w_fieldcat TYPE slis_fieldcat_alv.
SELECT matnr
werks
ekgrp
FROM marc
INTO TABLE itab.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'itab'
i_inclname = sy-repid
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc NE 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_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = i_fieldcat
TABLES
t_outtab = itab(internal table)
EXCEPTIONS
program_error = 1.
10-25-2008 4:05 PM
Hi Mahaboob,
Function Moudle
'REUSE_ALV_FIELDCATALOG_MERGE'
the structure which you are passing to create a field catalog should be present inthe DDIC. Then only it will automatically it will create a field catalog.
You need to call the Function Module
REUSE_ALV_GRID_DISPLAY
. otherwise you would not be able to display the ALV on the output.
Thanks,
Chidanand
10-25-2008 6:47 PM
Hi Mehaboob,
First try to under what you are doing and how you are coding and what effect will have on the output if u write anything please this follow this steps to become a good programmer.
You are saying i want to display report in ALV grid and there is no declaration for grid formate (REUSE_ALV_GRID_DISPLAY) how will you get then.
All the above posts are helpful to achieve your issue go ahead.
My suggestion try till your level and then you post.
Cheers!!
Venkat
10-28-2008 11:33 AM
Hi all,
I have run this program and it is working fine. But this same logic when I used in other program I am getting dump.
The dump location is:
FM: K_KKB_FIELDCAT_MERGE
Line number: 336
Read report l_prog_tab_local into l_abap_source.
Please tell me what to do..
10-28-2008 11:36 AM
may be you hardcoded the program name. which is not there. check it once. use sy-repid/sy-cprog where ever you want to refer the program name. i am sure the mistake is in that place.
10-28-2008 11:52 AM
No vijay,
Here the problem was, for the last line i have wrote 80 char.
Now my code is wroking..
10-28-2008 11:57 AM
11-10-2008 2:32 PM