directorysap-data-services

Conditional directory name in SAP BODS


I'm trying to create a function that return path of directory with condition.

My function code is like below :

$Local_Folder = DECODE(($Global_Class = 'XYZ', '\\\CLASS-DEV\ETL\RESULT1', ($Global_Class = 'JKL', '\\\CLASS-DEV\ETL\RESULT2', ($Global_Class = 'ABC'), '\\\CLASS-DEV\ETL\RESULT3', 'Please provide your Class Code');

RETURN $Local_Folder;

Then, I call my function with Global Variable like:

$Global_Result = FUNC_GetClass();

Btw, the $Global_Class value I need to key in first, before I run the job.

And error occurred like this below:

The variable $Global_Result of the file reader is empty. Please initialize the variable to a valid value.

Could you please help to give suggestion? Appreciate if you guys could leave answer and give me a light. Thanks! :)


Solution

  • I found the answer. I only need to define the logic inside my script which contains all of variables that I use for my batch job. No need to create function for this.

    $Local_Folder = DECODE($Global_Class = 'XYZ', '\\\CLASS-DEV\ETL\RESULT1', $Global_Class = 'JKL', '\\\CLASS-DEV\ETL\RESULT2', $Global_Class = 'ABC', '\\\CLASS-DEV\ETL\RESULT3', 'Please provide your Class Code');