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: 

To make changes in SAP query

akashsuraj96
Discoverer
0 Kudos

Hi

I have custom report which is generated using SAP query which display an ALV in the output.Now my requirement is to show only those rows in ALV output whose three fields(lets say A,B,C are not equal to zero).IF A , B, C are equal to Zero that particular row in ALV should not be shown in ALV.

IF any one of the field is not equal to zero,that particular row should be shown in ALV output.In short we need to perform "AND" operation.

I dont see any code in INFOSET.

Thanks

5 REPLIES 5

TammyPowlas
Active Contributor
0 Kudos

Hi - you can generate an ABAP program and then copy, edit and make the resulting changes in that program

See screen shot below to generate the ABAP program:

To copy and adapt it, you mean?

Hi Sandra - correct, yes, thank you- let me update my comment.

michael_piesche
Active Contributor
0 Kudos

Your first statement is contradicting the other two:

  • [] show only those rows in ALV output whose three fields [] are not equal to zero
    => A <> 0 AND B <> 0 AND C <> 0
  • IF A, B, C are equal to Zero that particular row in ALV should not be shown in ALV
    => A = 0 AND B = 0 AND C = 0
  • IF any one of the field is not equal to zero,that particular row should be shown in ALV output.
    => A <> 0 OR B <> 0 OR C <> 0

I assume you want to get rid of those rows, where A, B and C are all 0?

VeselinaPeykova
Active Contributor

I would not try adapting the code from a generated program. Even if it might be done, I imagine that it will soon become very difficult to maintain and support. It might be even more efficient to rewrite it from scratch compared to reusing this generated code.

While it is possible to add free coding in the infoset, I would prefer to avoid it if possible for the same reason - troubleshooting queries with complex logic is challenging for the support team.

Instead, I would just create a local field (Z) with very simple logic to check the values of A, B and C and set a specific value to Z. AND, OR statements are supported for local fields.

And then I would create a filter in the ALV output based on Z.

Of course, this makes sense only if you do not need to work with lots of data, otherwise it is probably better to remove the entries with free coding in the infoset.

Just my 2 cents, I am not a developer.