Skip to Content
0

Fetching Material Base Unit from MARA in EN language in ABAP

May 16, 2017 at 09:51 AM

182

avatar image
Former Member

Hi,

My issue is that when I want to retrieve any unit of measure field from any table in SAP using SELECT statement in ABAP, then system will retrieve this unit with code different than what is maintained in EN language.

suppose I want to retrieve base unit of measure for a material (MARA-MEINS), and the unit is PAC, but the retrieved unit code is PAK instead of PAC, and if the material base unit code is KG, then retrieved unit code is ST.

SELECT MATNR MEINS INTO IT_MARA FROM MARA

I assume the system it is retrieving the unit in Deutsch, but not in English. When I retrieve MARA records using T.Code SE16N, then the retrieved unit comes in EN language.

How would retrieve the material units from the SAP standard tables that are defined in EN language which the user is familiar with.

Thank you.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Raymond Giuseppi
May 16, 2017 at 11:15 AM
1

Why don't you use the same solution, than SE16n or everty standard report/dynpro, use the conversion exit associated to the domain CONVERSION_EXIT_C***T_OUTPUT (or a simple WRITE statement) to convert unit of measure from internal (Deutsch) to external format (logon/current language).

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

Thank you for your help. I have found function module CONVERSION_EXIT_CUNIT_OUTPUT. Simply I pass the "internal display of unit of measurement" and specify the output language as 'EN', and it will give the unit related to the passed language.

I filled my internal table with one SELECT statement

Do I need to loop through my internal table, call the FM and at each record, and replace the unit of the material for each record. Is not there a short way where it will apply conversion at the time of executing the SELECT statement?

Thanks

0

Look at the FM, you could use table T006A in some JOIN. (But please note this table is buffered, so using the FM will often be more efficient than a JOIN.)

0
Mike Pokraka May 16, 2017 at 12:15 PM
1

Please use BAPIs to read business data where possible. Your problem is exactly the type of scenario they avoid.

For material, BAPI_MATERIAL_GETALL should do the job.

Edit: Just saw your comment. If you are pulling a table of materials out, there's BAPI_MATERIAL_GETLIST, but I don't think it includes quantities.

You can also do conversions using string templates, I think it should be possible to do an alpha conversion in an SQL statement, not tried it myself.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member May 18, 2017 at 04:30 AM
0

Thank you all for your support.

I couldn't understand how to join T006A with MARA table, and BAPI_MATERIAL_GETALL will not help me in my case because I'm also joining other tables related to BOM like STKO and STPO. Finally, I decided to loop through my internal table, pass the internal unit in DE language into FM CONVERSION_EXIT_CUNIT_OUTPUT and get the equivalent in EN language.

Share
10 |10000 characters needed characters left characters exceeded