01-16-2020 3:57 AM
Hi Experts,
We have a requirement to develop a report from the text stored in custom table.But that text is stored in german. We need convert that text to english before to display.Kindly anyone advise how to achieve this.
Thanks and Regards,
Anusha.B
01-16-2020 5:14 AM
You mean a translation on the fly? There is no functionality out of the box available on a NetWeaver or S/4HANA stack providing that functionality. You have to call an external translation API doing that stuff for you (there are a lot available, just search for it). For instance SAP provides the Machine Translation service (for a little example just calling the service you can check tutorial https://developers.sap.com/tutorials/cp-mlf-rest-txt-machine-translation.html). It would be easy to subscribe that service (of course it is service you have to pay for) and connect to it from your ABAP code using the http connectivity classes available for ABAP.
Another - old-school way - you can think about is, if it makes sense to make your text language dependent and store it in different languages directly on your ABAP system.
01-16-2020 5:28 AM
Hi Anu,
how will you be able to tell if the entered text is actually in German and not in some other language? Even if your custom table had a language field it's not a given that the text was actually entered in German. So right from the outset you have an issue with not being certain about the entered text's actual language - regardless of whether there's an option for automated translation at all. And I think that's what you are after, right? If not, please clarify your question.
Cheers
Bärbel
01-16-2020 6:16 AM
Hi All,
Thank you for your answers.I have checked the table data and also this table initally used for german program.Is there anyway we can translate the message stored in the table to english.Any FM available to convert the text to english.
01-16-2020 6:55 AM
Hi Anu,
1. Function Modules to convert text from one language to another
TRANSLATE_TEXT_TEXTLOG
Call (old) translation-tool: NECESSARY FOR COMPATIBILTY
SKTZ_TRANSLATE_TEXT_TEXTLOG
Interface for External Callers who used translate_text_textlog in old SE63
2. Sample
CALL FUNCTION ‘SKTZ_TRANSLATE_TEXT_TEXTLOG’
EXPORTING
SOURCE_LANGUAGE = SOURCE_LANGUAGE
TARGET_LANGUAGE = TARGET_LANGUAGE
TRANSPORTKEY = TRANSPORTKEY
TABLES
TEXTOBJ = TEXTOBJ
EXCEPTIONS
OBJECT_NOT_FOUND = 1
OTHERS = 2.
IF ( SY-SUBRC >< 0 ).
RAISE OBJECT_NOT_FOUND.
ENDIF.
EXIT.
3. SE63 to translate
References
https://answers.sap.com/questions/5213407/any-function-module-to-translate-the-text.html
https://www.experts4help.com/question/program-translation-message-tcode-message-translation-bulk/
https://www.se80.co.uk/sapfms/t/tran/translate_text_textlog.htm
https://www.sapdatasheet.org/abap/func/translate_text_textlog.html
https://www.tcodesearch.com/sap-fms/search?q=translate_text_textlog
https://www.tcodesearch.com/sap-fms/detail?id=TRANSLATE_TEXT_TEXTLOG
01-16-2020 9:31 AM
Does this really help for what Anu is looking for? From what I can tell, the custom table doesn't have a connection to SE63 and the translations it is used for.
09-17-2022 4:15 AM