Trying to Make Hard coded custom function as geenric

Hi All,

We have a requirement to make a custom function generic which was filled with hard coded values as of now,
Here it looks like this


IF($LV_VAR1 LIKE 'A%' AND $LV_VAR2 >.002 AND $LV_VAR3 IN ('AA','BB','CC','DD','EE') AND 
($LV_VAR4 != '006219' AND $LV_VAR4 != '006404' AND $LV_VAR4 != '006198' AND $LV_VAR4 != '300629' AND $LV_VAR4 != '008019' AND $LV_VAR4 != '007371') AND
($LV_VAR5 != '006211' AND $LV_VAR5 != '312345' AND $LV_VAR5 != '876344' AND $LV_VAR5 = '246853' AND $LV_VAR5 != '006783' AND $LV_VAR5 != '947321' ) )
	BEGIN
		$LV_VAR6 = 'XYZ';
	end 

ELSE IF ($LV_VAR1 IN ('520','625') AND $LV_VAR2 >.002 AND $LV_VAR3 IN ('AA','BB','CC','DD','EE') AND 
($LV_VAR4 != '006219' AND $LV_VAR4 != '006404' AND $LV_VAR4 != '006198' AND $LV_VAR4 != '300629' AND $LV_VAR4 != '008019' AND $LV_VAR4 != '007371') AND
($LV_VAR5 != '006211' AND $LV_VAR5 != '312345' AND $LV_VAR5 != '876344' AND $LV_VAR5 = '246853' AND $LV_VAR5 != '006783' AND $LV_VAR5 != '947321' ) )
	BEGIN
		$LV_VAR6 = 'ABC';
	end 

ELSE IF ($LV_VAR1 IN ('300','510','725') AND ($LV_VAR7 != 'EE' AND $LV_VAR1 != 'XX') AND $LV_VAR2 >.002 AND $LV_VAR3 IN ('AA','BB','CC','DD','EE') AND 
($LV_VAR4 != '006219' AND $LV_VAR4 != '006404' AND $LV_VAR4 != '006198' AND $LV_VAR4 != '300629' AND $LV_VAR4 != '008019' AND $LV_VAR4 != '007371') AND
($LV_VAR5 != '006211' AND $LV_VAR5 != '312345' AND $LV_VAR5 != '876344' AND $LV_VAR5 = '246853' AND $LV_VAR5 != '006783' AND $LV_VAR5 != '947321' ) )
	BEGIN
		$LV_VAR6 = 'DEF';
	end 

ELSE IF ($LV_VAR1 LIKE 'B%' AND $LV_VAR2 >.002 AND $LV_VAR3 IN ('AA','BB','CC','DD','EE'))
	BEGIN
		$LV_VAR6 = 'ABC';
	END

ELSE IF ($LV_VAR1 IN ('300','510','725') AND $LV_VAR7 != 'EE' AND $LV_VAR2 >.002 AND $LV_VAR3 IN ('AA','BB','CC','DD','EE'))
	BEGIN
		$LV_VAR6 = 'XYZ';
	END


ELSE IF ($LV_VAR1 IN ('300','510','725') AND $LV_VAR7 != 'XX' AND $LV_VAR2 >.002 AND $LV_VAR3 IN ('AA','BB','CC','DD','EE'))
	BEGIN
		$LV_VAR6 = 'ABC';
	END
ELSE 
	BEGIN
		$LV_VAR6 ='NULL';
	END


Return $LV_VAR6;

I tried entering all the variable values into one staging table and flattened that table with reverse pivot transform and used the SQL function to make it generic by pulling all the values from that staging table,

it works fine for me but it is hitting the performance, there are 12m rows in the source table.

Can i get some clues, how to make it generic , is there any simple way to do this…

Thanks,
Sushma


sushma.bommidala (BOB member since 2008-05-02)

https://wiki.sdn.sap.com/wiki/display/BOBJ/Complex+transformation+rules


Werner Daehn :de: (BOB member since 2004-12-17)

Thanks for the quick reply Warner,
My business users wants to make it dynamic, suppose if they want to Add/Delete one more value to the variable $LV_VAR4, they don’t want me to do no more changes from function side…, i think the whole logic what ever you send me that will be working in DS 12.0 i think so, here i n my case my DI version is DI 11.7.3.5
Could you please help me Warner…?

Thanks,
Sushma.


sushma.bommidala (BOB member since 2008-05-02)

Hi All,

Can any one give me some idea how to approach for this custom function make it generic.

All suggestions are greatly appreciated.

Thanks,
Sushma.


sushma.bommidala (BOB member since 2008-05-02)

Hi All,

Update for the Function to make it as generic,
I tried entering all the hard coded values for each variable into one table and flattened that table using reverse pivot and made that custom function generic by pulling values from the data base.
Its working fine for me, but the thing is that it is hitting the performance.
In my source table there are 12M rows are there, for this the job was running so long time…
Any suggestions on this one…

Thanks,
Sushma.


sushma.bommidala (BOB member since 2008-05-02)