- SAP Community
- Groups
- Interest Groups
- Application Development
- Discussions
- Report Writer - Using Formula in a set

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.

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Report Writer - Using Formula in a set

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

10-26-2009 3:45 PM

Hi I am trying to learn Report Writer (GR31) and one of the things I want to do is put a formula in a set, but I am having hard time getting it to work.

I want to put a formula like this...

if account is 5000000 then put do one thing else put 1

IF '&ZACCT1' = 500000 THEN '001' * 'A' ELSE 1

but I am not getting any value back.

Anyone have any idea what I am doing wrong.

Thanks in advance for any help/suggestions.

John

- SAP Managed Tags:
- ABAP Development

1 ACCEPTED SOLUTION

Former Member

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

10-27-2009 7:17 AM

Hi John Lee,

The logic that you would want , can be implemented through a column set. That is, as per your logic written in the set, your column values differ.

First in your set, keep your account number in the first set line. ie. 5000000.

Then you enter the following formula in the second line of a set defined for a report column:

IF u2018001u2019 > 5000000 THEN u2018001u2019 ELSE 0

If the value in the first column (set line 001) is greater than 5000000, then this value displays in the second column; if the value in the first column is less than 1000, the value 0 displays in the second column.

Revert if you need any additional help.

Regards,

**Subin John**

- SAP Managed Tags:
- ABAP Development

8 REPLIES 8

Former Member

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

10-27-2009 7:17 AM

Hi John Lee,

The logic that you would want , can be implemented through a column set. That is, as per your logic written in the set, your column values differ.

First in your set, keep your account number in the first set line. ie. 5000000.

Then you enter the following formula in the second line of a set defined for a report column:

IF u2018001u2019 > 5000000 THEN u2018001u2019 ELSE 0

If the value in the first column (set line 001) is greater than 5000000, then this value displays in the second column; if the value in the first column is less than 1000, the value 0 displays in the second column.

Revert if you need any additional help.

Regards,

**Subin John**

- SAP Managed Tags:
- ABAP Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

10-27-2009 8:22 AM

Hi,

Please refer the links below.

It might be helpful.

[Link1|http://help.sap.com/saphelp_40b/helpdata/fr/5b/d22c6243c611d182b30000e829fbfe/content.htm]

[Link2|http://help.sap.com/saphelp_47x200/HELPDATA/EN/5b/d22db643c611d182b30000e829fbfe/frameset.htm]

Thanks,

Harini

- SAP Managed Tags:
- ABAP Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

10-27-2009 11:22 AM

Thanks for suggestion.

Your suggestion isn't really what I was think, but I do have a question for you.

How would you populate account no in key figure field of set?

What value/variable do you use in the formula to populate account no?

Thanks again.

John

- SAP Managed Tags:
- ABAP Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

10-28-2009 10:41 AM

Hi John Lee,

I did not get exactly what you require.

Following may help you or otherwise please explain to me exactly what do you require. I will try to help you.

1. There are 4 ways by which you can create sets.

a) Basic b) Single c) Multi d) Key figure set.

I am assuming that you are using a Key figure set. Because, in all other sets , you cannot enter a Key figure.

2. Key figure sets are created for columns in Report Writer reports.

Hence in your report writer report , first create a row set which will bring your account numbers. (Either basic, single or Multi)

Then create a Key figure set in which you put a variable which will have your logic using IF else as I had explained earliar.

Regards,

**Subin John**

- SAP Managed Tags:
- ABAP Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

10-29-2009 12:58 PM

Thanks.

I did all you mentioned, but what I want to know is how to set formula in Key Figure Set column.

Let say, I want to create formula in column 2 where if account no is 500000 then column 1 * 10

if account no is 60000 then column 1 * 20

else column1.

How would you set the formula?

I can do 'THEN' statement, but I cannot make IF statement working 'IF ... = 500000

Have you done this?

John

- SAP Managed Tags:
- ABAP Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

11-13-2009 2:06 PM

Hey Subin John,

Do you have suggestion to my question above?

How do I create If statement to say If account number = 5000 then do calc #1 else if account no = 60000 do calc #2 Else do calc #3 in formula.

thanks.

John

Edited by: John Lee on Nov 13, 2009 3:06 PM

- SAP Managed Tags:
- ABAP Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

11-26-2009 4:04 AM

Hi John,

Try creating a "Formula Variable" (T Code GS11) and use a user defined exits (''#U001') (you must create one) in the formula area.

Regards,

**Subin John**

- SAP Managed Tags:
- ABAP Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

11-30-2009 3:03 PM

Thanks for your answer... but I am not sure how I need to do this...

If you have time, can you explain little more detail as to how I need to accomplish this.

thanks again.

john

- SAP Managed Tags:
- ABAP Development