2008 Aug 21 12:13 PM
how to pass more than one table to REUSE_ALV_GRID_DISPLAY
i have write following type of code
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = ' PRODUCTION REPORT'
IT_FIELDCAT = T_FIELDCAT
TABLES
T_OUTTAB = it_po
itab1 = itab1
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.
when i pass second table that time error is occurred.
please help me.
Regards.
sam.
2008 Aug 21 12:32 PM
Hi
You Can't pass two tables in the F.M REUSE_ALV_GRID_DISPLAY's T_OUTTAB
Other wise you just merge the two tables contents into one table and pass it to the REUSE_ALV_GRID_DISPLAY's T_OUTTAB.
Thanks & Regards
Mallikharjuna Reddy
how to pass more than one table to REUSE_ALV_GRID_DISPLAY
i have write following type of code
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_GRID_TITLE = ' PRODUCTION REPORT'
IT_FIELDCAT = T_FIELDCAT
TABLES
T_OUTTAB = it_po
itab1 = itab1
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.
when i pass second table that time error is occurred.
please help me.
Regards.
sam.
2008 Aug 21 12:32 PM
Hi
You Can't pass two tables in the F.M REUSE_ALV_GRID_DISPLAY's T_OUTTAB
Other wise you just merge the two tables contents into one table and pass it to the REUSE_ALV_GRID_DISPLAY's T_OUTTAB.
Thanks & Regards
Mallikharjuna Reddy
2008 Aug 21 12:36 PM
You cannot pass more than one table when you are using the ALV Grid Function.
You can pass two tables only to Hierarchy ALV function. So if there is a realtion between two tables and you want to see the Hierarchy of the two tables then you can use Hierarchy function. Check the sample BALVHD01
Or else you have to Go for Blocked List ALV. For this also you will pass only one table.
Check the program BALVBT01
When you are using Block list for two tables.
you need to call BLOCK LIST APPEND Function two times one for each.
2008 Aug 21 1:21 PM
Hi sam,
it is showing error because u r passing second table in a simple report program. u cann't pass two tables
in REUSE_ALV_GRID_DISPLAY which is a function module for simple report. Basically using ALV
v can have 3 types of reports :
1. Simple Report
2. Block Report
3. Hierarchical Sequential Report
in block and hierarchical report u can pass 2 tables not in simple report function modules.
hope it will help in clearing ur doubt.
Regards
Saurabh
2008 Aug 21 1:29 PM
Hi
For passing data from two different tables you can use
Reuse_alv_fieldcatalog_merge.
Refer to this sample code
*"Table declarations...................................................
TABLES:
spfli,
sflight.
*"Type pools...................................................
TYPE-POOLS:
slis.
*"Selection screen elements............................................
SELECT-OPTIONS:
s_carrid FOR spfli-carrid,
s_connid FOR spfli-connid.
*"Data declarations...................................................
DATA:
BEGIN OF t_spfli OCCURS 0,
carrid LIKE spfli-carrid,
connid LIKE spfli-connid,
cityfrom LIKE spfli-cityfrom,
cityto LIKE spfli-cityto,
END OF t_spfli.
*"Data declarations...................................................
DATA:
BEGIN OF fs_sflight,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
seatsmax LIKE sflight-seatsmax,
seatsocc LIKE sflight-seatsocc,
END OF fs_sflight.
*"Data declarations...................................................
DATA:
BEGIN OF t_final OCCURS 0,
carrid LIKE spfli-carrid,
connid LIKE spfli-connid,
cityfrom LIKE spfli-cityfrom,
cityto LIKE spfli-cityto,
fldate LIKE sflight-fldate,
seatsmax LIKE sflight-seatsmax,
seatsocc LIKE sflight-seatsocc,
END OF t_final.
*"--------------------------------------------------------------------*
* Internal table to hold sflight details *
*"--------------------------------------------------------------------*
DATA:
t_sflight LIKE
STANDARD TABLE OF fs_sflight.
*"--------------------------------------------------------------------*
* Internal table to hold fieldcatlog *
*"--------------------------------------------------------------------*
DATA:
t_fieldcat TYPE slis_t_fieldcat_alv,
l_fieldcat LIKE LINE OF t_fieldcat.
*"Data declarations...................................................
DATA:
w_layout TYPE slis_layout_alv,
w_repid LIKE sy-repid.
*"--------------------------------------------------------------------*
* START-OF-SELECTION EVENT *
*"--------------------------------------------------------------------*
START-OF-SELECTION.
w_repid = sy-repid.
SELECT carrid
connid
cityfrom
cityto
FROM spfli
INTO TABLE t_spfli
WHERE carrid IN s_carrid
AND connid IN s_connid.
SELECT carrid
connid
fldate
seatsmax
seatsocc
FROM sflight
INTO TABLE t_sflight
FOR ALL ENTRIES IN t_spfli
WHERE carrid EQ t_spfli-carrid
AND connid EQ t_spfli-connid.
LOOP AT t_sflight INTO fs_sflight.
READ TABLE t_spfli WITH KEY carrid = fs_sflight-carrid
connid = fs_sflight-connid.
IF sy-subrc EQ 0.
t_final-carrid = t_spfli-carrid.
t_final-connid = t_spfli-connid.
t_final-cityfrom = t_spfli-cityfrom.
t_final-cityto = t_spfli-cityto.
t_final-fldate = fs_sflight-fldate.
t_final-seatsmax = fs_sflight-seatsmax.
t_final-seatsocc = fs_sflight-seatsocc.
APPEND t_final.
ENDIF. " IF sy-subrc eq 0
CLEAR t_final.
ENDLOOP. " LOOP AT t_sflight....
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = w_repid
i_internal_tabname = 'T_FINAL'
i_inclname = w_repid
CHANGING
ct_fieldcat = t_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.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = w_layout
it_fieldcat = t_fieldcat
TABLES
t_outtab = t_final
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,
Sravanthi
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |