Application Development and Automation 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: 
Read only

Problem with a Formula in ABAP

Former Member
0 Kudos
211

hello,

im new in ABAP.

I have to implement a formula.

((Variable ==0) OR (Variable ==1)) 100 + ((Variable >=2) AND (Variable <=4))95

This Formula is used normally in a query. but i need it in my StartRoutine as ABAP Code.

hope anyone can help

regards sunny

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
0 Kudos
182

>

> hello,

> im new in ABAP.

>

> I have to implement a formula.

>

> ((Variable ==0) OR (Variable ==1)) 100 + ((Variable >=2) AND (Variable <=4))95

>

> This Formula is used normally in a query. but i need it in my StartRoutine as ABAP Code.

>

> hope anyone can help

>

> regards sunny

Possibly...

IF variable EQ 0 OR variable EQ 1
  variable = 100.
ENDIF.

IF variable GE 2 AND variable LE 4.
  variable = variable + 95.
ENDIF. 

Where does this formula come from? Without knowing it's difficult to answer you directly.

6 REPLIES 6
Read only

matt
Active Contributor
0 Kudos
183

>

> hello,

> im new in ABAP.

>

> I have to implement a formula.

>

> ((Variable ==0) OR (Variable ==1)) 100 + ((Variable >=2) AND (Variable <=4))95

>

> This Formula is used normally in a query. but i need it in my StartRoutine as ABAP Code.

>

> hope anyone can help

>

> regards sunny

Possibly...

IF variable EQ 0 OR variable EQ 1
  variable = 100.
ENDIF.

IF variable GE 2 AND variable LE 4.
  variable = variable + 95.
ENDIF. 

Where does this formula come from? Without knowing it's difficult to answer you directly.

Read only

Former Member
0 Kudos
182

hello,

you are right, more information will be helpful.

It's a formula to grade the delivery dependability in SD.

0-1 days delay in delivery => grade 100

2-4 days delay in delivery => grade 95

more than 10 days delay in delivery = grade 25.

.

.

.

I hope it's clear...

Read only

Former Member
0 Kudos
182

Hi,

This may be helpful.

IF variable EQ 0 OR variable EQ 1.

grade = 100.

ENDIF.

IF variable GE 2 AND variable LE 4.

grade = 95.

endif.

if variable ge 4 and variable le 10.

grade = 25.

endif.

Read only

Former Member
0 Kudos
182

hello,

thanx a lot to all ...

i do it like this.

>

> Hi,

>

> This may be helpful.

>

> IF variable EQ 0 OR variable EQ 1.

> grade = 100.

> ENDIF.

>

> IF variable GE 2 AND variable LE 4.

> grade = 95.

> endif.

>

> if variable ge 4 and variable le 10.

> grade = 25.

> endif.

i have more conditions, and it will raise , but it works.

regards

sunny

Read only

matt
Active Contributor
0 Kudos
182

As a friendly suggestion - go on an ABAP course, or at least get an ABAP book. Non-programmers doing ABAP can really muck systems up, and certainly pave the way for expensive maintenance in the future.

matt

Read only

former_member194797
Active Contributor
0 Kudos
182

Next lesson: ELSEIF.