Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Question on ALV IDA

Former Member
0 Kudos

While formulating a condition for ALV IDA, I see the below example.

* Add the required condition

data(lo_condition) = lo_alv_cond_fac->between( name = 'POSNR' low = '000010' high = '000030')->AND( lo_alv_cond_fac->equals( name = 'VBELN' value = '0000000010' ) ).

I need some help in understanding the usage of "->AND".

why does this usage not return any syntax error?

3 REPLIES 3

fabianlupa
Contributor
0 Kudos

Not sure which class "lo_alv_cond_fac" is but this factory seems to make use of the builder pattern (more so than of the factory pattern) which means that each instance method returns a reference to the instance itself (as a returning parameter) to allow method chaining.

https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/abenmethod_chaining_abexa.htm

Though I have to admit your example condition factory builder thingy seems to also allow for nesting to define the interpretation order / priority which makes it a bit more difficult to read.

0 Kudos

Method chaining is one thing but how does SAP allow the use of the keyword ->AND or ->OR to join conditions.

0 Kudos

Well a quick look at the signatures reveals that CONDITION_FACTORY( ) returns a reference to IF_SALV_IDA_CONDITION_FACTORY, which includes the EQUALS, NOT_EQUALS, ... methods. Each of them returns a reference to IF_SALV_IDA_CONDITION, which, again looking at the signatures, has the condition concatenation methods OR and AND which take another condition (-> IF_SALV_IDA_CONDITION) as the argument and also return the condition again.

So basically the factory returns conditions and each condition can be connected to another one using the methods OR / AND.

These interfaces do have long text documentation you might want to look into for more details.