Skip to Content
0

replacing SQL parameters by [%] in sbo

Nov 24, 2017 at 10:29 AM

102

avatar image
Former Member

I have the following simple sql query which is part of longer SQL query .

I want to run the entire query in SBO .

question : How to replace SQL parameters in the query by SBO Parameters ( [%0] )

declare @start date = convert (date,'01/01/2017',103),

@end date = convert (date,'01/12/2017',103) ;

select convert (date,t0.DocDate,103) AS DocDate ,

'curentPeriod ' as curentPeriod, t0.DocTotal as DocTotal , t0.CardCode as cardCode, T0.SlpCode as Splcode

from OINV t0

where T0.DocDate between @start and @end

and t0.CardCode <>3000001

union all

select convert (date,t0.DocDate,103) AS DocDate ,

'curentPeriod ' as curentPeriod,

t0.DocTotal as DocTotal ,

t0.CardCode as cardCode,

T0.SlpCode as Spl from ORIN t0

where T0.DocDate between @start and @end

and t0.CardCode <>3000001 ;

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Best Answer
Johan Hakkesteegt Nov 24, 2017 at 11:01 AM
0

Hi,

Here is an example syntax:

/* select  * from OJDT t1   */
DECLARE @EndDate DATETIME
SET @EndDate = /* t1.RefDate */  '[%0]'
SELECT @EndDate

Regards,

Johan

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 24, 2017 at 12:29 PM
0

Hi

Thanks for both answers.

CTE works , haven't tried yet TVF.

dov

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hi Dov,

May I ask why you unaccepted my answers to both your questions?

Regards,

Johan

0
Former Member

Hi Johan,

I appreciate on your answers and thanked you.

Why have you got the impression that I did not accepted them ?

Dov

0

Hi Dov,

Perhaps a SCN system bug. Both answers were accepted and shortly thereafter they were "unaccepted". Please take a look at my answer, and you can see that the 'accept' button can be pressed. Once pressed the link will change to 'unaccept'. Did you perhaps double-click the link?

I will let SCN support know that you did not unaccept the answers (on purpose at least).

Best regards,

Johan

0
avatar image
Former Member Dec 11, 2017 at 08:06 AM
0

Hi John

I guess it was my mistake, sorry.

i am quite Newbie to SBO . can i ask you more questions concerning building complicated queries in query generator ?

Best regards,

Dov

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Dov,

Don't worry about it, I don't think it was your mistake. This SCN platform is only a year old and there is still a lot wrong with it.

Of course you can ask as many questions as you like. However, please post a new question for each issue. That way more people will try to help you.

Regards,

Johan

P.S. when you clicked 'Accept' the first time, did you double-click, or did you have to click a second time because the page did not show you right away that the answer was accepted?

0
avatar image
Former Member Dec 11, 2017 at 11:07 AM
0

Hi;

I really dont remember;

I

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Dov, I'm part of the SAP Community Experience team, trying to figure out if there is a bug. Would you mind trying to accept again? We are wondering if there an issue that the system is not displaying the 'Accepted' status as expected when you click it. If that is the case, screenshots and browser/device you are using will help us get to the bottom of it.

https://answers.sap.com/questions/361023/common-table-expression-and-table-valued-function.html

https://answers.sap.com/questions/363287/replacing-sql-parameters-by-in-sbo.html

0
avatar image
Former Member Dec 11, 2017 at 06:38 PM
0

Hi;

Screen shoot 1 capture-1.png

Screen shoot 2 after accepting capture-2.png

I am using Google Chrome on Dell XPS laptop OS is Window 10 pro


capture-1.png (73.1 kB)
capture-2.png (68.8 kB)
Share
10 |10000 characters needed characters left characters exceeded