Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Arabic numbers are being flipped in ALV (ABAP)

I am trying to display the following text in a column in ALV:

'شهر ١٢ '

but it keeps keeps flipping and showing as

'١٢ شهر' instead.

How I am writing it in code: (mnths_c is in arabic)

How it's being displayed:

what is the solution to this?

Is it about converting Unicode or something?

Please help

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor

With Unicode characters U+200E (left to right) and U+200F (right to left), you can play with the order of words:

DATA(messages) = value bapirettab(
    ( message = 'شهر ١٢' )
    ( message = '١٢ شهر' )
    ( message = | شهر { '١٢' }| )
    ( message = |{ '١٢' } شهر | )
    ( message = |شهر{ cl_abap_conv_in_ce=>uccp( '200E' ) } { '١٢' }| )
    ( message = |{ cl_abap_conv_in_ce=>uccp( '200F' ) }شهر{ cl_abap_conv_in_ce=>uccp( '200E' ) } { '١٢' }| ) ).
DATA salv TYPE REF TO cl_salv_table.
CALL METHOD cl_salv_table=>factory
  IMPORTING
    r_salv_table = salv
  CHANGING
    t_table      = messages.
salv->display( ).

7 REPLIES 7

former_member753791
Participant
0 Kudos

Hi Hussein,

Use CONCATENATE statement to achieve it.

CONCATENATE mnths_c 'شهر' INTO gv_text. "If you require space just add SEPARATED BY SPACE after gv_text.

Then assign it into the wa used above.

Note :Please take all variables in string format or character with specified length.

Reward if helpful.

Regards,

Rohit

0 Kudos

hey Rohit,

It gives the same outcome as my piece of code.

Sandra_Rossi
Active Contributor

With Unicode characters U+200E (left to right) and U+200F (right to left), you can play with the order of words:

DATA(messages) = value bapirettab(
    ( message = 'شهر ١٢' )
    ( message = '١٢ شهر' )
    ( message = | شهر { '١٢' }| )
    ( message = |{ '١٢' } شهر | )
    ( message = |شهر{ cl_abap_conv_in_ce=>uccp( '200E' ) } { '١٢' }| )
    ( message = |{ cl_abap_conv_in_ce=>uccp( '200F' ) }شهر{ cl_abap_conv_in_ce=>uccp( '200E' ) } { '١٢' }| ) ).
DATA salv TYPE REF TO cl_salv_table.
CALL METHOD cl_salv_table=>factory
  IMPORTING
    r_salv_table = salv
  CHANGING
    t_table      = messages.
salv->display( ).

0 Kudos

Fantastic! it worked perfectly, thank you very much Sandra!

0 Kudos

What's the difference between '200E' and '200F' though?

U+200E : left to right

U+200F : right to left

Of course, to clarify the code, this would be better:

DATA(left_to_right) = CONV string( cl_abap_conv_in_ce=>uccp( '200E' ) ).
DATA(message) = |شهر{ left_to_right } { '١٢' }|.