‎2007 May 21 11:50 AM
I have a requirement.
I need to combine two strings (virables) into one virable in sap script.
does anyone know how to make it?
‎2007 May 21 11:53 AM
Hi
You can write the both side by side like
&ITAB-NAME1& &ITAB-NAME2&
Reward points if useful
Regards
Anji
‎2007 May 21 11:53 AM
Hi
You can write the both side by side like
&ITAB-NAME1& &ITAB-NAME2&
Reward points if useful
Regards
Anji
‎2007 May 21 11:56 AM
No,
i need to combine two virables into one and then i will be deviding it into some other parts. so i need to combone it first.
do u know u if its possible?
‎2007 May 21 12:00 PM
You can try calling a subroutine in the place in the SAP Script in a custom progam passing the 2 variables and combining them in the sub-routine and using thereafter as per your requirement.
Reward if useful!
Thanks,
Stock
‎2007 May 21 12:01 PM
Hi Julia,
Scripts does not allow you to concatenate two variables into a single one in script editor. You need to combine them in driver program and use the same variable in scirpt using CONCATENATE statement (or) Use a PERFORM statement in the script editor and define the FORM in the driver program.
Thanks,
Vinay
‎2007 May 21 11:59 AM
hi,
use this statement as
CONCATENATE &v1& &v2& INTO [&v1& or & other variable& ]
if helpful reward some points.
with regards,
suresh babu aluri.
‎2007 May 21 12:03 PM
‎2007 May 21 12:16 PM
Hi Julia,
You need to define the the other variabel in DRIVER PROGRAM and display the same in the script editor.
<b>In driver program:</b>
DATA VC_NAME TYPE STRING.
CONCATENATE V_NAME1 V_NAME2 INTO VC_NAME.
<b>In scirpt editor:</b>
&VC_NAME&
Thanks,
Vinay
‎2007 May 21 12:23 PM
well way to go is:
make an external perform, where you jump from your form back to the abap interpreter.
Sap-Script syntax:
/: define &YOUR_STRING& = ' '
/: perform combine_string in program xyz
/: using &FIRST_STRING&
/: using &SECOND_STRING&
/: changing &YOUR_STRING&
/: endperform
in your program xyz you need to code that form as follows:
form combine_string TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
data: lv_string1 type c length 50,
lv_string2 type c length 50,
lv_return type c length 50.
read table in_tab
with key name = 'FIRST_STRING'.
if sy-subrc = 0.
lv_string1 = in_tab-value.
endif.
read table in_tab
with key name = 'FIRST_STRING'.
if sy-subrc = 0.
lv_string2 = in_tab-value.
endif.
Here do your concatenate, shift, ... stuff. ***
read table out_tab
with key name = 'YOUR_STRING'.
if sy-subrc = 0.
out_tab-value = lv_return.
modify out_tab index sy-tabix.
endif.
endform.