‎2008 Jun 03 1:39 PM
Hello Experts,
I have a problem with dynamic ALV, Please see below:
I am passing internal table to FM as below:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_f_repid
is_layout = l_r_layout
it_fieldcat = g_t_fieldcat
TABLES
t_outtab = <dyn_table>
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.
just before execusion of the FM data in the internal table is:
<dyn_table>
WERKS : CP01
MTART : FERT
MATNR : 03011782730066M
MAKTX : REPLACEABLE-BULB HEADLAMP
MATKL : SD120
PRDHA : DC00019SD120308178
SALK3 : 185.00
WAERS : CZK
JAN05F : 0.000
FEB05F : 120.000
MAR05F: 0.000
APR05F : 0.000
AMMNG : 30.000
ADMNG : 1.364
but in display it is showing some other data as below:
WERKS : CP01
MTART : FERT
MATNR : 03011782730066M
MAKTX : REPLACEABLE-BULB HEADLAMP
MATKL : SD120
PRDHA : DC00019SD120308178
SALK3 : 185.00
WAERS : CZK
JAN05F : CZK
FEB05F : CZK
MAR05F : CZK
APR05F CZK AMMNG : 30.000
ADMNG : 1.364
Can anybody tell me where I am doing mistake.
Regards.
Sami.
‎2008 Jun 03 2:13 PM
IF p_con = 'X'.
l_f_month = s_spmonc-low.
l_f_char = 'c'.
DESCRIBE TABLE r_spmonc LINES line.
DO line TIMES.
PERFORM get_month USING l_f_month
l_f_char
CHANGING l_f_field.
text-data = l_f_field .
xfc-fieldname = l_f_field.
xfc-datatype = 'QUAN'.
xfc-intlen = 13.
xfc-decimals = 3.
xfc-COL_POS = l_f_field_pos.
APPEND xfc TO ifc.
MOVE-CORRESPONDING xfc TO l_t_fieldcat.
l_t_fieldcat-fieldname = xfc-fieldname.
CONCATENATE l_f_field(5) text-005 INTO l_f_head.
l_t_fieldcat-seltext_s =
l_t_fieldcat-seltext_m =
l_t_fieldcat-seltext_l = l_f_head.
APPEND l_t_fieldcat TO g_t_fieldcat.
APPEND text.
CLEAR : l_t_fieldcat,xdetails, xfc.
l_f_field_pos = l_f_field_pos + 1.
CONCATENATE l_f_month '01' INTO l_f_date.
l_f_date = l_f_date + 31.
l_f_month = l_f_date(6).
CLEAR: l_f_date.
l_f_field_pos = l_f_field_pos + 1.
ENDDO.
check in debugging when l_t_fieldcat-fieldname = xfc-fieldname..
what value are you getting xfc-fieldname. if you are getting JAN Check whether it is in Caps or not.
if not caps then convert them to caps.
‎2008 Jun 03 1:44 PM
check in your fieldcatalog
instead of giving fieldname as WAERS
JAN05F
FEB05F etc, you might had given the same fieldname for all of them like below.
wa_fieldcat-tabname = 'I_FINAL1'.
wa_fieldcat-fieldname = 'WAERS'.
wa_fieldcat-seltext_m = 'Loading Dt'.
wa_fieldcat-key = ' '. "SUBTOTAL KEY
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'I_FINAL1'.
wa_fieldcat-fieldname = 'WAERS'.
wa_fieldcat-seltext_m = 'Loading Dt'.
wa_fieldcat-key = ' '. "SUBTOTAL KEY
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
change the fieldnames
‎2008 Jun 03 1:49 PM
Thanks for immediate reply.
I am preparing my field cat. as below:
xfc-fieldname = 'WAERS'.
xfc-datatype = 'CUKY'.
xfc-intlen = 5.
xfc-inttype = 'C'.
xfc-decimals = 0.
xfc-COL_POS = l_f_field_pos.
APPEND xfc TO ifc.
MOVE-CORRESPONDING xfc TO l_t_fieldcat.
l_t_fieldcat-fieldname = xfc-fieldname.
l_t_fieldcat-seltext_s =
l_t_fieldcat-seltext_m =
l_t_fieldcat-seltext_l = text-014.
APPEND l_t_fieldcat TO g_t_fieldcat.
CLEAR : l_t_fieldcat,xdetails,xfc.
l_f_field_pos = l_f_field_pos + 1.
IF p_con = 'X'.
l_f_month = s_spmonc-low.
l_f_char = 'c'.
DESCRIBE TABLE r_spmonc LINES line.
DO line TIMES.
PERFORM get_month USING l_f_month
l_f_char
CHANGING l_f_field.
text-data = l_f_field .
xfc-fieldname = l_f_field.
xfc-datatype = 'QUAN'.
xfc-intlen = 13.
xfc-decimals = 3.
xfc-COL_POS = l_f_field_pos.
APPEND xfc TO ifc.
MOVE-CORRESPONDING xfc TO l_t_fieldcat.
l_t_fieldcat-fieldname = xfc-fieldname.
CONCATENATE l_f_field(5) text-005 INTO l_f_head.
l_t_fieldcat-seltext_s =
l_t_fieldcat-seltext_m =
l_t_fieldcat-seltext_l = l_f_head.
APPEND l_t_fieldcat TO g_t_fieldcat.
APPEND text.
CLEAR : l_t_fieldcat,xdetails, xfc.
l_f_field_pos = l_f_field_pos + 1.
CONCATENATE l_f_month '01' INTO l_f_date.
l_f_date = l_f_date + 31.
l_f_month = l_f_date(6).
CLEAR: l_f_date.
l_f_field_pos = l_f_field_pos + 1.
ENDDO.
Please help me..
Sami.
‎2008 Jun 03 1:45 PM
Hello,
Please review the field catalog it_fieldcat , you must have an problem on it (referring to the same field name).
Regards.
‎2008 Jun 03 2:13 PM
IF p_con = 'X'.
l_f_month = s_spmonc-low.
l_f_char = 'c'.
DESCRIBE TABLE r_spmonc LINES line.
DO line TIMES.
PERFORM get_month USING l_f_month
l_f_char
CHANGING l_f_field.
text-data = l_f_field .
xfc-fieldname = l_f_field.
xfc-datatype = 'QUAN'.
xfc-intlen = 13.
xfc-decimals = 3.
xfc-COL_POS = l_f_field_pos.
APPEND xfc TO ifc.
MOVE-CORRESPONDING xfc TO l_t_fieldcat.
l_t_fieldcat-fieldname = xfc-fieldname.
CONCATENATE l_f_field(5) text-005 INTO l_f_head.
l_t_fieldcat-seltext_s =
l_t_fieldcat-seltext_m =
l_t_fieldcat-seltext_l = l_f_head.
APPEND l_t_fieldcat TO g_t_fieldcat.
APPEND text.
CLEAR : l_t_fieldcat,xdetails, xfc.
l_f_field_pos = l_f_field_pos + 1.
CONCATENATE l_f_month '01' INTO l_f_date.
l_f_date = l_f_date + 31.
l_f_month = l_f_date(6).
CLEAR: l_f_date.
l_f_field_pos = l_f_field_pos + 1.
ENDDO.
check in debugging when l_t_fieldcat-fieldname = xfc-fieldname..
what value are you getting xfc-fieldname. if you are getting JAN Check whether it is in Caps or not.
if not caps then convert them to caps.