Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Having issues with the output of FM REUSE_ALV_FIELDCATALOG_MERGE

walkerist
Participant
0 Kudos
191

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?

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
141

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.

2 REPLIES 2

raymond_giuseppi
Active Contributor
142

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.

0 Kudos
141

You have to fill the cs_variant parameter with program name and variant, also fill username for user and not global variants.

  • To identify default variant use REUSE_ALV_VARIANT_DEFAULT_GET