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

SAP SCRIPT - URGENT

Former Member
0 Likes
1,445

I have a requirement.

I need to combine two strings (virables) into one virable in sap script.

does anyone know how to make it?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,064

Hi

You can write the both side by side like

&ITAB-NAME1& &ITAB-NAME2&

Reward points if useful

Regards

Anji

8 REPLIES 8
Read only

Former Member
0 Likes
1,065

Hi

You can write the both side by side like

&ITAB-NAME1& &ITAB-NAME2&

Reward points if useful

Regards

Anji

Read only

0 Likes
1,064

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?

Read only

0 Likes
1,064

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

Read only

0 Likes
1,064

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

Read only

Former Member
0 Likes
1,064

hi,

use this statement as

CONCATENATE &v1& &v2& INTO [&v1& or & other variable& ]

if helpful reward some points.

with regards,

suresh babu aluri.

Read only

0 Likes
1,064

should i define this other variable then?

define ????

Read only

0 Likes
1,064

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

Read only

0 Likes
1,064

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.