2023 May 18 12:40 PM
So here's my code:
DATA: t_fieldcat TYPE slis_t_fieldcat_alv.<br>DATA: BEGIN OF T_FINAL_DATA<br> EINDT LIKE EKES_EINDT,<br> WERKS LIKE EKPO-WERKS,<br> UZEIT LIKE EKES-UZEIT,<br> SLFDT TYPE EKET-SLFDT,<br> EKRGP LIKE EKKO-EKGRP.<br> END OF T_FINAL_DATA<br>CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'<br> EXPORTING<br> i_program_name = sy-repid<br> i_internal_tabname = 't_final_data'<br> CHANGING<br> ct_fieldcat = t_fieldcat[]<br> EXCEPTIONS<br> inconsistent_interface = 1<br> program_error = 2<br> others = 3.
This is the data inside t_fieldcat:
As you can see, the column position is same on how it is declared in T_FINAL_DATA.
However, when the ALV is displayed, the PLANT or WERKS is on third column as I have saved this layout and that layout was also entered in the selection screen upon executing the program.
Now, why is that the FM can't get the column position from the ALV layout? Is it possible to get the column position prior displaying the ALV?
2023 May 18 1:21 PM
This function module provides a default field catalog, it does not take into account any of the variants, there is no parameter to pass a variant. Did you try to call REUSE_ALV_VARIANT_SELECT after this one.
2023 May 18 1:21 PM
This function module provides a default field catalog, it does not take into account any of the variants, there is no parameter to pass a variant. Did you try to call REUSE_ALV_VARIANT_SELECT after this one.
2023 May 18 6:32 PM
You have to fill the cs_variant parameter with program name and variant, also fill username for user and not global variants.