Application Development and Automation 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: 
Read only

matchcodes in alv

former_member213871
Participant
0 Likes
1,353

Dear Gurus,

now I am facing problem with matchcodes in alv output. Please, see my code in attachment (I wasn't able to paste it here - it always freezed my browser).

What I am tryint to do:

I have one dynamic table and one table based on structure in DD. I am trying to merge them to one table, fill it with data and present using alv. All this works well. The only problem is with alv output behaviour - matchcodes in cells are present but not working - nothing happen when I try to use it. The same problem is with subtotals. If I have column with currency and second with value, subtotals are not separated by currency.

Thank you and BR,

David

Dear Gurus,

now I am facing problem with matchcodes in alv output. Please, see my code in attachment (I wasn't able to paste it here - it always freezed my browser).

What I am tryint to do:

I have one dynamic table and one table based on structure in DD. I am trying to merge them to one table, fill it with data and present using alv. All this works well. The only problem is with alv output behaviour - matchcodes in cells are present but not working - nothing happen when I try to use it. The same problem is with subtotals. If I have column with currency and second with value, subtotals are not separated by currency.

Thank you and BR,

David

1 REPLY 1
Read only

former_member213871
Participant
0 Likes
1,126

Hi people,

I finally found solution for my problem. If anyone has the same problem, this could help:

In attachment of first article is how I am building data table for output - result is field symbol table.

For presentation I am using:

  TRY.

      CALL METHOD cl_salv_table=>factory

        EXPORTING

          list_display = ' '   

        IMPORTING

          r_salv_table = lr_table

        CHANGING

          t_table      = <gt_data>.

    CATCH cx_salv_msg.

  ENDTRY.

When I debugged output, I found, that some data describing reference fields are missing - I do not why and didn't found solution for this.

So I added these fields manually:

"somewhere in main report

" table for reference fields

DATA: BEGIN OF gt_fields OCCURS 0,
        tabname LIKE dd03l-tabname,
        field LIKE dd03l-fieldname,
        reffield LIKE dd03l-reffield,
       END OF gt_fields.


" filling table with reference fields

SELECT * FROM dd03l WHERE tabname = p_tab AND keyflag = 'X' ORDER BY position.
     IF ( dd03l-fieldname <> 'MANDT' ) AND

         ( dd03l-fieldname <> 'KSCHL' ) AND

         ( dd03l-fieldname <> 'DATBI' ) AND
        ( dd03l-fieldname <> 'DATAB' ) AND

        ( dd03l-fieldname <> 'KNUMH' ).
       gt_field-tabname = p_tab.
       gt_field-field    = dd03l-fieldname.
       gt_field-reffield = dd03l-reffield.
       APPEND gt_pole.

    ENDIF.

"then between CALL METHOD cl_salv_table=>factory and lr_table->display( ).

data:     lr_columns TYPE REF TO cl_salv_columns,

            ls_ref TYPE salv_s_ddic_reference,

            lr_column TYPE REF TO cl_salv_column_table,


LOOP AT gt_fields.
     CLEAR: ls_ref.
     lr_columns = lr_table->get_columns( ).
     TRY.
         lr_column ?= lr_columns->get_column( columnname = gt_fields-field ).
         IF sy-subrc = 0.
           ls_ref-field = gt_fields-field.
           ls_ref-table = gt_field-tabname.
           lr_column->set_ddic_reference( ls_ref ).
           TRY.
               lr_column->set_currency_column( gt_field-reffield ).
             CATCH cx_salv_data_error.
           ENDTRY.
         ENDIF.
       CATCH cx_salv_not_found.
     ENDTRY.

ENDLOOP.


And now matchcodes and subtotals are working.


BR,

David


Message was edited by: David Planansky