Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
sateesh_kumar1
Active Contributor

Hi Team,


It's a basic requirement but most common .So I wanted to share it for beginners.


Purpose : Job should execute for a selected country .If there are no records for the selected country then job should terminate .

Create 2 global variables to at Job level

$CNTR : Country to select when job execution

$RC : count records for selected country.

1.Scr_Records : to count the records for a selected country.

$RC = sql('SRT','SELECT Count(*) FROM Stadium_Info where COUNTRY={$CNTR}');

Print('Rows'||$RC);

2.Add try and Catch to display the error message in Trace log


3.Add Conditional (If) transformation .


        In Condition part , write $RC >0

        * Then part : Create your dataflow when condition met .Put Stadium_Info.COUNTRY =$CNTR in transformation WHERE clause to restrict rows for selected country.

        *Else part  : Create a script to generate error

         Scr_Raise_Exception :  raise_exception( 'Table is Empty');

4. In Catch block :

Add a script  to Print your error message in Error log

raise_exception( 'There arer no records to fetch for '||$CNTR);


5.Execute the job and enter value for Country variable $CNTR ='IN' ( in database there are no records for IN)

observe Trace and Error logs.

Hope it helps somebody need.

5 Comments
Labels in this area