Application Development 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: 

Concatenate 2 fields in SAP Query

Former Member
0 Kudos
2,945

Hello,

We have a requirement where we have developed a report in SAP query, but we require a local field to basically give the concatenation of two fields detailed in the info set (EKPO-EBELP & EKET-ETENR)

Can you help me with how to learn to do this?

Many thanks

Steve

1 ACCEPTED SOLUTION

former_member214131
Active Contributor
0 Kudos
490

Hello,

In your Infoset(SQ02), choose coding. In the 'Data' part of coding, you declare the new global variable. Depending on the requirement you concatenate the variables in appropriate part of coding ( Start-of-selection, Record processing etc.,)

Hope this helps you.

Regards, Murugesh AS

7 REPLIES 7

former_member214131
Active Contributor
0 Kudos
491

Hello,

In your Infoset(SQ02), choose coding. In the 'Data' part of coding, you declare the new global variable. Depending on the requirement you concatenate the variables in appropriate part of coding ( Start-of-selection, Record processing etc.,)

Hope this helps you.

Regards, Murugesh AS

0 Kudos
490

Hi,

It hasnt really helped. I was under the impression I would need to create an additional field, and then apply some coding to have this field give the value of the concatenation. This field would then become avialable in the query for output.

Can you expand on this?

Steve

0 Kudos
490

Stephen, hi

You can only achieve this within the infoset, not in the query. Whoever creates/maintains your infosets will need to set this up and make it available in all queries using the infoset.

Kind regards

Mark

0 Kudos
490

Yes, in your infoset, you need to create an addtional field, add it to a field group. Also, add the coding, probably something like this.

Concatenate EKET-EBELP EKET-ETENR into NEW_FIELD.

Then, in your query, just pull the new field in.

Regards,

Rich Heilman

0 Kudos
490

Hi Rich,

Yes, I figured the code would be something like that, however, when I generate the infoset, I get the following:

Global syntax check
Additional Fields
Error in code for additional field ITSCH
The last statement is not complete (period missing)

I have placed the following code in the Additional fields/structure section

Concatenate EKET-EBELP EKET-ETENR into ITSCH

Can you help with what is probably a simple issue?

Many thanks

Steve

0 Kudos
490

Add a period at the end of that line of code.

Regards,

Rich Heilman

0 Kudos
490

Brilliant, yes, forgot the full stop!