Application Development and Automation 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: 
Read only

layout set

Former Member
0 Likes
652

Hi,

i have some problem in displaying lsyout.

actually in data table matnr is of 13 size.

but in output i want that of only 8 size.

so plz tell me how to do.

thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
631

hi,

fix your output length as 8 in the field catalogue for Matnr

regards,

nazeer

6 REPLIES 6
Read only

Former Member
0 Likes
631

Hi

MATNR is of length 18 char

if you wants to display just 8 char

then use offset

&MATNR+10(8)&

if it is 13 char then

or &MATNR+5(8)&

or you can write &MATNR(8&

Reward points if useful

Regards

Anji

Message was edited by:

Anji Reddy Vangala

Read only

Former Member
0 Likes
632

hi,

fix your output length as 8 in the field catalogue for Matnr

regards,

nazeer

Read only

Former Member
0 Likes
631

I think you have posted the same thread twice... please close atleast one of them .... before more people answer to your thread....

Also be careful while alloting points...

Regards,

Jayant

Read only

Former Member
0 Likes
631

Hi,

You can use <b>offset</b> while printing in the sapscript.

You can address a section of a string in any statement in which non-numeric elementary ABAP types or structures that do not contain internal tables occur using the following syntax:

<f>[+<o>][(<l>)]

By specifying an offset <o> and a length (<l>) directly after the field name <f>, you can address the part of the field starting at position <o>1 with length <l> as though it were an independent data object.

Sample code is given below.

DATA TIME TYPE T VALUE '172545'.

WRITE TIME.

WRITE / TIME+2(2).

CLEAR TIME+2(4).

WRITE / TIME.

The output appears as follows:

172545

25

170000

<b>plz reward points if helpful or if it solves ur query.</b>

Thanks

Chinmay

Read only

Former Member
0 Likes
631

MATNR is of length 18 char

u need only 8 characters use offset option

&MATNR+10(8)&

Reward and close duplicate threads

Read only

former_member198270
Active Contributor
0 Likes
631

Hi SK ,

First go and check into data base table the lenth of test data ,

if its like 0000000094227 .

then You can truncate the leading zeros to 00094227 . using function module

There are two very important functional modules ,which are used to add zeroes(‘0’) & Remove zeroes(‘0’) from numeric string input respectively.

The functional module ‘CONVERSION_EXIT_ALPHA_INPUT’ comes handy in this situation.

Another functional module ‘CONVERSION_EXIT_ALPHA_OUTPUT’ is used to reverse the Operations performed by the above FM.

Let us look up the first case.

Function Module: CONVERSION_EXIT_ALPHA_INPUT

PARAMETER:

Importing Parameter: Input of type ‘C’

Exporting Parameter: Output of type ‘C’.

This function module is use to add zeroes (‘0’), to the left of the numeric string input ,after making the input numeric string right justified .

If the input string is non-numeric (including alphanumeric) , string is stored as left justified ,with blanks towards the right.

If the string is numeric say vehicle number , vlcvehicle-vhcle( 10 char)

INPUT : ‘123456’

OUTPUT : ‘0000123456’

Whereas if string is non-numeric

INPUT : ’ABCD’

OUTPUT: ‘ABCD’.

Hope this will solve your problem.

<b>Reward Points if Helpful</b>

Regards,

Amber