‎2009 Mar 10 9:01 AM
Hi,
Im displaying 2 string variables using write statement. The variables are var1 & var2 .var1 is of length 40 while var2 is of length 10.
The write statement is of form . write:/ var1 , var2.
However if var1 contains smaller data lets say 'abc' the output is displayed as
'abc ' var2.
It leaves 37 blank characters and then displays var2 contents. Is there any way to trim var1 while displaying ?
Kindly suggest any direct method, i dont want to use a third dummy variable .
Counting on your expertise frnds .
Thanks
‎2009 Mar 10 9:02 AM
‎2009 Mar 10 9:03 AM
‎2009 Mar 10 9:05 AM
Hi Mak,
Unpack works only in case of numeric values it will give dump if the value is character
For this u have to
Delete leading spaces from var1.(syntax)
and then print.
or
SHIFT var1 RIGHT DELETING TRAILING space.(change right to left and trailing to leading as desired)
Thanks & regards,
Ruchi Tiwari
Edited by: Ruchi Tiwari on Mar 10, 2009 10:08 AM
‎2009 Mar 10 9:09 AM
Hello,
You can try using the key word addition NO-GAP with the WRITE stmt.
I tried but did not find any keyword which fits your requirement.
You need to declare a 3rd variable & try:
DATA:
v_var1 TYPE char10 VALUE 'No',
v_var2 TYPE char10 VALUE 'Gaps',
v_var3 TYPE string.
CONCATENATE v_var1 v_var2 INTO v_var3 SEPARATED BY space.
WRITE: v_var3.May be someone else has a better answer.
BR,
Suhas
Edited by: Suhas Saha on Mar 10, 2009 10:16 AM
‎2009 Mar 10 9:13 AM
Hi,
Use strings instead, whatever may be the value,it will take only the space required.
data : var1 type string value 'asd',
var2(10) type c value 'sdf'.
write 😕 var1,var2.
‎2009 Mar 10 9:14 AM
Write: Var1 no-gap, var2.
I dont have sap access, can you check
‎2009 Mar 10 9:32 AM
no-gap doesnt work ! Thanks for your replies guys...but still im struggling
‎2009 Mar 10 9:34 AM
‎2009 Mar 10 9:36 AM
Hello Mac,
Did you check my solution? Or you DONOT want to use a new variable.
BR,
Suhas
‎2009 Mar 10 9:45 AM
thanks for your inputs guys , I dont want to use third variable because there are more than 20 variables for which i want to trim the variables . So is there any way i can do it in write statement itself ?
‎2009 Mar 10 10:01 AM
use Concatenate var1 ,var2 into var1 sperated by ','.
condense var1 with no gaps.
write 😕 var1.