Skip to Content
Jan 25, 2022 at 01:10 PM

CPI-DS (HCI-DS): Loop, edit global variable, get value for variable. Questions


Hi Experts!

I have datastore S/4HANA as source and IBP as target. I need to separate information in parts (example - 10 rows).

Example. Source table: MARA , Target Table - SOPMD_STAG_SAPPRODUCT.

Global variables:

$G_START_ROW , integer, initial value = 0

$G_END_ROW , integer, initial value = 10

$G_TOTAL_ROWS, integer, initial value NULL (not configured).

My logic. In the data flow:

first query:


get all interested columns, set any filter. Order by PRDID ASC (Primary key column).

Second query: Add column "Row_Num_Generated", mapping - gen_row().

Target query. Filter

Row_Num_Generated >= $G_START_ROW and Row_Num_Generated <=$G_END_ROW

OK. First run is OK, but how run this dataflow again, if total count rows more than 10? Example 200? In this case I must set loop, which will re-run dataflow, while $G_TOTAL_ROW< $G_END_ROW

In this case I must add into script:

---- here must command to get count rows from source table. How?




$G_END_ROW = $G_END_ROW + 10;

------ here must command to re-run. How?



raise_exception_ext('All information was imported. Finish Job', 0); ----it's incorrect work. SAP Help describe, that 0 means "Success", but in fact in this moment task stopped with error, not with "Success"

Three questions.

What is command to re-run dataflow?

How to get total count of rows from source table S/4HANA? Command $G_TOTAL_ROW=sql('S4', 'select count(*) from Table') is not working.

How I can stop task with status "Success"?