Skip to Content
avatar image
Former Member

Question on ALV IDA

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jul 24, 2017 at 07:02 PM

    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.

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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.