SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

Convert Sales Unit into Text using Function Module in Target Language

ABAP developers use CONVERSION_EXIT_CUNIT_OUTPUT function module to convert units of measurement into text definitions in target language. For example, use ABAP function module CONVERSION_EXIT_CUNIT_OUTPUT in a SAP Smart Form output code to convert sales unit into translated text definitions.

For example, in this ABAP tutorial you will see how you can get the definition text of ST unit in English as "piece(s)" which is "adet" in Turkish.

As seen in below screenshots, I call function module CONVERSION_EXIT_CUNIT_OUTPUT using SAP transaction code SE37 and execute with required parameters unit and language to get the translation description of the unit in target language.

get translation of unit descriptions in SAP using ABAP function module

ABAP developers can change the SE37 function module parameter "Language" with other language abbreviations like TR for Turkish, UK for Ukranian or DE for German, etc to get the translated short and long text of the input measurement unit. In this example ST for unit or piece. You can play with the measurement unit parameter to get translations of descriptions of provided units.

ABAP function module abap/conversion_exit_cunit_output

In below ABAP codes, I'll be returning the sales unit text of an item on a sales invoice using the ABAP function module CONVERSION_EXIT_CUNIT_OUTPUT. Since I used this ABAP code block in an output of a billing document, I got the sales unit abbreviation from IT_GEN component of the IS_BIL_INVOICE import parameter.

DATA gv_unittext TYPE char30.
DATA lv_language LIKE sy-langu.
lv_language = is_nast-spras. " Comes from NAST object

IF gs_it_gen-sales_unit IS NOT INITIAL.
 CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT'
  EXPORTING
   input = gs_it_gen-sales_unit
   language = lv_language " 'T' for Turkish
  IMPORTING
   long_text = gv_unittext
* OUTPUT =
* SHORT_TEXT =
  EXCEPTIONS
   unit_not_found = 1
   OTHERS = 2.
 IF sy-subrc <> 0.
* Implement suitable error handling here
 ENDIF.
ENDIF.
Code

ABAP function module CONVERSION_EXIT_CUNIT_OUTPUT returns the unit text, explicitly the long text description of the sales unit in gv_unittext import parameter. SAP Smartform developers can easily display this value on a Text object.



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.