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: 

Field match

Former Member
0 Kudos

Hi Guru,

I have material group in my internal table.

So I have to make that as 7 character. means if I have number as 123 then it should show as 123 means preceeding by 4 spaces. if 1234 then it should show as 1234 preceeding by 3 spaces and so on.

Please help me.

4 REPLIES 4

Former Member
0 Kudos

hi there is nothing to do like this ..

it will automatically fetch the data it will give the required space automatically....if you write like this..

loop at itab into wa.

itab1-matnr = wa+0(7).

endloop.

Former Member
0 Kudos

Hi,

try this:

tables: mara.

*

select * from mara up to 100 rows.

write: / mara-matkl right-justified.

endselect.

Regards, Dieter

Former Member
0 Kudos

hi sandeep,

create a data object

data : a(7) type n.

assign internal table value to this data object.

Reward points if helpful,

Regards,

Ani

Former Member
0 Kudos

Hi,

you can check following code. It may solve your problem

DATA mat(7) TYPE c.

DATA: text TYPE string VALUE `1234`,

num TYPE i,

rem TYPE i,

c_0 TYPE c VALUE '0'.

MOVE text TO mat.

WRITE: / text.

WRITE: / mat.

num = STRLEN( mat ).

WRITE: / num.

rem = 7 - num.

DO rem TIMES.

IF rem <= 0.

EXIT.

ENDIF.

CONCATENATE c_0 mat INTO mat.

ENDDO.

WRITE: / mat.