06-15-2011 6:44 PM
HI Experts,
I am using FM REUSE_ALV_GRID_DISPLAY to display values using ALV Grid.
My requirement is to add the new column UOM price at 7th of field catalog. In order to get UOM price, I added UOM Price in field catalog and OUTTAB at position 7. When I passed the value to FM REUSE_ALV_GRID_DISPLAY, I am getting value of 6th column displayed on 7th as well.
Even though I have different set of data in column 7 of OUTTAB, I am getting 6th column value. Kindly suggest what else I need to do.
Thanks,
Krishna.
06-15-2011 9:23 PM
Try executing the REUSE_ALV_GRID_DISPLAY with I_BYPASSING_BUFFER with 'X' once. If you are already doing that, Paste your code which populates the fieldcatalog.
06-15-2011 9:34 PM
Hi Suman,
I tried passing the value to buffer. Still issue persisits.
Krishna
06-15-2011 9:48 PM
06-15-2011 10:02 PM
Why not,
TYPES : BEGIN OF ty_outtab,
kunnr TYPE kunnr,
payer(10) TYPE c,
name1(35) TYPE c ,
matnr TYPE matnr ,
bukrs(4) TYPE c ,
menge TYPE Menge,
space1 TYPE char20,
uomprice TYPE uprice_kr,
meins TYPE j_1imeins,
netprice TYPE netprice,
vrkme TYPE vrkme,
value TYPE -value,
waers TYPE waers,
invoice(10) TYPE c,
END OF ty_outtab.
PERFORM field_catalog USING 'KUNNR' text-004 10. " PREPARE FOR RECORD NO
PERFORM field_catalog USING 'PAYER' text-018 10. "Payer "Defect 20492 NA15480
PERFORM field_catalog USING 'NAME1' text-005 35. " PREPARE FOR COMPANY CODE
PERFORM field_catalog USING 'MATNR' text-006 18. " PREPARE FOR GL ACCOUNT
PERFORM field_catalog USING 'BUKRS' text-007 5. " VALID FROM
PERFORM field_catalog USING 'MENGE' text-008 17. " VALID TO
*PERFORM field_catalog USING 'UPRICE_KR' text-021 20. " UOM price newly added column*
PERFORM field_catalog USING 'MEINS' text-25 20.
PERFORM field_catalog USING 'NETPRICE' text-25 20 .
PERFORM field_catalog USING 'VRKME' text-020 17.
PERFORM field_catalog USING 'VALUE' text-26 20.
PERFORM field_catalog USING 'WAERS' text-27 20.
PERFORM field_catalog USING 'INVOICE' text-015 10. " REASON
FORM field_catalog USING p_lv_fieldname TYPE slis_fieldname p_lv_text TYPE slis_text40 p_len TYPE dd03p-outputlen.
gv_count = gv_count + 1.
CLEAR gs_field.
gs_field-fieldname = p_lv_fieldname.
gs_field-col_pos = gv_count.
gs_field-seltext_m = p_lv_text.
gs_field-outputlen = 20. "Defect 20492 NA15480
gs_field-outputlen = p_len. "Defect 20492 NA15480
APPEND gs_field TO gt_field.
CLEAR gs_field.
ENDFORM.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_top_of_page = 'TOP_OF_PAGE'
i_bypassing_buffer = gc_x
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
it_fieldcat = gt_field[]
IT_EXCLUDING =
i_default = gc_x
i_save = gc_a
IS_VARIANT =
TABLES
t_outtab = gt_display[]
t_outtab = gt_outtab[]
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.
06-15-2011 10:31 PM
In the code you provided, the UOM perform is commented ? Also the Fieldcatalog is not properly populated. Try to look at the output clicking the Print Preview which shows the ALV list. If the fieldcatalog is not properly populated, it will not show up properly. Please refer below code for an idea as what values are to be passed if you are building the fieldcatalog completely on your own.
* Character field - CHAR
Clear K_Fieldcat.
K_Fieldcat-col_pos = V_Pos.
K_Fieldcat-fieldname = 'MATNR'.
K_Fieldcat-seltext_m = 'Material'.
K_Fieldcat-ddictxt = 'M'.
K_Fieldcat-outputlen = 18.
Append K_Fieldcat to I_Fieldcat.
Add 1 to V_Pos.
* Quantity field - QUAN
Clear K_Fieldcat.
K_Fieldcat-col_pos = V_Pos.
K_Fieldcat-fieldname = 'LFIMG'.
K_Fieldcat-qfieldname = 'VRKME'.
K_Fieldcat-quantity = 'X'.
K_Fieldcat-qtabname = 'I_RECORDS'.
K_Fieldcat-seltext_m = 'Dlv. qty.'.
K_Fieldcat-ddictxt = 'M'.
K_Fieldcat-outputlen = 17.
Append K_Fieldcat to I_Fieldcat.
Add 1 to V_Pos.
* Unit key for QUAN field - UNIT
Clear K_Fieldcat.
K_Fieldcat-col_pos = V_Pos.
K_Fieldcat-fieldname = 'VRKME'.
K_Fieldcat-tabname = 'I_RECORDS'.
K_Fieldcat-reptext_ddic = 'SU'.
K_Fieldcat-outputlen = 3.
Append K_Fieldcat to I_Fieldcat.
Add 1 to V_Pos.
* Amount field - DEC
Clear K_Fieldcat.
K_Fieldcat-col_pos = V_Pos.
K_Fieldcat-fieldname = 'UMVKZ'.
K_Fieldcat-seltext_m = 'Numerator'.
K_Fieldcat-ddictxt = 'M'.
K_Fieldcat-outputlen = 5.
Append K_Fieldcat to I_Fieldcat.
Add 1 to V_Pos.
* Currency field - CURR
Clear K_Fieldcat.
K_Fieldcat-col_pos = V_Pos.
K_Fieldcat-fieldname = 'KZWI1'.
K_Fieldcat-currency = 'X'.
K_Fieldcat-cfieldname = 'WAERK'.
K_Fieldcat-ctabname = 'I_RECORDS'.
K_Fieldcat-seltext_m = 'Subtotal 1'.
K_Fieldcat-ddictxt = 'M'.
K_Fieldcat-outputlen = '18'.
Append K_Fieldcat to I_Fieldcat.
Add 1 to V_Pos.
* Currency key, referenced by CURR fields - CUKY
Clear K_Fieldcat.
K_Fieldcat-col_pos = V_Pos.
K_Fieldcat-fieldname = 'WAERK'.
K_Fieldcat-tabname = 'I_RECORDS'.
K_Fieldcat-seltext_m = 'Doc. Curr.'.
K_Fieldcat-ddictxt = 'M'.
K_Fieldcat-outputlen = '5'.
Append K_Fieldcat to I_Fieldcat.
or better approach to manually populate the fieldcatalog would be reference with the dictionary fields...
* Quantity field - QUAN
Clear K_Fieldcat.
K_Fieldcat-col_pos = V_Pos.
K_Fieldcat-fieldname = 'LFIMG'.
K_Fieldcat-ref_tabname = 'LIPS'.
Append K_Fieldcat to I_Fieldcat.
Add 1 to V_Pos.
* Unit key for QUAN field - UNIT
Clear K_Fieldcat.
K_Fieldcat-col_pos = V_Pos.
K_Fieldcat-fieldname = 'VRKME'.
K_Fieldcat-ref_tabname = 'LIPS'.
Append K_Fieldcat to I_Fieldcat.
Add 1 to V_Pos.
06-15-2011 11:31 PM
Thanks for code,
I accept we need to add DDIC reference in catalog. With out that also new field which I added was appearing on the O/P. It was 7th column, issue is with data. 6th column data was been copied to 7th. I changed column position to 13th, then also, 12th column data was been copied to 13th.
Thanks,
Krishna
06-16-2011 3:25 PM
Problem was resolved by own, created one data base type UOM_PRICE.
06-16-2011 3:26 PM
06-24-2011 9:16 PM
If we change Itab field name same as catalog name, issue will be resolved.