cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a validation rule in SAP BODS Job

Former Member
0 Kudos

Hi Experts

I have created a BODS Job and in that job i have to create a validation rule as if the cust_id is null the loading must stop.

I dont have idea where i have to define this validation rule in the Job and how to stop the load job if the validation rule file.

My Job was defined like below image

Please guide me where i have to define the validation rule and how to stop the load job.

Thanks in advance

PrasannaKumar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Prasanna,

In validation transform based on the condition we gonna collect records in two tables.

But here you mentioned to stop the job.In that case you have to keep a script at data flow level.

In the script you have to mention the condition as if the source table cust_id column is not null then execute the job.

I understood your requirement in this way, If I am wrong kindly correct me.

Let me know for further clarification.

Regards,

Samatha B.

Former Member
0 Kudos

Hi samatha b

Thanks for your response. I have done as you said and now i can rise the exception.

I have another requirement as per the validation transformation the data will load into Pass table and Fail table after job execution. If any data entered into fail table i have delete the data loaded into Pass table.

Here i am facing problem as my target tables are MySQL tables and when i am writing scripts i wrote the script as

sql('database','delete from <tablename>');

but as it is an SQL Query execution it is rising exception for the query.

How can i delete the data loaded into MySQL Target table using scripts.

Please guide me for this error also

Thanks in Advance

PrasannaKumar

Former Member
0 Kudos

Hello Prasanna,

Just create a data store on my SQL database as per  screenshot,

Go ahead  with the script which u posted in earlier with my SQL syntax inside "sql" function.

Regards,

Samatha B

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Prasanna,

I think you can stop job when cust is null

step 1. in Validation transformation and select validation function

step 2. select validation function ( before that create validation function)

step 3. in validation function

         create condition with below

         

if ($cust_id is null)

begin

  raise_exception('loading stop due to cust id is null ');

end

Job will stop when condition is meet.

FYI.. I have tested in my system it's working fine

Regards,

Manoj.

Former Member
0 Kudos

Prasanna, Refer this doc.. May it helps you.