- SAP Community
- Groups
- Interest Groups
- Application Development
- Discussions
- Logic of Excel Shhet

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

Logic of Excel Shhet

Former Member

Options

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

12-20-2010 1:11 PM

135

Dear Gurus,

How to put Excel Logic in ABAP Code.

Ex : Excel Logic : (I3/(1-(0.09/4))^(MIN(20,ROUNDDOWN(($D$1-D3+1)/91,0))))-I3

Ex : ABAP Code :G_TAB-INTER = ( G_TAB-PVACQ / 1 - ( '0.09' / 4 ) ) ** ( MIN ( 20, FLOOR ( ( P_BUDAT - G_BSIK-BUDAT + 1 ) / 91,0 )) ) ) - G_TAB-PVACQ.

Correct me

- SAP Managed Tags:
- ABAP Development

1 ACCEPTED SOLUTION

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

12-20-2010 1:23 PM

57

what's your exact requirement??????

You are trying to replicate a formula in excel to your ABAP code or you are trying to display data into excel sheet and want to implement a formula in the excel sheet itself?????

If case 2 you can do it with BDS or OLE...........

- SAP Managed Tags:
- ABAP Development

4 REPLIES 4

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

12-20-2010 1:23 PM

58

what's your exact requirement??????

You are trying to replicate a formula in excel to your ABAP code or you are trying to display data into excel sheet and want to implement a formula in the excel sheet itself?????

If case 2 you can do it with BDS or OLE...........

- SAP Managed Tags:
- ABAP Development

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

12-20-2010 1:44 PM

57

yes i am trying to replicate a formula in excel to your ABAP code

- SAP Managed Tags:
- ABAP Development

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

12-20-2010 3:06 PM

57

Hi Sathvic,

the current ABAB is not just perfect regarding forumla evaluation. Some formulas can be created as functional methods, i.e. the MIN function (symbolic code)

```
method min
importing
op1 type any
op2 type any
returning
result type f.
if op1 < op2.
result = op1.
else.
result = op2.
endmethod.
```

But currently you can not pass arithmetic expressions to parameters, so you have to use local variable to store intermediate results of expressions like

`( P_BUDAT - G_BSIK-BUDAT + 1 ) / 91,0 )`

FLOOR may be translated into TRUNC using ABS value, I think.

Rule of thumb: To evaluate complex formulas as in excel, you will have to to some programming...

Regards,

Clemens

- SAP Managed Tags:
- ABAP Development

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

12-21-2010 7:10 AM

57

thank you very much for replying me.

very usefull code.

i have resolved my issue with different manner.

that is :

Interest calculation on precent value of Acquisition of asset.

VAR1 = ( 1 - ( '0.09' / 4 ) ).

VAR2 = FLOOR( ( P_BUDAT - G_BSIK-BUDAT + 1 ) / 91 ).

IF VAR2 < 20.

VAR3 = VAR1 ** VAR2 .

ELSE.

VAR3 = VAR1 ** 20.

ENDIF.

VAR3 = G_TAB-PVACQ / VAR3.

This logic is working fine

G_TAB-INTER = VAR3 - G_TAB-PVACQ.

- SAP Managed Tags:
- ABAP Development