cancel
Showing results for 
Search instead for 
Did you mean: 

Amount field condition in Aggregation selection mode of a DBlookup expression

Former Member
0 Kudos

Hi everyone,

I have a requirement to count the number of open invoices for an account. I am using the Aggregation selection mode of a DBlookup expression to count the unique number of values in a date field. The Select statements looks like:

Select Count of <date Field> from <Database>

With Condition:

Conditions

Into <Number>

The issue I am facing is that I am unable to include a condition for a Amount/Currency field. I want to select only debit items, and exclude credits. The fields of type 'currency' are not shown in the list of elements while adding an include condition.

Is this by design and why are we not able to use such field types in the conditions.?

Alternatively, I was thinking of using a temporary table to list the items and using a Table operation to remove the credit items and count the items, but unable to do a unique count.

Thanks ,

Nihit

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Shah,

in my blog I wrote about currency fields whose currency key is not defined within the same table. You want to exclude/include rows in your sum depending of the sign.

Fields of type currency are not selectable. I think this is due to the currency representation in BRFplus. It’s a structure whose number component is of type decfloat34 and the currency component is of type char(5). This makes the equation difficult.


With CDS you are able to build a view representing your table. In this view you can convert the currency fields to a number (you remove the currency information). Now these converted fields are selectable as a filter criteria.

Take a look at the follwing CDS conversion:

cast( TSLVT as abap.dec(23,2)) as TSLVTN

This should work (I tested it ).

Cheers,

Daniel

Former Member
0 Kudos

Thanks for the reply. I am not aware of CDS, and will need to check it out.

ttrapp
Active Contributor
Former Member
0 Kudos

Hi Tobias,

We do not have ABAP Development Tools for Eclipse (ADT) 2.19 and have not worked with ABAP in Eclipse.



christianlechne
Active Contributor
0 Kudos

Hi Nihit,

what does your system stack look like? To use CDS you need at least NW 7.40 with SP05.

If this is the case I would strongly reccommend to use the solution proposed by Tobias and Daniel, namely the CDS view.

The installation of ADT is usually not an issue: you just need to download eclipse (Kelper or Luna) and add the corresponding software site in eclipse. The one you need can be looked up on SAP Development Tools for Eclipse. You can find more information on that in ABAP in Eclipse space here in SCN ().

If however due to system requirements it is not possible to use CDS views a possible worksround might be to wrap the DB lookup (namely the SELECT statement itself) in an ABAP class i.e. in a static method of that class and call that method from BRF+ via a procedure call expression. A drawback of that workaround is that the selection itself is no longer available in BRF+.

BR

Christian

ttrapp
Active Contributor
0 Kudos

solved a similar problem and described his solution in his blog:

Best Regards,

Tobias