import data in data hub and then execute process to laod several Models

using anaplan connect.

batch executed via a BODS job called by a SAP process chain.

All is working well if i import a file with Master data in

1-data Hib

2-model 1

 

now i would like to do same action but want to send this is 2 additionals models so basically:

1-data Hib

2-model 1

3-model 2

4-model 4.

our anaplan architecture is build with these 3 models.

step1 and 2 are ok, but look like 3 and 4 are not running - so nothing new compare to old logic

my batch job is the following:

 

@echo off

rem *** End of settings - Do not edit below this line ***

rem *** Data Hub ***

 

set FexFolder=%1

set FileName=%~2

 

set AnaplanUser="xxx"

set WorkspaceId="WP for datahub"

set ModelID="Data Hub"

set Operation=-certificate ".\certificate-xxxx" -file "Product Hierarchy Load.csv" -put "\\gva.data\fex\%FexFolder%\USA\Anaplan\Master Data\Inbox\%FileName%" -process "Load Product Hierarchy" -execute -output "\\gva.data\fex\%FexFolder%\USA\Anaplan\Archive\Load_Product_Hierarchy_Errors_Step1"

 

rem *** End of settings - Do not edit below this line ***

 

setlocal enableextensions enabledelayedexpansion || exit /b 1

pushd %~dp0

if not %AnaplanUser% == "" set Credentials=-user %AnaplanUser%

set Command=.\AnaplanClient.bat %Credentials% -workspace %WorkspaceId% -model %ModelId% %Operation%

@echo %Command%

cmd /c %Command% >

rem pause

 

 

@echo off

  

rem *** model 1 ***

 

set AnaplanUser="xxxx"

set WorkspaceId="WP"

set ModelId="model1"

set Operation=-certificate ".xxxxxx" -process "Load Product Hierarchy" -execute -output "\\gva.data\fex\%FexFolder%\USA\Anaplan\Archive\Load_Product_Hierarchy_Errors_Step2"

 

@echo off

 

set AnaplanUser="xxxx"

set WorkspaceId="WP"

set ModelId="model2"

set Operation=-certificate xxxxxx -process "Load Product Hierarchy" -execute -output "\\gva.data\fex\%FexFolder%\USA\Anaplan\Archive\Load_Product_Hierarchy_Errors_Step3"

 

@echo off

 

set AnaplanUser="xxxxx"

set WorkspaceId="WP"

set ModelID="model3"

set Operation=-certificate ".\xxxxxx" -process "Load Product Hierarchy" -execute -output "\\gva.data\fex\%FexFolder%\USA\Anaplan\Archive\Load_Product_Hierarchy_Errors_Step4"

 

 

rem *** End of settings - Do not edit below this line ***

 

setlocal enableextensions enabledelayedexpansion || exit /b 1

pushd %~dp0

if not %AnaplanUser% == "" set Credentials=-user %AnaplanUser%

set Command=.\AnaplanClient.bat %Credentials% -workspace %WorkspaceId% -model %ModelId% %Operation%

@echo %Command%

cmd /c %Command%

exit /b

 

 

so if you can help me with follwing information:

1- is thta posible to call severla model from 1 batch job

2- if possible how to write the batch...

 

currently the step 3 and 4 are not running for me.

 

thanks

Answers

  • ok, find the solution,

    what i did is pretty close to the good solution...

    and do not help the system user to acces s model was not setup ed properly in one model.

    So now with one batch job, i can load data in Data hub and populate 3 models ina single shot.

     

     

  • Hello,

     

    I'm glad you were able to find a solution that worked for you. Would you mind sharing the approach you took? There are a couple options I can think of that would allow you to run all these jobs from a single batch job. One would be to create each individual batch, then a master batch that calls each of these in sequence. The advantage of this would be that each individual script remains easy to maintain, and you can quickly drop in or remove new batches into the master.

     

    Another approach would be to create a monolithic batch with multiple model (and workspace, if applicable), Operation, and Command variables (eg ModelId1, ModelId2, Operation1, Operation2, Command1, Command2, etc). Set Operation1 to perform the push into the Hub, then execute the process to populate the modules with the data. Operation2, 3, 4, and so on to execute the process in each model to pull from the Hub into the target, and finally Command2, 3, 4, etc would execute each respective Operation. So the final lines of your batch would be:

     

    cmd /c %Command1%

    cmd /c %Command2%

    ...

    cmd /c %CommandN%

     

    The upside to this would be there's a single file to maintain, but depending on the scale it may become cumbersom to maintain without good documentation, and best scripting practices.

     

  • Thanks Jesse for your comment.

     

    I did try both option, and i finally decide to have one single batch.

    as this is executed via SAP Data Service, i can control the porper execution of each steps by looking at the creation of a log file generated via the last cmd. so if there is a file, this is ok, process runs properly, SAP DS runs the nexts steps.

    and as there is a single batch to maintain this is easy to do.


    set FexFolder=%1
    set FileName=%~2
     
    set AnaplanUser="xxx"
    set WorkspaceId="workspace1"
    set ModelID="dataHub"
    set Operation=-certificate ".\certificate-xxx" -file "file1" -put "\\%FileName%" -process "process1" -execute -output "\\_Errors_Step1"
     
     
    rem *** End of settings - Do not edit below this line ***
     
    setlocal enableextensions enabledelayedexpansion || exit /b 1
    pushd %~dp0
    if not %AnaplanUser% == "" set Credentials=-user %AnaplanUser%
    set Command=.\AnaplanClient.bat %Credentials% -workspace %WorkspaceId% -model %ModelId% %Operation%
    @echo %Command%
    cmd /c %Command% > \\_Errors_Step1\log1.log
    rem pause
     
     
    @echo off
     
    rem *** End of settings - Do not edit below this line ***

    ***

    set AnaplanUser="xxx"
    set WorkspaceId="worspace 2"
    set ModelId="1model1"
    set Operation=-certificate ".\certificate-xxxx" -process "process2" -execute -output "\\_Errors_Step2"
     
     
    rem *** End of settings - Do not edit below this line ***
     
    setlocal enableextensions enabledelayedexpansion || exit /b 1
    pushd %~dp0
    if not %AnaplanUser% == "" set Credentials=-user %AnaplanUser%
    set Command=.\AnaplanClient.bat %Credentials% -workspace %WorkspaceId% -model %ModelId% %Operation%
    @echo %Command%
    cmd /c %Command% > \\Errors_Step2\log2.log
    rem pause
     
    @echo off
     
    rem *** End of settings - Do not edit below this line ***

    ***

    set AnaplanUser="xxx"
    set WorkspaceId="workspace 2"
    set ModelId="model2"
    set Operation=-certificate ".\certificate-xxx" -process "process1" -execute -output "\\Errors_Step3"
     
     
    rem *** End of settings - Do not edit below this line ***
     
    setlocal enableextensions enabledelayedexpansion || exit /b 1
    pushd %~dp0
    if not %AnaplanUser% == "" set Credentials=-user %AnaplanUser%
    set Command=.\AnaplanClient.bat %Credentials% -workspace %WorkspaceId% -model %ModelId% %Operation%
    @echo %Command%
    cmd /c %Command% >
    rem pause
     
    @echo off
     
    rem *** End of settings - Do not edit below this line ***

     

     

    set AnaplanUser="xxx"
    set WorkspaceId="workspace2"
    set ModelId="model3"
    set Operation=-certificate ".\certificate-xxx" -process "process2" -execute -output "\\Errors_Step4"
     
     
    rem *** End of settings - Do not edit below this line ***
     
    setlocal enableextensions enabledelayedexpansion || exit /b 1
    pushd %~dp0
    if not %AnaplanUser% == "" set Credentials=-user %AnaplanUser%
    set Command=.\AnaplanClient.bat %Credentials% -workspace %WorkspaceId% -model %ModelId% %Operation%
    @echo %Command%
    cmd /c %Command% > \\Errors_Step4_Hierarchy4.log
    rem pause

     

    exit /b
     

  • I'm assuming the processes in model1/model2/model3 all run imports that take their data from the Data Hub model. You should be able to combine everything into one command using something like:

    @echo off
    set FexFolder=%~1
    set FileName=%~2

    set LocalSourceFilePath=\\gva.data\fex\%FexFolder%\USA\Anaplan\Master Data\Inbox\%FileName%
    set LocalErrorFilePath=\\gva.data\fex\%FexFolder%\USA\Anaplan\Archive\Load_Product_Hierarchy_Errors_Step

    set AnaplanUser=youruser@yourdomain
    set CertificateFile=.\path\to\certificate
    set DataHubWorkspace=WP for datahub
    set DataHubModel=Data Hub
    set Workspace=WP
    set ProductHierarchyFile=Product Hierarchy Load.csv
    set Process=Load Product Hierarchy

    Set Command=.\AnaplanClient.bat -user "%AnaplanUser%" -certificate "%CertificateFile%"
    Set Command=%Command% -workspace "%DataHubWorkspace%" -model "%DataHubModel%"
    Set Command=%Command% -file "%ProductHierarchyFile%" -put "%LocalSourceFilePath%"
    Set Command=%Command% -process "%Process%" -execute -output "%LocalErrorFilePath%1"
    Set Command=%Command% -workspace "%Workspace%"
    Set Command=%Command% -model "model1" -process "%Process%" -execute -output "%LocalErrorFilePath%2"
    Set Command=%Command% -model "model2" -process "%Process%" -execute -output "%LocalErrorFilePath%3"
    Set Command=%Command% -model "model3" -process "%Process%" -execute -output "%LocalErrorFilePath%4"

    setlocal enableextensions enabledelayedexpansion || exit /b 1
    pushd %~dp0
    @echo %Command%
    cmd /c %Command%
    exit /b