2010 Apr 16 4:52 AM
Hi
I 'm getting correct values in the final internal table i_outtab .But whenpass this Internal table into the REUSE_ALV_GRID_DISPLAy , i'm not getting the correct value for one column . it is taking values from the preceeding column .
The following code shows the field catalog im populating
PERFORM f_build_table USING:
c_pname1 lc_pname1_txt c_space c_space,
c_pname2 lc_pname2_txt c_space c_space,
c_pname3 lc_pname3_txt c_space c_space,
c_ernam lc_ernam_txt c_ernam c_vbmtv,
c_pernr lc_zvpartner c_pernr c_vbpa.
FORM f_build_table USING p_var1 p_var2 p_var3 p_var4.
CONSTANTS: lc_l TYPE c VALUE 'L'.
wa_fieldcat-fieldname = p_var1.
wa_fieldcat-seltext_l = p_var2.
wa_fieldcat-seltext_m = p_var2.
wa_fieldcat-col_pos = 0.
wa_fieldcat-ddictxt = lc_l.
wa_fieldcat-no_convext = space.
IF p_var3 NE c_space.
wa_fieldcat-ref_tabname = p_var4 .
wa_fieldcat-ref_fieldname = p_var3.
ENDIF.
" Start of addition HPQC 1757, USBILJ00
IF p_var1 EQ c_zcst_kwert OR
p_var1 EQ c_zv6d_kwert. "Set the data type
wa_fieldcat-datatype = 'CURR'.
wa_fieldcat-inttype = 'P'.
wa_fieldcat-intlen = 13.
ENDIF.
IF p_var1 EQ c_zsmr_kbetr. "Set the data type
wa_fieldcat-datatype = 'CURR'.
wa_fieldcat-inttype = 'P'.
wa_fieldcat-intlen = 14.
ENDIF.
" End of addition HPQC 1757, USBILJ00
Start of add USGUMR00
IF p_var1 EQ c_zbacko OR
p_var1 EQ c_zvoidh. "Set the data type
wa_fieldcat-datatype = 'DATS'.
wa_fieldcat-inttype = 'D'.
wa_fieldcat-intlen = 8.
ENDIF.
End of Addition, USGUMR00
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. " F_BUILD_FIELD_CATALOG
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_interface_check = ' '
i_callback_program = lv_repid
i_callback_user_command = c_f_user_command
i_callback_pf_status_set = c_f_set_pf_status
is_layout = wa_layout
it_fieldcat = i_fieldcat
it_excluding = i_excluding
i_callback_html_top_of_page = 'F_HTML_TOP_OF_PAGE'
i_save = lv_save
is_variant = wa_variant2
it_events = i_events
it_event_exit = i_event_exit
TABLES
t_outtab = i_outtab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
No required processing.
ENDIF.
but i'm not getting values for the last column which i have passedin to the field catalog . But i can see the correct values in the i_outtab which is my final internal table .
There is some problem in the field catalog .
I have checked the data declarations and constant declarations . I could not figure out the bug .
So Can anybody help me in fixng this issue .
Thanks in advance
pavan
Hi
I 'm getting correct values in the final internal table i_outtab .But whenpass this Internal table into the REUSE_ALV_GRID_DISPLAy , i'm not getting the correct value for one column . it is taking values from the preceeding column .
The following code shows the field catalog im populating
PERFORM f_build_table USING:
c_pname1 lc_pname1_txt c_space c_space,
c_pname2 lc_pname2_txt c_space c_space,
c_pname3 lc_pname3_txt c_space c_space,
c_ernam lc_ernam_txt c_ernam c_vbmtv,
c_pernr lc_zvpartner c_pernr c_vbpa.
FORM f_build_table USING p_var1 p_var2 p_var3 p_var4.
CONSTANTS: lc_l TYPE c VALUE 'L'.
wa_fieldcat-fieldname = p_var1.
wa_fieldcat-seltext_l = p_var2.
wa_fieldcat-seltext_m = p_var2.
wa_fieldcat-col_pos = 0.
wa_fieldcat-ddictxt = lc_l.
wa_fieldcat-no_convext = space.
IF p_var3 NE c_space.
wa_fieldcat-ref_tabname = p_var4 .
wa_fieldcat-ref_fieldname = p_var3.
ENDIF.
" Start of addition HPQC 1757, USBILJ00
IF p_var1 EQ c_zcst_kwert OR
p_var1 EQ c_zv6d_kwert. "Set the data type
wa_fieldcat-datatype = 'CURR'.
wa_fieldcat-inttype = 'P'.
wa_fieldcat-intlen = 13.
ENDIF.
IF p_var1 EQ c_zsmr_kbetr. "Set the data type
wa_fieldcat-datatype = 'CURR'.
wa_fieldcat-inttype = 'P'.
wa_fieldcat-intlen = 14.
ENDIF.
" End of addition HPQC 1757, USBILJ00
Start of add USGUMR00
IF p_var1 EQ c_zbacko OR
p_var1 EQ c_zvoidh. "Set the data type
wa_fieldcat-datatype = 'DATS'.
wa_fieldcat-inttype = 'D'.
wa_fieldcat-intlen = 8.
ENDIF.
End of Addition, USGUMR00
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. " F_BUILD_FIELD_CATALOG
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_interface_check = ' '
i_callback_program = lv_repid
i_callback_user_command = c_f_user_command
i_callback_pf_status_set = c_f_set_pf_status
is_layout = wa_layout
it_fieldcat = i_fieldcat
it_excluding = i_excluding
i_callback_html_top_of_page = 'F_HTML_TOP_OF_PAGE'
i_save = lv_save
is_variant = wa_variant2
it_events = i_events
it_event_exit = i_event_exit
TABLES
t_outtab = i_outtab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
No required processing.
ENDIF.
but i'm not getting values for the last column which i have passedin to the field catalog . But i can see the correct values in the i_outtab which is my final internal table .
There is some problem in the field catalog .
I have checked the data declarations and constant declarations . I could not figure out the bug .
So Can anybody help me in fixng this issue .
Thanks in advance
pavan
2010 Apr 16 5:08 AM
Hi Pavan,
I think you are not clearing the field catalog work area correctly. Could you try this instead:
PERFORM f_build_table USING: c_pname1 lc_pname1_txt c_space c_space,
c_pname2 lc_pname2_txt c_space c_space,
c_pname3 lc_pname3_txt c_space c_space,
c_ernam lc_ernam_txt c_ernam c_vbmtv,
c_pernr lc_zvpartner c_pernr c_vbpa.
FORM f_build_table USING p_var1 p_var2 p_var3 p_var4.
CONSTANTS: lc_l TYPE c VALUE 'L'.
clear: wa_fieldcat. "<=== LINE INSERTED
wa_fieldcat-fieldname = p_var1.
wa_fieldcat-seltext_l = p_var2.
wa_fieldcat-seltext_m = p_var2.
wa_fieldcat-col_pos = 0.
wa_fieldcat-ddictxt = lc_l.
wa_fieldcat-no_convext = space.
IF p_var3 NE c_space.
wa_fieldcat-ref_tabname = p_var4 .
wa_fieldcat-ref_fieldname = p_var3.
ENDIF.
" Start of addition HPQC 1757, USBILJ00
IF p_var1 EQ c_zcst_kwert OR p_var1 EQ c_zv6d_kwert. "Set the data type
wa_fieldcat-datatype = 'CURR'.
wa_fieldcat-inttype = 'P'.
wa_fieldcat-intlen = 13.
ENDIF.
IF p_var1 EQ c_zsmr_kbetr. "Set the data type
wa_fieldcat-datatype = 'CURR'.
wa_fieldcat-inttype = 'P'.
wa_fieldcat-intlen = 14.
ENDIF. " End of addition HPQC 1757, USBILJ00
* Start of add USGUMR00
IF p_var1 EQ c_zbacko OR p_var1 EQ c_zvoidh. "Set the data type
wa_fieldcat-datatype = 'DATS'.
wa_fieldcat-inttype = 'D'.
wa_fieldcat-intlen = 8.
ENDIF. * End of Addition, USGUMR00
APPEND wa_fieldcat TO i_fieldcat.
* CLEAR wa_fieldcat. "<=== LINE COMMENTED
ENDFORM. " F_BUILD_FIELD_CATALOG
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING i_interface_check = ' '
i_callback_program = lv_repid
i_callback_user_command = c_f_user_command
i_callback_pf_status_set = c_f_set_pf_status
is_layout = wa_layout
it_fieldcat = i_fieldcat
it_excluding = i_excluding
i_callback_html_top_of_page = 'F_HTML_TOP_OF_PAGE'
i_save = lv_save
is_variant = wa_variant2
it_events = i_events
it_event_exit = i_event_exit
TABLES
t_outtab = i_outtab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc 0.
* No required processing.
ENDIF.
Hope this helps!
Cheers,
Shailesh.
2010 Apr 16 5:31 AM
HI SHAILESH
THANKS FOR THE REPLY. i HAVE COMMENTED AS U HAVE SAID . BUT STILL I M GETTING SAME PROBLEM
2010 Apr 16 5:47 AM
Hi Pavan,
Ok, if the problem is repeating, can you debug and check the contents of your field catalog table? Maybe you'll find a mismatch there.
Secondly, try mentioning the field catalog table in the REUSE_ALV FM as it_fieldcatalog[] and not just it_fieldcatalog.
Thirdly, try populating the field COL_POS with 1, 2, 3 etc to ensure correct column positioning. That might solve your problem.
If all else fails, delete the subroutine and populate the field catalog as simply as possible to avoid any confusion. I'll give you an example how I do it:
CLEAR: gwa_fieldcat.
gwa_fieldcat-col_pos = 1.
gwa_fieldcat-fieldname = 'BUCKETNAME'. "must be in CAPS
gwa_fieldcat-tabname = 'GT_OUTTAB'. "must be in CAPS
gwa_fieldcat-coltext = gc_bucket.
gwa_fieldcat-scrtext_l = gc_bucket.
gwa_fieldcat-outputlen = 10.
APPEND gwa_fieldcat TO gt_fieldcat.
CLEAR: gwa_fieldcat.
gwa_fieldcat-col_pos = 2.
gwa_fieldcat-fieldname = 'ITEMID'.
gwa_fieldcat-tabname = 'GT_OUTTAB'.
gwa_fieldcat-coltext = gc_itemid.
gwa_fieldcat-scrtext_l = gc_itemid.
gwa_fieldcat-outputlen = 15.
APPEND gwa_fieldcat TO gt_fieldcat.
and so on.
Hope this helps! Do let me know if you need anything else!!
Cheers,
Shailesh.
2010 Apr 16 5:13 AM
Hi Pavan,
Could you please format your code?
It is not readable.
Are you doing ang sorthing operation while passing to FM?
I guess becoz of sorthing you are getting different order and you are thinking it's wrond data.
Regards,
Pravin
2010 Apr 16 5:34 AM
Hi Pavan,
I am not able to understand your code clearly.
USE CODE LIKE:
PERFORM fieldcat USING:
'1' 'KUNNR' 'I_MARD' 'CUSTOMER NO' ,
'2' 'DMBTR' 'I_MARD' 'CURRENCY' ,
..............................
FORM fieldcat USING value(p_0029)
value(p_0030)
value(p_0031)
value(p_0032)
clear wa_fieldcat.
wa_fieldcat-col_pos = p_0029.
wa_fieldcat-fieldname = p_0030.
wa_fieldcat-tabname = p_0031.
wa_fieldcat-reptext = p_0032.
APPEND wa_fieldcat TO i_fieldcat.
ENDFORM. " FIELDCAT
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = w_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE '
IS_LAYOUT =
IT_FIELDCAT = i_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
TABLES
t_outtab = i_mard
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.
Try using this .
Regards,
Tutun
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |