Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
hanna_choi
Partner - Creator
Partner - Creator

How do I apply "For Each.. Next" syntax in LOAD ...SAP select...

Hello

I need your help.

I am using SAP connector.
The SAP Select syntax is divided into Dimension, Measurements, and Variables.

 

The Year condition is setting in the Variables syntax
I want to use the For Each syntax for Year condition.

How do I do this?

 

Best Regard.

hanna.choi

Labels (2)
2 Replies
tresesco
MVP
MVP

hanna_choi
Partner - Creator
Partner - Creator
Author

Hello

I declared the company code as a variable and used For Each.

But it only takes one time and fails to execute the loop.

What's the problem?

Below is the sample code.

==========Sample Code

FOR each vCCode in 0006,0008,0009

[ZZSD_M01_Q002_QS]:
LOAD
[0DIVISION] as [Division],
[0MATERIAL] as [Material],
[ZMAT_VAL_0PRICE_VAL] as [MSRP],
[ZMAT_VAL_0PRICE_STD] as [Standard Price],
[5C78ZVZ25PQP3ET4M2E32068B] as [Exploded Units],
[5C78ZWEF7MY44NW0XQIRM43NV] as [Gross Sales],

SELECT [ZZSD_M01_Q002_QS]
DIMENSIONS (
[0DIVISION], //Division
[0MATERIAL], //Material
[ZMAT_VAL_0PRICE_VAL], //[MSRP]
[ZMAT_VAL_0PRICE_STD], //[Standard Price]
)
MEASURES (
[5C78ZVZ25PQP3ET4M2E32068B], //Exploded Units
[5C78ZWEF7MY44NW0XQIRM43NV], //Gross Sales
)
UNITS (
[CURRENCY004.5C78ZVZ25PQP3ET4M2E32068B], //CURRENCY004 Exploded Units
[UNIT004.5C78ZVZ25PQP3ET4M2E32068B], //UNIT004 Exploded Units
[CURRENCY006.5C78ZWEF7MY44NW0XQIRM43NV], //CURRENCY006 Gross Sales
[UNIT006.5C78ZWEF7MY44NW0XQIRM43NV], //UNIT006 Gross Sales
)
VARIABLES (
[NAME=ZPDIVS, SIGN=I, OPTION=EQ, LOW=48], //Division
[NAME=0S_COCD, SIGN=I, OPTION=EQ, LOW=$(vCCode)], //Company Code
[NAME=0SALEORG, SIGN=I, OPTION=EQ, LOW=0041], //Sales Org
)

FROM [ZSD_M01];


next vCCode