If statement examples in SAP BODS

Requirement:
If (loopcount =1)
Variable1=value1;
Variable2=value1;

else if(loopcount =2)

Variable1=value2;
Variable2=value2;

else if loopcount =3
Variable1=value3;
Variable2=value3;
Example 1:
If (loopcount = 1)
begin
$Variable1=value1;
$Variable2=value1;
end;
else if (loopcount = 2)
begin
$Variable1=value2;
$Variable2=value2;
end;
else if (loopcount = 3)
begin
$Variable1=value3;
$Variable2=value3;
end;

Another Example:
IF ($InputCharacter = NULL)
BEGIN
$Partial = NULL;
RETURN NULL;
END
IF ($RepeatNumber = NULL)
RETURN NULL;
IF ($RepeatNumber > 255)
$RepeatNumber = 255;
IF ($RepeatNumber < 0)
$RepeatNumber = 0;
BEGIN
WHILE ($RepeatNumber != 0)
BEGIN
$Partial = ($Partial || $InputCharacter);
$RepeatNumber = ($RepeatNumber – 1);
END
RETURN $Partial;
END

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: