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

sapscript leading zero's issue

Former Member
0 Likes
871

Hi All,

I have a small issue in SAPSCRIPT.

Actual Number to be printed from database is: 0569365851007

Now in sapscript the number is comming in thru REGUD-OBKNT,this is a 18 character field.

In layout i declared in two ways,but could not get the desired result:

1)Just REGUD-OBKNT --> Output is 000000569365851007

2)REGUD-OBKNT(Z) --> Output is 569365851007

But i need the output exactly as entered in the transaction ie 0569365851007

Hope someone can help out...

Thanks.

Message was edited by: Alen david

6 REPLIES 6
Read only

Former Member
0 Likes
825

Hi alen,

1. do not use REGUD-OBKNT

2. instead just use

the field / parameter

as type C length 18.

regards,

amit m.

Read only

Former Member
0 Likes
825

hi alen ,

check this .

data: q(18) type c value '0569365851007'.

data: p type string .

p = q.

write p .

if this option works for u then u need to declare the data type as character and assign from ur data base to the character initially

then submit to the script as shown .

regards,

vijay.

Read only

Former Member
0 Likes
825

hi alen ,

like since u hav REGUD as a structure then it will hold data then u can proceed as

data: val type string.

declaration should be in global for safe side and check the same in program symbols.

my second option is .

populate

val = regud-obnkt ,

{so this should hold the value with zero 0569365851007

now submit val to the script which is 0569365851007.

regards,

vijay.

Read only

kvenkatesh-in
Explorer
0 Likes
825

Hi,

If u move 0569365851007 to REGUD-OBKNT, automatically the field will be filled with leading zeros(000000569365851007) in the print program itself. Check this field content before passed to script by debugging then u will get some idea.

Don't use the REGUD-OBKNT field to pass the data to sapscript.

-venkatesh-

Read only

Former Member
0 Likes
825

Dear All,

Thanks for your replies.

The data in REGUD structure is being populated from a standard program(actually a copy of standard)...so its litle difficult.

Isn't there any way to address this issue in layout itself.

Offcousre if not i will have to go debug the program and make appropriate changes.

Read only

0 Likes
825

Hi Alen,

Do you know the length of this field in the database...

If you know, then you can make use of the offset and do that like this...REGUD-OBKNT+5(13)

Also you can use the /: perform control command from inside a sapscript and call a subroutine that you can write in a z-program.

use this to pass the variable and change it...

help link on sapscript control command for perform...

http://help.sap.com/saphelp_40b/helpdata/en/d1/803279454211d189710000e8322d00/content.htm

Thanks,

Renjith