Skip to Content
author's profile photo Former Member
Former Member

Conversion of Unit of Measure in ALV Grid

Hi all,

I am using function 'REUSE_ALV_GRID_DISPLAY' to display some records in ALV grid. The record displays material, the quantity of the material consumed and the unit of measure (UoM) of the quantity. I am fetching the data from the table AUFM and the field I am using for UoM is ERFME.

The problem is that when the UoM is displayed in the ALV, it is displayed as KAR but when i print the report or check the print preview, the UoM is displayed as CAR. I want to display CAR also in the ALV.

I have tried using the function 'CONVERSION_EXIT_CUNIT_OUTPUT' which converts the KAR to CAR in the ALV, but when I print it or check the print preivew , it shows asterisks (*) in the UoM field.

Can anyone tell me why this is happening and how I can solve this problem? Any help will be greatly appreciated.



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 03, 2007 at 04:34 PM

    Hi Hamza ,

    I had the problem you have mentioned but when I used the function 'CONVERSION_EXIT_CUNIT_OUTPUT' the problem was solved . The only thing that I can suggest you is , to give it a try, change the data type of UoM to char(3) .

    Hope this helps.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Ozkar,

      I tried the function 'CONVERSION_EXIT_CUNIT_OUTPUT', it worked fine when displaying the UoM in the ALV, meaning it displayed CAR instead of KAR, but when I printed the list or chicked the print preview, it displayed stars (***) in the UoM field.

      Anyway, I tried something else and now it is working fine. I am writing below what I did so that if anyone else has this problem, they can also do what I did.

      As I said before, the UoM field was showing KAR instead of CAR in the ALV. So after passing the data to an internal table which would be used to display the data in the ALV, I called the function 'CONVERSION_EXIT_CUNIT_OUTPUT' and converted KAR to CAR. this displayed CAR in the ALV.

      Now, to also get CAR in the print out and print preview,I declared variables gt_event_exit and lt_event_exit.

      DATA: gt_event_exit TYPE STANDARD TABLE OF slis_event_exit,

      lt_event_exit TYPE slis_event_exit.

      The variable will 'lt_event_exit' will contain the function codes of the Print(&RNT) and Print Preview (&RNT_PREV) buttons on the ALV. In the form where I am calling the function 'REUSE_ALV_GRID_DISPLAY', I pass the function codes to lt_event_exit and append it to the internal table gt_event_exit.

      lt_event_exit-ucomm = '&RNT'.

      lt_event_exit-before = 'X'.

      APPEND lt_event_exit TO gt_event_exit.

      lt_event_exit-ucomm = '&RNT_PREV'.

      lt_event_exit-before = 'X'.

      APPEND lt_event_exit TO gt_event_exit.

      Next I pass this table to the parameter 'IT_EVENT_EXIT' of 'REUSE_ALV_GRID_DISPLAY'. I also create a form USER_COMMAND and pass this form to the parameter 'I_CALLBACK_USER_COMMAND' of 'REUSE_ALV_GRID_DISPLAY' as shown below.




      IT_EVENT_EXIT = gt_event_exit

      What the above does is that, when a user clicks on the print or print preview button, the system instead of printing the list, it passes the control to the form USER_COMMAND. After the form is processed, it prints the list.

      In the form, I placed a loop on the internal table containing the data to be shown and simply converted the CAR back to KAR. The code is given below.

      FORM user_command USING r_ucomm LIKE sy-ucomm

      rs_selfield TYPE slis_selfield .

      CASE r_ucomm .

      WHEN '&RNT' OR '&RNT_PREV'.

      LOOP AT i_final .



      input = i_final-erfme

      language = sy-langu


      output = i_final-erfme


      unit_not_found = .

      MODIFY i_final.


      • WHEN .

      • WHEN OTHERS.


      I hope this is helpful to anyone who has the same problem as I did. Now what I cant figure out is why the system automatically converts KAR to CAR when displaying print preview or when printing the list.

      Well, thanks anyway for the suggestion Ozkar.



  • author's profile photo Former Member
    Former Member
    Posted on Nov 29, 2012 at 05:48 PM

    Hi Hamza,

    Pass wa_fieldcat-edit_mask = '==CUNIT'

    for the resoective Unit of Measure field.

    This will take care of the conversions.



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.