Wednesday 28 March 2018

SAP Translation Hub. ABAP Integration How-To

Introduction


This article shows an easy and fast way of creating multilingual ABAP applications in order to correspond to best-practice methods and “to speak the Customer’s language”.

Here SAP Translation Hub and ABAP system configuration is described. Additionally, useful methods to manipulate languages in the ABAP system are shown.

Prerequisites


First, we shall comply with some prerequisites in Translation Hub Service on SAP Cloud Platform, our ABAP system and Cloud Connector.

Cloud Connector

We shall configure a subaccount in SAP Cloud Connector for our S-user to make it possible to connect directly SAP Cloud and our ABAP system

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

There we shall configure Cloud To On-Premise system mapping for RFC connection. There we shall grant access to function modules with LXE_ prefix as shown below.

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

SAP Cloud Platform Cockpit


We shall create Destination in the service of Translation Hub. Its name shall look like STH_<S-user> as shown below (to be considered obsolete from 23.03.2018)

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

For a newer Translation Hub version, that name shall be as STH_<S-user>_<System ID>_<Client Number> to have an ability to use multiple ABAP systems for translation.

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

We can check if our ABAP system is accessible from Cloud.

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

ABAP Back-End System


The ABAP system is to be a Unicode system. We can check it in SAP Logon GUI in System -> Status menu item

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

Functional Modules necessary for RFC calls are to be there (if not, implement SAP Note 2349776).

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

Create a technical user (its name is specified in the Translation Hub Destination) of Communications Data type and assign Required Authorization to this role. Check that authorization with Translation Hub Documentation.

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

Use LXE_MASTER t-code to create an Object list for translation.

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

Put the Object List description and add Objects to translate into it. Use LIMU REPT object type for ABAP Text Elements. For Classes names you should add “=” symbols so that the name is 30 symbols long and then add “CP” in the end. You can include any other objects like Data Elements, for example, to translate them, too.

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

Save and generate the Object List.

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

Wait until Status turns into X – Generation Complete

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

Now you can use that Object List in Translation Hub to translate all the included objects.

Create ABAP project in SAP Translation Hub


Run Translation Hub Service and create an ABAP project

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

Starting from 23 March 2018, there will be a field to choose Destination to our ABAP system as described:

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning


SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

Try to choose Object List, but there is no one found

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

So, now we can choose Object List from our ABAP system, translate it, postprocess if needed and send it back to our system translated into the chosen languages.

Best-practices for multilingual ABAP development


Always use English as the default language for all your ABAP development.

Avoid using text constants in your code. Use text elements instead.

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

If possible, output screen fields or print fields shall not be fixed in width to fit any length of the text as it can change from one language to another.

A Text Pool of Text Elements is initialized each time a program object is created (Report is started, or Class Instance is created). It is initialized in the current User Session language. So, if you need to use Text Elements in a language other than the current one (to prepare emails for different receivers, for example), use SET LANGUAGE statement to do it. If the Text Pool is not switched successfully, it returns SY-SUBRC non-zero value, use some default language value in such case.

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP Guides, SAP ABAP Learning

You must use that statement in each report or class separately. As the statement switches only current Text pool and does not change any Pool in super class or called report, you must switch it inside each program object you use.

To reset Text Pool to current User Session language just use SET LANGUAGE SY-LANGU statement.

1 comment:


  1. Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.
    sas implementation services in north America

    ReplyDelete