‎2006 Oct 14 7:29 AM
Hi Friends,
I am capturing the numbers in selection screen parameter. eg: 10.
Later I am using this value concatenating with some word. Eg. Test.
The result i am getting is '010 Test'.
How to get the result as '10 Test'. (The '0' appearing before to 10 should be avoided).
Also how I can add 1 to parameter value. (10 + 1 = 11).
Eg. 11 Test.
Could u pls guide me.
TIA.
Regards,
MARK K
‎2006 Oct 14 7:34 AM
HI Mark
How about using SHIFT Left statement before concatenating.
Eg:
shift <fld1> left deleting leading '0'.
concantenate <fld1> 'Test' into <fld2> separated by space.Also have a look at PACK/UNPACK statements.
Kind Regards
Eswar
‎2006 Oct 14 7:34 AM
hi,
try to use,
Fm -> CONVERSION_EXIT_ALPHA_OUTPUT (removing zeros)
rgds
anver
Message was edited by: Anversha s
‎2006 Oct 14 7:34 AM
HI Mark
How about using SHIFT Left statement before concatenating.
Eg:
shift <fld1> left deleting leading '0'.
concantenate <fld1> 'Test' into <fld2> separated by space.Also have a look at PACK/UNPACK statements.
Kind Regards
Eswar
‎2006 Oct 14 7:50 AM
Hi Eswar,
Removing '0' is solved. But, how I can increment the value by 1. ie., I have to change the character type to integer. How to do that.
Regards,
‎2006 Oct 14 7:54 AM
Hi,
Try this function <b>CONVERT_STRING_TO_INTEGER</b>
check the below code which will convert character to integer..
DATA NO1(10) TYPE C VALUE '1234567890'.
DATA NO2 TYPE I.
NO2 = NO1.
WRITE NO2.
the foll code will convert the <b>string</b> to interger.
DATA NO1 TYPE STRING.
DATA NO2 TYPE I.
NO1 = '1234567890'.
NO2 = NO1.
WRITE NO2.
hope this helps
Regards
Alfred
‎2006 Oct 14 8:03 AM
Hi Mark
No need of conversion to integer if we declare the initial variable of <b>type 'N'</b>.
Please see this example for some understanding:
data: l_num(3) type n value '010'.
data: l_text(20) type c.
perform print using l_num.
l_num = l_num + 1.
perform print using l_num.
form print using l_num.
shift l_num left deleting leading '0'.
concatenate l_num 'Test' into l_text separated by space.
write:/ l_text.
endform.
Am not on SAP, so please bear if there are any syntax errors.
Kind Regards
Eswar