Skip to Content
0

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

Dec 11, 2017 at 09:35 AM

213

avatar image
Former Member

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.
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Raymond Giuseppi
Dec 12, 2017 at 01:42 PM
0

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.

Show 6 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Raymond,

It is a Material creation/extension program.

The records comes from excel file and we create the materials using FM - MATERIAL_MAINTAIN_DARK and extension using BAPI_MATERIAL_SAVEDATA.

In excel file MARC-LZEIH has D and I use the FM CONVERSION_EXIT_CUNIT_INPUT, to convert to internal format (Value comes 10).

Material is created successfully and the problem comes in SALV display. which gives Time unit as ****.

As seen in my query, I am trying to give SET_EDITMASK as shown in my coding. Still not working.

Thanks,

Sri.

0

For me it is still unclear whether you have already created the material and now just work on an ALV report, or if you create this ALV in parallel with the upload without having the material master created at that time.

If the material is already created, then what do you see in MM03 for that field?

And what do you see for that field with SE16N in table MARC and what in T006A

In SE16N click the icon for user settings, then activate the box in front of Output without conversion exit

se16n.png (122.4 kB)
0
Former Member
Jürgen L

Hi,

Material creation and extension works now. In MM03, Time unit for material shows 'D' as seen in img1

But ALV output shows as in img2. Time unit with ****. For that only I posted this query and have given the coding which i am following for display ALV.

img1.jpg

img2.jpg

img1.jpg (15.9 kB)
img2.jpg (11.3 kB)
0

In the SALV do you display the original data from Excel (no conversion-exit required) or data actually read from database after the successful call of BAPI (use CUNI conversion)?

0
Former Member
Raymond Giuseppi

I use the original data from excel and it gives the error in the output as mentioned.

0

Usually such Excel data are already created in external format, so don't use any conversion exit, use a simple char type data, not the sap data element which expect internal format.

0
Jürgen L
Dec 11, 2017 at 09:43 AM
0

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

Show 1 Share
10 |10000 characters needed characters left 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

0
Iftah Peretz
Dec 12, 2017 at 04:25 PM
0

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'?

Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi..

Yes. It is LZEIH type MARC-LZEIH.

maxlz TYPE marc-maxlz, "Plant Remining shelf life
lzeih TYPE marc-lzeih, "Time Unit
mhdrz TYPE mara-mhdrz, "Minimum Remaining Shelf Life
mhdhb TYPE mara-mhdhb, "Total shelf life

0

Hi,

Because I can't see the whole, end to end, process (the excel creation, the data in it, the whole program of interface, the creation of material etc.) I would recommend that you try and track the answer base up using the following steps

  • Make the LZEIH field to be of TYPE string. Remove the "gr_column->set_edit_mask('==CUNIT')." line and see what happens.
  • Keep it as a string. Create your own CONVERSION to handle the data (maybe in it try to call the CUNIT one) - the link you supplied in your question has the steps for it. And then call it like "gr_column->set_edit_mask('==ZUNIT')." Repeat this process but change the TYPE back to LZEIH.
  • Debug the whole process and gather insights and share it.
0
Former Member
Iftah Peretz

Hi,

Will work on your first point.

Sorry. I don't get your second point

Thanks,

Sri.

0

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. 
0
avatar image
Former Member Dec 19, 2017 at 03:57 AM
0

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

If this is answered then please close the question, see this blog.

As a side note, if this works in the old FM but not in SALV I'd search for SAP Notes with corrections.

0