2008 Jul 29 11:21 AM
Dear Everyone,
I tried to build field category reference to an internal table using 'LVC_FIELDCATALOG_MERGE', but it didn't work. I already export the internal table name to I_INTERNAL_TABNAME, but the result table gt_fieldcat was empty. However, I also export the internal table name to I_STRUCTURE_NAME, the run-time error will be occurred.
Can somebody advise that what the problem is? I listed the code below.
I know that 'REUSE_ALV_FIELDCATALOG_MERGE' can do that, but I received a message from SAP that they don't recommend we use it anymore, so I have to use 'LVC_FIELDCATALOG_MERGE'.
Thanks in advanced !
Best Regards,
Leo Lau
Code:
Prepare field category
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
*I_STRUCTURE_NAME = 'alv_output'
I_INTERNAL_TABNAME = 'alv_output'
CHANGING
ct_fieldcat = gt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
Structure definition
DATA: BEGIN OF alv_output OCCURS 10,
mandt TYPE mandt ,
infnr TYPE infnr ,
...
DATA: END OF alv_output.
Variable definition
DATA : gt_fieldcat TYPE lvc_t_fcat,
.......
2008 Jul 30 11:31 AM
Hi All,
Thanks you for your reply.
Hi Vijay Babu Dudla,
Thank you for your reply.
When we follow your suggestion to implement my program and execute the program, some errors messages will be displayed.
Runtime Errors --> READ_REPORT_LINE_TOO_LONG
EXCEPT. --> CX_SY_READ_SRC_LINE_TOO_LONG
Error Occured in
Function Module : K_KKB_FIELDCAT_MERGE
Line 365 : read report l_prog_tab_local into L_abap_source
Thanks in advance.
Best Regards,
Leo
2008 Jul 29 11:26 AM
HI,
In your code...CHECK
1) I-INTERNAL_TABNEM = 'ALV_OUTPUT'
internal table name should be in capital letters.
2) in the structure definition dont use TYPE always use LIKE
Regards,
Kiran
2008 Jul 29 11:27 AM
It will not work directly, But there is a work around. check this...
REPORT ZTEST_FIELDCATLOG.
type-pools: slis.
data: begin of it_data occurs 0,
vbeln like vbak-vbeln,
matnr like mara-matnr,
end of it_data.
DATA: it_fieldcat type SLIS_T_FIELDCAT_ALV,
it_lvcfcat type lvc_t_fcat.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_INTERNAL_TABNAME = 'IT_DATA'
I_INCLNAME = sy-repid
CHANGING
ct_fieldcat = it_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 'LVC_TRANSFER_FROM_SLIS'
EXPORTING
it_fieldcat_alv = it_fieldcat
* IT_SORT_ALV =
* IT_FILTER_ALV =
* IS_LAYOUT_ALV =
IMPORTING
ET_FIELDCAT_LVC = it_lvcfcat
* ET_SORT_LVC =
* ET_FILTER_LVC =
* ES_LAYOUT_LVC =
tables
it_data = it_data
* EXCEPTIONS
* IT_DATA_MISSING = 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.
BREAK-POINT.Regards
Vijay Babu Dudla
2023 Dec 22 12:58 PM
2008 Jul 29 11:32 AM
2008 Jul 30 11:31 AM
Hi All,
Thanks you for your reply.
Hi Vijay Babu Dudla,
Thank you for your reply.
When we follow your suggestion to implement my program and execute the program, some errors messages will be displayed.
Runtime Errors --> READ_REPORT_LINE_TOO_LONG
EXCEPT. --> CX_SY_READ_SRC_LINE_TOO_LONG
Error Occured in
Function Module : K_KKB_FIELDCAT_MERGE
Line 365 : read report l_prog_tab_local into L_abap_source
Thanks in advance.
Best Regards,
Leo
2008 Jul 30 11:32 AM
Runtime Errors --> READ_REPORT_LINE_TOO_LONG
EXCEPT. --> CX_SY_READ_SRC_LINE_TOO_LONG
Error Occured in
Function Module : K_KKB_FIELDCAT_MERGE
Line 365 : read report l_prog_tab_local into L_abap_sourceCaution:-
Source code lines should be less than or equal to 72,. when you are using the REUSE Merge function.
2008 Jul 30 11:34 AM
width of the source code lines should be less than or equal to 72.
width
read table it_data with key vbeln = vbeln matnr = matnr posrn = posnr.
if there are such lines convert or format them
read table itab with key vbel = vbef
nmt = mat
2008 Jul 31 4:36 AM
Hi Vijay Babu Dudla,
Thank you for your reply.
It is work.
Thanks a lot !
Regards,
Leo Lau