This website is not affiliated with, sponsored by, or approved by SAP AG.

Null Value in Dependency Calculation

Logistics : PP

Moderators: Snowy, thx4allthefish, Ha Tran

Null Value in Dependency Calculation

Postby becca656 » Thu Dec 13, 2012 9:27 am

We have a business scenario which requires us to include the variable of null (not zero, but blank) as a dependency in our classification characteristic dependency.

That is, we have the following:

$SELF.variable A= 330
if variable B= '10'
AND (variable C = ????)
AND ((variable D LT 50 AND
Variable E LT 6) OR
Variable E LT 160)

Variable C needs to be a null value for the dependency. We have tried two single quotes to represent blank and two double quotes to represent blank (e.g., ""), but we are getting syntax errors (E28024) with this entry.

Any ideas how to manage this scenario?
Last edited by becca656 on Wed Dec 19, 2012 2:34 pm, edited 2 times in total.
becca656
 
Posts: 978
Joined: Tue Nov 25, 2003 8:41 am
Location: Connecticut, US

Re: Null Value in Dependency Calculation

Postby Sharpshooter » Sun Dec 16, 2012 8:19 pm

Use:
Code: Select all
and ( not variablec specified )
Good luck!
Sharpshooter
 
Posts: 1171
Joined: Wed Mar 17, 2010 12:01 pm
Location: In the dark

Re: Null Value in Dependency Calculation

Postby becca656 » Mon Dec 17, 2012 9:22 am

Thanks, Sharp.

One more question, though. This dependency is currently defined as an ACTION dependency......and I think we made it this way because it is dependent on so many other characteristics and some of these are driven by dependencies themselves. I was under the impression that ACTION dependencies trigger more predictably when they are supposed to. When I make this a PROCEDURE dependency, it does compile. I would like to keep it an ACTION dependency, do you have any other syntax to try?

Or do we need to move this to a procedure dependency? Please advise.....
becca656
 
Posts: 978
Joined: Tue Nov 25, 2003 8:41 am
Location: Connecticut, US

Re: Null Value in Dependency Calculation

Postby Sharpshooter » Mon Dec 17, 2012 12:04 pm

Technically, actions should no longer be used. SAP keeps them around for backward compatibility reasons. Use a procedure, it will function fine. I assume, this procedure is allocated to your config profile?
Good luck!
Sharpshooter
 
Posts: 1171
Joined: Wed Mar 17, 2010 12:01 pm
Location: In the dark

Re: Null Value in Dependency Calculation

Postby becca656 » Mon Dec 17, 2012 12:32 pm

Thanks so much.
becca656
 
Posts: 978
Joined: Tue Nov 25, 2003 8:41 am
Location: Connecticut, US

Re: Null Value in Dependency Calculation

Postby becca656 » Wed Dec 19, 2012 2:49 pm

With implementing this change in the format of the characteristic dependency ("AND (not Variable C specified)") and changing the dependency type from Action to Procedure, we are now finding an additional problem.

Our dependency code requires nested dependencies, such that the value from Variable B is drawn from criteria based on the value from variable A. What is happening now is the dependency is not triggering with the new format of "AND (not Variable C specified)".

Our problem seems to be that the dependency code gets itself into an endless loop. Is there such logic that we could put in place like an "else if" or "exit" so that not all conditions were evaluated and therefore we would not have it where multiple conditions were being met? That is, once the appropriate dependency value is selected, the process should move on and not get caught up in the loop.

Code is as follows:

if variable A = 'n'
AND (not Variable C specified)
AND ((Variable B LT n AND
Variable B LT n) OR
Variable B LT n),
$Variable D = n

We are using this logic to determine the static value, based on the dependencies, for Variable D, but variables A, B, and C may be different, so we have this logic repeated numerous times, to determine D, based on these other criteria.

The end goal is to be able to say, once Variable D is correctly determined, that the process is ended and the dependency processing is complete.
becca656
 
Posts: 978
Joined: Tue Nov 25, 2003 8:41 am
Location: Connecticut, US

Re: Null Value in Dependency Calculation

Postby Sharpshooter » Wed Dec 19, 2012 10:46 pm

Not sure I follow exactly, but let me try to rewrite your code with proper syntax (and omitting the word "variable" for simplicity):
Code: Select all
$self.D = n0 if
         A = n1
        and  not C specified
        and (( B lt n2 and
                B lt n3 ) or
                B lt n4 )


First, let me say that the logic does not make sense to me, comparing 'B' to 3 different values (if that's really your code).
If you wish to stop processing once 'D' has a value, add and not $self.d specified to the condition. When you use procedures, the sequence of execution is important - you can specify the order of execution where you allocate them to the profile. If 'A' is valuated by a procedure, that procedure must run first.

What do you mean by "not triggering"? What does a trace show? A termination?

You would probably be better off implementing this type of complex logic using a constraint instead of procedures. Constraints are resolved until everything is stable - there is no sequence to the processing.
Good luck!
Sharpshooter
 
Posts: 1171
Joined: Wed Mar 17, 2010 12:01 pm
Location: In the dark


Return to Logistics PP

Who is online

Users browsing this forum: No registered users and 5 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.