Working with Arabic text and English together in a single smartform
Hope this might be useful!
If you have 5fields like First Name, Last Name , Date, Place, Address.
And in the above fields if you have to display both english and arabic words in a single smartform, then you can follow the following simple logic for each field.
1.The form is created in english.
2.No need of passing “AR” in control parameters also.
3.Let us take an example — if English text is Name — Varun its corresponding arabic text is فارون.
4.But normal excution of smartform inverses the arabic text and displays from LTR, which is wrong.
5.With the below code we can display english(latin) text left to right(LTR) and arabic(hebrew) text right to left(RTL) with out much complexity.
DATA: lv_name type string,
lv_cnt type i.
lv_name = ‘فارون’. “Arabic text
lv_cnt = strlen( lv_name ). “Finding the length of the arabic text.
“Rearranging the stirng to LTR, so that when it prints on form it will be Still be printed as LTR, but as the text was already converted to LTR in our code,
“during display it helps to print in correct arabic way.
DO lv_cnt TIMES.
lv_int = lv_cnt – sy–index.
CONCATENATE lv_arabic lv_name+lv_int(1) INTO lv_arabic.
CONDENSE lv_arabic NO-GAPS.
If this LV_ARABIC is assigned to smartform text, then once printed on PDF, it will work fine.
We can also use the function module STRING_REVERSE instead of looping through the string to reverse it and pass to the smartform to show it correctly. But would appreciate if there could be a better approach used by somebody to resolve this issue.
Hi I am also working with English and Arabic Smartforms and my problem is when printing , the letters have spaces in between them.. did you encounter this also? and what is the solution for this?