cancel
Showing results for 
Search instead for 
Did you mean: 

how to make centering for a string

Former Member
0 Kudos

Hi,

We have a function module called STRING_CENTER to centering a string. inaddition to this, is there any alternative method to place a string in center position in the report header.please give me the answer for this one.

Thanks & Regards.

Laxman.P

Accepted Solutions (0)

Answers (4)

Answers (4)

varma_narayana
Active Contributor
0 Kudos

Hi..

This should work for u.

REPORT ZREP00 LINE-SIZE 100.

WRITE :/(<b>SY-LINSZ</b>) <YOUR VARIABLE> CENTERED .

<b>Reward if Helpful.</b>

former_member588853
Active Contributor
0 Kudos

HI,

Use the Function module

"<b>STRING_CENTER</b>"... Pass your string..

Display the exporting value and it will be centered..

Eg:

<b>DATA: v_string TYPE char200 VALUE 'STRING HEAD'.

DATA out_string TYPE char200.

CALL FUNCTION 'STRING_CENTER'

EXPORTING

string = v_string

IMPORTING

cstring = out_string

  • EXCEPTIONS

  • TOO_SMALL = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

WRITE : / out_string.</b>

Copy paste the above program in your editor

rewards if useful.

regards,

Nazeer

Former Member
0 Kudos

hi,

u can give the length in write statement

like below

<b> WRITE: 55 'PURCHASE ORDER DETIAL'</b>

Regards,

Divya

Message was edited by:

Divya

former_member196280
Active Contributor
0 Kudos

WRITE 01(15) <VARIABLE> CENTERED .

Regards,

SaiRam