02-10-2010 9:55 AM
i have itab1 as Hashed.
when i pass this as out put table for
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
it gives me error,saying hashed type cannot be used..
please suggest the remedy..
02-10-2010 10:09 AM
Hi,
Create another standard table with the same structure of the hashed table and copy the contents using the syntax.
itab_std[] = itab_hashed[].
TYPES: BEGIN OF ty_tab,
vbeln type vbap-vbeln,
posnr type vbap-posnr,
matnr type vbap-matnr,
END OF ty_tab.
DATA gt_tab_hash TYPE HASHED TABLE OF ty_tab WITH UNIQUE KEY vbeln posnr
.
DATA gt_tab_std TYPE STANDARD TABLE OF ty_tab.
SELECT vbeln posnr matnr FROM vbap INTO TABLE gt_tab_hash
up to 100 rows.
gt_tab_std[] = gt_tab_hash.
Br,
Advait
02-10-2010 10:09 AM
Hi,
Create another standard table with the same structure of the hashed table and copy the contents using the syntax.
itab_std[] = itab_hashed[].
TYPES: BEGIN OF ty_tab,
vbeln type vbap-vbeln,
posnr type vbap-posnr,
matnr type vbap-matnr,
END OF ty_tab.
DATA gt_tab_hash TYPE HASHED TABLE OF ty_tab WITH UNIQUE KEY vbeln posnr
.
DATA gt_tab_std TYPE STANDARD TABLE OF ty_tab.
SELECT vbeln posnr matnr FROM vbap INTO TABLE gt_tab_hash
up to 100 rows.
gt_tab_std[] = gt_tab_hash.
Br,
Advait
02-10-2010 10:31 AM
I get the error field it_dev[ is unknown....
REPORT ZMONTHLY_STOCK .
DATA : IT_DEV TYPE ZBIW_MNTH_STK_L .
DATA : IT_DEV2 LIKE STANDARD TABLE OF ZBIW_MNTH_STK.
*Selection-Screen
Parameters : LFMON type LFMON obligatory,
LFGJA type LFGJA obligatory,
BWKEY type BWKEY.
START-OF-SELECTION.
CALL FUNCTION 'ZBW_GET_MONTHLY_STCK4'
EXPORTING
LFGJA = LFGJA
LFMON = LFMON
BWKEY = BWKEY
IMPORTING
IT_STK = IT_DEV
.
IT_DEV2] = IT_DEV[.
IF SY-SUBRC = 0.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
I_STRUCTURE_NAME = 'ZBIW_MNTH_STK'
TABLES
T_OUTTAB = IT_DEV2
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
Edited by: kumar gaurav on Feb 10, 2010 11:33 AM
02-10-2010 10:39 AM
There is no way you can pass hashed table to ALV, create standard table type and pass the hashed table to it i.e std_tb[] = ha_tb[].
now, pass std_tb[] to ALV function module.
Hope it helps....
Vikas
02-10-2010 10:43 AM
hai vikas,
The field "IT_DEV[" is unknown, but there is a field with the similar
name "IT_DEV". .
02-10-2010 10:46 AM
Hello,
What is ZBW_GET_MONTHLY_STCK4 returning ? Why don't you directly get the data into a standard table and then use it in the REUSE_ALV_GRID_DISPLAY ?
Right now you are getting the data into a hashed table, can't you get that in a standard table ? If not then write
IT_DEV2 = IT_DEV
The statement IT_DEV2] = IT_DEV[. does not make any sense as the table is IT_DEV or IT_DEV2 there is no object as IT_DEV[ or IT_DEV2].
Regards,
Sachin
02-10-2010 10:52 AM
Hai Sachin,
My requirement is actually not a report but a FM for BIW to fetch monthly stock data.
pls refer to this thread.
I am caught between 2 situations.
1) for PERFORMANCE i internally declared a table as HASHED .(internal to FM)
2)the FM has a STANDARD table type in its parameters(I cant change that).
02-10-2010 10:54 AM
Are you using the square brackets correctly ?
Like this :
IT_DEV2[ ] = IT_DEV[ ].
Br,
Advait
Changed [ ] due to formatting reasons, but use the square brackets without a space in between.
Edited by: Advait Gode on Feb 10, 2010 11:55 AM
02-10-2010 10:57 AM
this is actualy passing wrong values
IT_DEV2[] = IT_DEV[].
IT_DEV2 gets actualy meanigless figures in its fields...
this gives error
IT_DEV2] = IT_DEV[.
Edited by: kumar gaurav on Feb 10, 2010 11:59 AM
Edited by: kumar gaurav on Feb 10, 2010 12:00 PM
Edited by: kumar gaurav on Feb 10, 2010 12:00 PM
02-10-2010 11:13 AM
IT_DEV2[ ] = IT_DEV[ ].
seems to be right..it works fine in this code....but if the selected records are huge it gives irrelevant values
REPORT ZMONTHLY_STOCK .
DATA : IT_DEV TYPE ZBIW_MNTH_STK_L .
DATA : IT_DEV2 LIKE STANDARD TABLE OF ZBIW_MNTH_STK.
*Selection-Screen
Parameters : LFMON type LFMON obligatory,
LFGJA type LFGJA obligatory,
BWKEY type BWKEY.
START-OF-SELECTION.
SELECT e~MATNR e~BWKEY e~LFGJA e~LFMON e~LBKUM e~SALK3 l~MTART
l~MATKL l~MEINS f~WAERS FROM
MBEWH AS e INNER JOIN
MARA AS l ON e~MATNR = l~MATNR
INNER JOIN
T001K AS n ON e~BWKEY = n~BWKEY
INNER JOIN
T001 AS f ON n~BUKRS = f~BUKRS
INTO CORRESPONDING
FIELDS OF TABLE it_dev
WHERE
e~LFGJA EQ LFGJA AND e~LFMON EQ LFMON.
IF SY-SUBRC = 0.
IT_DEV2[] = IT_DEV[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
I_STRUCTURE_NAME = 'ZBIW_MNTH_STK'
TABLES
T_OUTTAB = IT_DEV2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
02-10-2010 11:58 AM
Hi,
but if the selected records are huge it gives irrelevant values
Can you explain this further what exactly is happening?
One reason as I can see might be because you have declared the 2 internal tables using differenc structures ?
Are the line types of the 2 table types same ?
DATA : IT_DEV TYPE ZBIW_MNTH_STK_L . " ZBIW_MNTH_STK_L, this seems to be a table type, but is the line type ZBIW_MNTH_STK or are the fields same as ZBIW_MNTH_STK?
DATA : IT_DEV2 LIKE STANDARD TABLE OF ZBIW_MNTH_STK.
Also , another thing, you can remove the square brackets , because the internal tables don't have a header line, so no need of using the square brackets.
Br,
Advait
02-10-2010 1:25 PM
Thanks,
i think i made that mistake....
though they have same fields,they are not in same order...
will correct and come bak..
thanks..
02-11-2010 11:43 AM
02-10-2010 10:10 AM
Hello,
you may try the following, create another internal table of standard type and pass the data into this standard table and then pass this table into the FM.
02-10-2010 10:15 AM
If you can use standard table well & good or else before you pass the data to ALV function module transfer Hashed table data into standard table & pass it to ALV.
Ex:
DATA: lt_test TYPE STANDARD TABLE OF vbak,
lt_test1 TYPE HASHED TABLE OF vbak WITH UNIQUE KEY vbeln.
SELECT * FROM vbak INTO TABLE lt_test1.
lt_test[ ] = lt_test1[ ].
You can pass LT_TEST to ALV function module
Regards,
Sudhakar