cancel
Showing results for 
Search instead for 
Did you mean: 

Macro design

Former Member
0 Kudos

Hi Experts,

How to Obtain below requirement using Macros.

We have KF1, KF2, KF3 and KF4.

KF2, KF3 and KF4 is the Manual Input from the users.

KF2KF3KF4 = KF1, But KF1 Should not exceed 100.We have to fix highest limit of kf4 as 100.

1)

>>> JAN FEB MAR

KF1 80 100 100

KF2 30 50 70

KF3 30 0 10

KF4 20 50 20

In the above condition if user input KF2, KF3 AND KF4, KF1 should update with the sum of KF2,KF3 AND KF4 BUT SUM of the KF2,KF3 AND KF4 Should not exceed 100.If user tries to put bigger number then system should not allow him to put if KF4 is already 100.

>>>JAN FEB MAR

KF1 100 100 100

KF2 0 50 70

KF3 100 0 10

KF4 0 50 20

In the above example, if User tries to put SOME VALUE IN KF4 AND KF2 , SYSTEM SHOULD NOT ALLOW THE USER TO INPUT BECAUSE ALREADY KF4 HAS 100.

regards

Vicky

Edited by: vicky999 on Jul 18, 2011 5:18 PM

Edited by: vicky999 on Jul 18, 2011 5:20 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Vicky

Create a default macro :

IF

KF2 + KF3 + KF4 > 100,

Popup Message ("Sum Of Keyfigures cannot exceed 100)

ENDIF

ELSE

KF1 = KF2 + KF3 + KF4

You dont need to seperately check if KF4 exceeds 100 because the above logic makes it redundant.

Rishi Menon

Former Member
0 Kudos

Dear Rishi

Thanks for your quick reply.

I tried to create the macro :

KF1

New step : ( 9 Iterations : P 16.2011; P 24.2011 )

IF

New condition

(

Row: KF2( Frm P 16.2011 )

+

Row: KF3 ( Frm P 16.2011 )

+

Row: KF4 ( Frm P 16.2011 )

)

> 100

Error [ Sum of KF1 cannot Exceed 1 ]

ELSE

Row:KF1( Frm P 16.2011 ) =

Row: KF2 ( Frm P 16.2011 )

+

Row: KF3 ( Frm P 16.2011 )

+

Row: KF4 ( Frm P 16.2011 )

ENDIF

I am getting following error while activating the macro. "Relational operator "+" is not supported"

Please kindly help.

Regards

Vicky

Former Member
0 Kudos

Vicky

Im guessing that you did not put a space after or before the + sign. Try to deactivate sections of the macro and see if it activates in order to identify the exact point where the syntax error occurs.

Beyond that, my only suggestion would be to refer to SAP sample macros for exact syntax.

RIshi Menon

Former Member
0 Kudos

Dear Rishi

I double checked the macro. still same error.

Does IF condition allow this condition KF2KF3KF4>100 ?

Still same error.

Regards

Vasu

Former Member
0 Kudos

Vicky

If condition does allow sum of Key figures. Its difficult to suggest whats wrong on a forum like this without looking at the system. This should be an easy macro, even if the macro syntax makes it more difficult than it should be.

RIshi Menon

Former Member
0 Kudos

Hi Vicky,

Use SUM instead of + in the IF condition. this way the statement will be:

IF

New condition

SUM (

Row: KF2( Frm P 16.2011 )

;

Row: KF3 ( Frm P 16.2011 )

;

Row: KF4 ( Frm P 16.2011 )

)

> 100

....

Hope this helps!!

Regards,

Jatin

Former Member
0 Kudos

Dear Rishi

Thanks a lot for your reply and time.

Jattin >>thanks for your alternate suggestion.

After implementing sap note it started working.

But Output is not as expected because as per my requirement we have to enforce the sum of kf2kf3kf4 not more than 100.

Say example: If KF2=20; KF3=60; and User Updated KF4= 40 , system should allow only 20 for KF4.But as per the current macro logic system is allowing KF4 as 40 and no changes to the sum KF1 (Sum is still 80).

Our requirement is if KF2=20, KF3=60 then KF4 should not exceed 20.We have to enforce that total is not more than 100.

Sum of KF1

New step : ( 9 Iterations : P 16.2011; P 24.2011 )

IF

New condition

(

Row: KF2( Frm P 16.2011 )

+

Row: KF3 ( Frm P 16.2011 )

+

Row: KF4 ( Frm P 16.2011 )

)

> 100

Error Sum of KF1 cannot Exceed 1

ELSE

Row:KF1( Frm P 16.2011 ) =

Row: KF2 ( Frm P 16.2011 )

+

Row: KF3 ( Frm P 16.2011 )

+

Row: KF4 ( Frm P 16.2011 )

ENDIF

regards

vicky

Answers (0)