04-16-2009 3:23 PM
Hi All,
I want to add space to the internal table variable depending on the condition. If the variable length is less than 30, it will add space after the variable and it will make the length as 30. i have given the sample code below,
data: len_g type char30 value ' '.
len1 = STRLEN( data-tplnr ).
IF len1 < con_30. *it will check length is less than 30
len2 = con_30 - len1.
concatenate data-tplnr+len_g(len2) into data-tplnr.
output-tplnr = data-tplnr.
APPEND output-tplnr TO intoutput-tplnr.
else.
*other part.
endif.
i am getting the error 'Unable to interpret data-tplnr+len_g(len2)' .
If the length of variable is 12, then the remaining length will be spaces after variable.
04-16-2009 4:13 PM
data: len_g type char30 value ' '.
len1 = STRLEN( data-tplnr ).
IF len1 < con_30. *it will check length is less than 30
len2 = con_30 - len1.
concatenate data-tplnr len_g+0(len2) into data-tplnr.
output-tplnr = data-tplnr.
APPEND output-tplnr TO intoutput-tplnr.
else.
*other part.
endif.
Regards,
Lalit Mohan Gupta.
04-16-2009 3:27 PM
Hi Mukil,
try this..
IF len1 < con_30.
Split the variable into two characters as per your requrement.
and Format the two variables into two place's..
endif.
Regards,
Prabhudas
04-16-2009 3:31 PM
If you wan to move to right if characters less than 30
IF len1 < con_30. *it will check length is less than 30
write data-tplnr into data-tplnr right justified.
else.
*other part.
endif.
04-16-2009 3:32 PM
HI,
You cannot increase the length of the field tplnr by adding extra space after the value. Even after adding spaces after the value and check the strlen it will return actual length excluding space.
04-16-2009 3:46 PM
Hi,
U code like below:
data: len_g type char30 value ' '.
len1 = STRLEN( data-tplnr ).
IF len1 < con_30. *it will check length is less than 30
len2 = con_30 - len1.
do len2 times.
concatenate data-tplnr ` ` into data-tplnr.
enddo.
output-tplnr = data-tplnr.
APPEND output-tplnr TO intoutput-tplnr.
else.
*other part.
endif.
Hope it helps!!
04-16-2009 4:06 PM
Hi vishnu,
if i print the barcode it is not giving me correct answer.
04-16-2009 4:13 PM
data: len_g type char30 value ' '.
len1 = STRLEN( data-tplnr ).
IF len1 < con_30. *it will check length is less than 30
len2 = con_30 - len1.
concatenate data-tplnr len_g+0(len2) into data-tplnr.
output-tplnr = data-tplnr.
APPEND output-tplnr TO intoutput-tplnr.
else.
*other part.
endif.
Regards,
Lalit Mohan Gupta.
06-29-2009 12:16 PM
Hi Mukilan,
You cannot print spaces in barcode after a variable. The last character should be a full stop or comma or something valid character. If there is a character in last place. you can print spaces in barcode between variable and last character. This is because after any varible, the system use to consider it as spaces. so, it wil not print any spaces after variable. Make sure that at last place there is a character.
Regards,
Sameer.