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: 

SQ01 SAP Query formula help ...

Former Member
0 Kudos


Hi

I am trying to perform a comparison of  MARC-PRCTR (Profit Center)  to Material Group  (MARA-MATKL)

To peform the comparison i need to extract the middle 3 characters frmo Profit Center to match against Material Gruopo.

In excel i would use the MID formula applied to retrieve 3 of the 6 characters ( like we do in excel  MID(cell,3,3)

Lcoal field

3PRCTR  = FORMULA for PRCTR (3,3)  (where we retrieve the 3rd, 4th and 5th characters of Profit Center>

But i I am not able to create a local formula that applies  this  same type of logic to retrieve , ist is possible?

ProfitCenter                   Result of Formula                         MatlGrp     comment

01ABC567              formula      ABC     compare  ABC  would yield a match 

01CDE545            fomula     CDE     compare  ABC      would yield a mimatch

Local formula  for CHECK  would then be run to check for inonsistencies

i.e.

Check   = Formula   (local names)

               3PRCTR  <> MATLGP   = 1   else   0  ( would yield mismatches)

1 ACCEPTED SOLUTION

jogeswararao_kavala
Active Contributor
0 Kudos

Hello William,

This will be possible in SQ02 (the infoset). Here, in the Extras section:...

Create an additional field of type CHAR3 say 3PRCTR.

Give a code to this additional field as


3PRCTR = MARC-PRCTR+3(3).

(This picks up the 4th,5th and 6th characters of the MARC-PRCTR value and stores in your additional field 3PRCTR )

Now

Create another Additional field say MATLGP like you did for 3PCRTR.

(Sequence number should be after that of 3PCRTR. Means if sequence number of field 3PCRTR is 1 then this field should have 2.)

Give a code to this additional field (MATLGP) like below.


If 3PCRTR <> MARA-MATKL.

MATLGP = '1'.

else.

MATLGP = '0'.

endif.

Take these fields to Field Group folders (to have them in SQ01).

Generate Infoset. Run SQ01 and take these fields to List.

You may go through this post:

Also related posts:

Good luck

KJogeswaraRao

2 REPLIES 2

jogeswararao_kavala
Active Contributor
0 Kudos

Hello William,

This will be possible in SQ02 (the infoset). Here, in the Extras section:...

Create an additional field of type CHAR3 say 3PRCTR.

Give a code to this additional field as


3PRCTR = MARC-PRCTR+3(3).

(This picks up the 4th,5th and 6th characters of the MARC-PRCTR value and stores in your additional field 3PRCTR )

Now

Create another Additional field say MATLGP like you did for 3PCRTR.

(Sequence number should be after that of 3PCRTR. Means if sequence number of field 3PCRTR is 1 then this field should have 2.)

Give a code to this additional field (MATLGP) like below.


If 3PCRTR <> MARA-MATKL.

MATLGP = '1'.

else.

MATLGP = '0'.

endif.

Take these fields to Field Group folders (to have them in SQ01).

Generate Infoset. Run SQ01 and take these fields to List.

You may go through this post:

Also related posts:

Good luck

KJogeswaraRao

0 Kudos

Hi There,

I enjoyed very much reading your blog "Infoset Query: User Defined Fields".

I am not sure why, but I was not able to comment or reply to any of the existing comments - perhaps some settings in SCN are wrong?

So sorry for posting here if it is slightly off topic, perhaps you can help me post in the relevant spot, if I'm not able.

I do have this question, perhaps you can help me as I searched high and low for a solution.

I have a further question on Concatenation.

You answer in your blog:

1. Create an Additional Field (say ADDL1) in Infoset (Extras) as explained.2. Give code below for this fields as     CONCATENATE TABLE1-FIELD1 TABLE1-FIELD2 INTO ADDL1.    CHECK TABLE2-FIELD1 = ADDL1.

Is there any syntax that makes it possible to concatenate the values of two text fields into one new field, by simply using a user defined local field within SQ01?

Or is creating ABAP code in SQ02 with a new addtiional field in the Infoset the only method?