2

in SE16N in Technical Settings there is a Checkbox the OUTPUT WITHOUT CONVERSION EXIT.
In my programs I use the class CL_SALV_TABLE for creating the ALVs. Is it possible to put a checkbox in the program similar to SE16N and when the user enable it my ALV will display the data like the SE16N?
Thanks
Elias

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
ekekakos
  • 563
  • 3
  • 20
  • 39
  • 1
    Is there a field catalog? The EDIT_MASK field of the field catalog could be used for this. For example if the field is 10 chars long you can add the EDIT_MASK this value: "__________" (underscore 10 times), so the field value would be just taken over without any internal conversion. – József Szikszai Oct 27 '20 at 13:02
  • @JózsefSzikszai probably this worth converting into answer – Suncatcher Oct 27 '20 at 13:27
  • Finally the answer is in SET_EDIT_MASK and specifically the below command: **columns->get_column( 'MATNR' )->set_edit_mask( '' ).** Now I am looking a way to do it for all fields that have conversion. Thanks – ekekakos Oct 27 '20 at 13:42

2 Answers2

3

This is what I wanted as I am using SALV extensively.

** Display the data Without Conversion
  DATA: l_tabledescr_ref TYPE REF TO cl_abap_tabledescr,
        l_descr_ref      TYPE REF TO cl_abap_structdescr,
        wa_table         TYPE abap_compdescr.
  IF p_woconv = 'X'.
    TRY.
        columns = oref_table->get_columns( ).
        l_tabledescr_ref ?= cl_abap_typedescr=>describe_by_data( <fs_itab> ).
        l_descr_ref ?= l_tabledescr_ref->get_table_line_type( ).

        LOOP AT l_descr_ref->components INTO wa_table.
          DATA(edit_mask) = columns->get_column( wa_table-name )->get_edit_mask( ).
          IF edit_mask(2) = '=='.
            columns->get_column( wa_table-name )->set_edit_mask( ' ' ).
          ENDIF.
          IF wa_table-type_kind = 'C' OR wa_table-type_kind = 'N'.
            columns->get_column( wa_table-name )->set_leading_zero( ).
          ENDIF.
        ENDLOOP.

      CATCH cx_salv_not_found.
    ENDTRY.
  ENDIF.

If someone has a better solution with SALV, I will be much obliged to share with us.
Thanks all for your answers.
Elias

ekekakos
  • 563
  • 3
  • 20
  • 39
-1

Everything is possible in SAP, However I'm not sure if your request is possible using the class CL_SALV_TABLE. I recommend you to use the Class CL_GUI_ALV_GRID which is really dynamic and can be implemented to fit your scenario.

There is a lot of tutorials online but I'll try to make small summary

  1. Create a Parent Container CL_GUI_CUSTOMCONTAINER
  2. Create the ALV Grid and set the Parent.
  3. Fetch Field catalogs (can also be dynamic to fit any table)
  4. Create the Output table and pass the operations
  5. Display ALV

Sure the Displayed table can be set according to the user's choice (Checkbox)

Please write down if you need more help

HUJ
  • 47
  • 1
  • 6
  • this is not really an answer to the question, the OP needs not a general way of creating a grid, but a specific question about data elements display mode – Suncatcher Oct 27 '20 at 11:47