Skip to Content
avatar image
Former Member

ALV output display shows **** for the Time unit

Hi Experts,

I have a Time unit (MARC-LZEIH), which has to be displayed in the ALV output. (CL_SALV_TABLE) is used for the ALV display.

But it is showing as '*****' in the output display and status bar shows as - 'No language specific unit defined in language EN fro internal unit D'.

Since the unit has conversion exits, I am using, the code as below ( for conversion routine, i checked net and found this link - http://zevolving.com/2013/10/conversion-exit-to-format-amounts-in-alv/

But still not able to get rid of the ***** in the output.

DATA: gr_table      TYPE REF TO cl_salv_table,
        gr_functions  TYPE REF TO cl_salv_functions,
        gr_columns    TYPE REF TO cl_salv_columns_table,
        gr_column_tab TYPE REF TO cl_salv_column_table,
        gr_column     TYPE REF TO cl_salv_column,
        gr_layout     TYPE REF TO cl_salv_layout.
  DATA: ls_layout_key TYPE salv_s_layout_key.

    TRY.
        CALL METHOD cl_salv_table=>factory
          EXPORTING
            list_display = if_salv_c_bool_sap=>false
          IMPORTING
            r_salv_table = gr_table
          CHANGING
            t_table      = gt_rep.
      CATCH cx_salv_msg .
    ENDTRY.

  gr_functions = gr_table->get_functions( ).
  gr_functions->set_all( abap_true ).
  gr_columns = gr_table->get_columns( ).

**Set column texts and length here now
    set_col_text 'REF_MAT' 'Reference Material' 'Reference Material' 19.
    set_col_text 'MATNR' 'Target Material' 'Target Material' 19.
    set_col_text 'STAT' 'Status' 'Status' 10.
    set_col_text 'STATUS' 'Error Message   ' 'Error Text' 70.
    set_col_text 'TEXT1' 'Long Text1  ' 'Long Text1  ' 30.
    set_col_text 'TEXT2' 'Long Text2  ' 'Long Text2  ' 30.
    set_col_text 'TEXT3' 'Long Text3  ' 'Long Text3  ' 30.
    set_col_text 'TEXT4' 'Long Text4  ' 'Long Text4  ' 30.


**Set conversion routine  
  TRY.
      gr_column ?= gr_columns->get_column( 'LZEIH' ).
      gr_column->set_edit_mask( '==CUNIT' ).    "<<
    CATCH cx_salv_not_found.                            "#EC NO_HANDLER
  ENDTRY.

  CALL METHOD gr_columns->set_column_position
    EXPORTING
      columnname = 'STAT'
      position   = 1.

  CALL METHOD gr_columns->set_column_position
    EXPORTING
      columnname = 'STATUS'
      position   = 2.

  CALL METHOD gr_table->get_layout
    RECEIVING
      value = gr_layout.

  ls_layout_key-report = sy-repid.

  CALL METHOD gr_layout->set_key
    EXPORTING
      value = ls_layout_key.

  CALL METHOD gr_layout->set_save_restriction
    EXPORTING
      value = if_salv_c_layout=>restrict_none.

  gr_table->display( ).

*Macro for column length and description text
  DEFINE set_col_text.
    CLEAR gr_column.
    TRY.
      CALL METHOD gr_columns->get_column
      EXPORTING
        columnname = &1
        receiving
        VALUE      = gr_column.
    CATCH cx_salv_not_found .
    ENDTRY.

    gr_column->set_long_text( &2 ).
    gr_column->set_medium_text( &3 ).

    CALL METHOD gr_column->set_output_length
    EXPORTING
      VALUE = &4.
  END-OF-DEFINITION.
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Dec 12, 2017 at 01:42 PM

    AFAIK there is no standard SAP provided unit with internal code 'D' (Did you notice that many uoms have a german origin, not english, even if in some etymological case like Monate for Months the three initial letters are identical.) when browsing T006A with SE16[N], deactivate the conversion-exit.

    Did you actually used MARC-LZEIH read from SAP database with an open-sql statement. If not, seems your are using some external format data, if it comes from a z-table, the coder forgot to convert the data with CONVERSION_EXIT_CUNIT_INPUT.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 11, 2017 at 09:43 AM

    you have not given any hint whether you have the mentioned internal unit D in language EN in the unit of measure table. So look at T006A table with SE16N and check if you have an entry for EN language, and if not then have your functional do the translation in transaction CUNI

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      Thanks a lot for replying Jurgen.

      Yes, entry exists in T006A table, as you can see in screen shot 2. (with conversion routine marked)

      But when I give MON (for months), output is displaying as shown in screen shot 3. (same with and without converstion routine)

      Actually the users give the values as D (Days), MON(months) and yr(year). I need to convert them and use Bapi to upload. But when display, these gives issues except MON.

      Thats why, In my alv display, I use the below code. Still cant get correct output.

      TRY.
            gr_column ?= gr_columns->get_column('LZEIH').
            gr_column->set_edit_mask('==CUNIT')."<<      
            CATCH cx_salv_not_found."#EC NO_HANDLER
      ENDTRY.

      screen-shot-3.jpg

      screen-shot-2.jpg

  • Dec 12, 2017 at 04:25 PM

    Hey,

    To add to Raymond Giuseppi point, can you please share the TYPE of gt_rep-lzeih from your code? Is it LZEIH? Is it 'LIKE MARC-LZEIH'?

    Add comment
    10|10000 characters needed characters exceeded

    • The second point basically says that you read the excel data into a string (TYPE string) field and create your own conversion, say CONVERSION_EXIT_ZUNIT_OUTPUT in it you can code your logic or try and reuse CONVERSION_EXIT_CUNIT_OUTPUT and then use the set_edit_mask('==ZUNIT') on that field. Then you can change the field type back to LZEIH and try again, if that method didn't work.

      An example to show what I mean by "try and reuse CONVERSION_EXIT_CUNIT_OUTPUT"

      FUNCTION conversion_exit_zunit_output.
      *"----------------------------------------------------------------------
      *"*"Local Interface:
      *"  IMPORTING
      *"     INPUT
      *"  EXPORTING
      *"     OUTPUT
      *"---------------------------------------------------------------------- 
        TRY.
          CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT' 
      EXPORTING INPUT = INPUT IMPORTING OUTPUT = OUTPUT EXCEPTIONS UNIT_NOT_FOUND = 1 OTHERS = 2. CATCH CX_ROOT. "Your own logic ENDTRY. ENDFUNCTION.

      In addition, I suggested that you can loop over the field LZEIH that is now string (or define a new field that is string like str_lzeih) and do things to it (before calling the ALV) so that only in the presentation you would show it differently to the user.

      Something along these lines

      LOOP AT gt_rep ASSIGNING FIELD-SYMBOL(<fs_ref>).
        <fs_ref>-str_lzeih = <fs_ref>-lzeih. "You can use CONV in case there are issues
        CONDENSE <fs_ref>-str_lzeih.
        CASE <fs_ref>-str_lzeih.
        WHEN 'D'.
          <fs_ref>-str_lzeih = "Your value
         ...
        ENDCASE.
      ENDLOOP. 
  • avatar image
    Former Member
    Dec 19, 2017 at 03:57 AM

    Hi all,

    Thanks for all your replies.

    I could not able to rectify the error using the SALV method. So discussed with functional and used normal ALV_GRID_DISPLAY FM and it worked.

    Regards,

    Sri.

    Add comment
    10|10000 characters needed characters exceeded