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: 

condition in ABAP Query

Former Member
0 Kudos
339

Hi gurus...

How to give condition in ABAP query report....

We have ABAP query report for Exise and in that all credit amounts('H'),i want to add the symbol as '-ve' sign...means the amount has to be deducted with the debit amounts and give a consolidated figure.....

Pls advise, how to add or give conditions in ABAP query report.

thanks & regards

sankar.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
287

Hi,

I am assuming, as you have given, if the amount type is H then its credit.

types: begin of tp_internal_table,

amount type table-amount,

end of tp_internal_table.

data: internal_table type standard table of tp_internal_table.

data: wa_internal_table type tp_internal_table.

Select amount

from table

into internal_table

where type = 'H'.

Loop at internal_table into wa_internal_table.

concatenate '-' wa_internal_table-amount to wa_internal_table-amount.

append wa_internal_table to internal_table.

endloop.

Now the internal_table will have the credit values with the -ve sign.

Reward if helpful.

Regards.

9 REPLIES 9

dhruv_shah3
Active Contributor
0 Kudos
287

Hi,

You can use the Concatenate Statement for displaying the signs you want to display.

HTH

Regards,

Dhruv Shah

0 Kudos
287

hi Dhruv,

thanks, but i want how to create a condition in the ABAP query for particular field and not the coding stmt help, i need.

Pls advise.

regards

sankar.

0 Kudos
287

In The Infoset(SQ02)

Extras-->Code, Here you have provision to write the ABAP code.

Declare a constants '-' in Data declaration tab and concatenate it to the O/P field.

Hope this helps.

Regards

Vinayak

0 Kudos
287

Hi Vinayak,

I've tried it in all code section with my coding...but its not working when im calling thru Query....

How to assign it....

I just want to assign -ve sign to the BSAD-WRBTR if BSAD-SHKZG eq 'H'.

Pls advise.

thanks & regards

sankar

0 Kudos
287

Hi Sankar,

Put a Explicit break point in the Free coding section.

BREAK-POINT.

Don't forget to save and generate the Infoset.

Go to the Query and run it, the ctrl will stop at the Break-point.

Check the run-time parameters, try to populate Dynamic values.

Hope this helps.

Regards

Vinayak

0 Kudos
287

Hi

In the "Record Processing" Code Section, add the following piece of code for the Node BSID as i have used BSID to get FI data.


if bsid-shkzg = 'H'.
  bsid-dmbtr = bsid-dmbtr * -1.
endif.

I tried this and it worked for me.

Hope it helps for your too.

Thanks,

Balaji

Former Member
0 Kudos
287

Hi,

There are certain exit points available in the query, these can be accessed in SQ02 - Infoset editor. Click 'Extras', then the 'Coding' tab. There is a drop down to access different coding sections, e.g. DATA, GET, etc.

Hope this helps.

Thanks,

Balaji

Former Member
0 Kudos
288

Hi,

I am assuming, as you have given, if the amount type is H then its credit.

types: begin of tp_internal_table,

amount type table-amount,

end of tp_internal_table.

data: internal_table type standard table of tp_internal_table.

data: wa_internal_table type tp_internal_table.

Select amount

from table

into internal_table

where type = 'H'.

Loop at internal_table into wa_internal_table.

concatenate '-' wa_internal_table-amount to wa_internal_table-amount.

append wa_internal_table to internal_table.

endloop.

Now the internal_table will have the credit values with the -ve sign.

Reward if helpful.

Regards.

Former Member
0 Kudos
287

thanks a lot.

I've made a normal Zreport instead of Query for this post.(issue)

Anyway, I've worked the above helps and its working fine,thanks to all.

regards

sankar.