DP macros and percentage calculation

Hi Experts,
I need some help to resolve an issue I'm having with macro execution at the aggregated level (product / location) and disaggregated level (product / location / sales group).
We have fixed aggregation for POS at product / location / sales group.
This is a very simple example but should show the problem.
Using 3 KF's
KF1 - SAP Stat FC - Calculation type S
KF2 - percentage change - Calculation type A
KF3 - consensus FC - type S
Macro will add a percentage to KF 1 and produce a total in KF3. macro executes as default. This work fines if used at agg level.
But if we add a percentage to a FC at SG level then when aggregated the total is incorrect and not what we want to transfer to R/3.
Example. Total FC of 30 shown below.
SG 1 forecast = 20
SG 2 FC = 10
Update FC at SG
30% is added to SG 1 FC so this is now = 26
SG 2 FC = 10
New total should be = 36
When viewed at agg level, % is now 15 (understand as this is because of 2 SG's) and the total is 35. This become more complex as the number of SG increases.
I've tried using drill down in BG job to correct the answer but it doesn't update the livecache or transfer the correct result.
Hopefully someone knows of a way to work around this.
Thanks in advance.
Paul

Hi,
Since the macro is default at both aggregated and disaggregate level, we cant control this. To avoid this, you must make the macro executable at the disaggregate level only. But the constrain is you can not have the calculation done at aggregated level.
In your macro, include a IF function to check the detailed level as the Sales group and allow the system to calculate the % increase.
IF
Condition: Check Aggregate level
DET_LEVEL( 'SALES_GRP' ) = 1
KF3 = KF1 + (KF1*KF2/100)
ENDIF
Another option is to run the macro only at the background but not at the interactive planning book. While running the macro job, set the aggregation level as product / location / sales group.
Hope this will help to solve your issue.
Regards,
Manimaran M.

Similar Messages

  • Help! Invoice Date and Percentage calculations

    i'm new to numbers so apologies if this is really basic – i have scoured the numbers help doc.
    i very basically need to work out an invoice date from a date in a table, this would usually be 30 days or occassionally 14 day from the input date, would be great if there was some kind of flag/alarm when the date has past the current date i don't know if that's possible!
    secondly (and simply) i need to work out + 17.5% of a cell number eg. £100 + 17.5% with the resulting figure in a seperate cell.
    any help much appreciated
    thanks

    Part 1) Do a search on the forums here and you will find a plethora of posts about data calculations, they basically do work like other math types, with some tweaks you might have to perform but +30 should do something close to what your looking for. Then you could use conditional formatting to color the cell Red if it gets overdue or yellow if its within 5 days, etc...
    part 2) If the original value is in cell A1 then in B1 you could type =A1*1.175
    Hope this helps,
    Jason

  • Percentage Calculation using RKF and CKF

    Hi,
    I am unable to create a CKF which calculates % of a key figure (Net PO value). The % has to be calculated on the overall total of the column.
    My scenario does not allow me to use formulas to do so. So I had to create a RKF which uses my key figure and I restricted it with Vendor (Constant Selection) which was in my rows. Then I created a CKF which calculates the percentage using this restricted key figure. But when I go into my query analyser and open this query and try to restrict the vendors to only a few, the percentage is still calculated to the entire vendors for that particular company code.
    Is there another way to solve this problem where I could get the percentage values according to as many vendors I filter the report on?
    Many thanks
    IA
    Edited by: I A on Jan 13, 2010 1:39 PM

    Hello I A,
    Go to Query Designer, select you key figure and in "calculations tab" select: Calculate individual values as--> Normalize after overall result (8th option).
    I hope this helps! (in that case rewrd pts please )
    Regards,
    Jordi

  • Percentage Calculation in 11g Upgrade

    upgradin to 11g issue in % cal
    The issue is as follows
    In 11g I'm calculating "ESS Rate" percenatge which is derived as below:
    ESS Rate=(ESS count/count)*100
    have casted ESS count as double and also "Count" as Int. Both the columns aggregate rule defined in the column formula is "sum"
    Edited by: 982333 on Jan 16, 2013 3:12 PM

    For more info on the columns values defined in column formula:
    ESS Rate =100*CAST(sum(CASE WHEN "Pr Audit Setup Tax Fed Fact"."Audit Oprid Nm"="- Identity".Name THEN 1 ELSE 0 END) AS double)/CAST(count(IFNULL("Pr Audit Setup Tax Fed Fact"."Audit Oprid Nm", 'NA')) AS int)
    Result obtained:
    ESS RATE| ESS Count | Count
    86.46% | 121 | 135
    while a simple calculation using calculator would clearly give you (121/135)*100= 89.63% and not 86.46%
    Can some one please help me in resolving this issue i do not see an reason for the wrong calculation of "ESS Rate" Percentage calculation.

  • Percentage calculation on query designer (7.0)

    Hi experts,
    I´m new on Query designer (7.0) and I´m trying to do a finnancial report, so for the lines I create and structure  using G/L accounts and in the columns I got the amount for each level in my structure for a month. Now I´m trying to create an Integration percentage, it specifies how high the percentage in a level is in relation to next higher level but so far I couldn't make it...
    My report must seem like this:
    Structure.............................Amount ...... Int %
    1. Assets................................1000  ....... 100%
    1.1 Current assets....................  600  .......  60%    -> (600/1000)*100
    - Cash.............................  300  ........  50%    -> (300/600)*100
    - Inventories.....................  300  ........  50%    -> (300/600)*100
    1.2 Long-term assets................ 400  .......  40%    -> (400/1000)*100
    - Property, plant and eq..... 150  .......  37.5%  -> (150/400)*100
    - Investment property......... 150  .......  37.5%  -> (150/400)*100
    - Intangible assets..............100  .......  25%    -> (100/400)*100
    I try to use each Percentage calculation options (%, %A, %CT,%GT, %RT) but it didn't work. Can anyone help me in creating a formula to get this percentage?
    Thanks

    Hi,
    check this notes and links to get an overview how to use:
    III. List Calculations (e.g.'Calculate result as..'):Interesting facts about the OLAP Processor/Analytic Engine
    SAP Note Number: [1151957|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bw_bex/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d31313531393537%7d]
    If, in a structure element (key figure ID), you use the 'Calculate Results as' and 'Calculate Single Value as' properties with their additional fields at the same time, priority problems occur and the system behavior is not immediately clear.:
    Calculate Results/Single Values as ... priority rules
    SAP Note Number: [853058 |https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bw_bex/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d383533303538%7d]
    Regards
    Andreas

  • Percentage Calculation for result rows

    Hi
    I have problem with percentage calculation on result rows. I have 2 KFs A and B, the result is calulated by setting 'calculate result rows as' to 'summation'.
    But in KF 'C' (which is calculated as A/B*100 ),
    Now the probles is the systen picks up original values of A and B for calculation of C in result rows.
    i.e. system picks up values of result rows for A and B for
    setting 'calculate result rows as' to 'nothing defined'.
    Any ideas on how to fix this.
    Thanks
    Karen

    Karen
    I found something in Forum for you
    Result Rows Calculation
    Pradip's Solution should work. Try and if it is don't forget to award points.
    Regs
    Gopi

  • Percentage calculation according a result

    Hi,
    I have an issue with a percentage calculation in a query.
    As rows I have Product Hierarchy 1, Product Hierarchy 2 and Material. I would like to show the sales for each material as a percentage of the result by Product Hierarchy 2 and in another colunm the percentage according the result by Product Hierarchy 1. I have used the option "Normalized according to the next level.." and it works to calculate the percentage according Product Hierarchy 2, but how can i manage to calculate the percentage according to Product Hierarchy 1( it is not the next level of the hierarchy, it would be the second next level)?
    Thanks in advance.

    Hi ,
    check this link ..
    http://help.sap.com/saphelp_nw70/helpdata/EN/ee/37e80557494542806a38498d99a463/content.htm
    Hope this helps ...
    Regards,
    Shikha

  • Percentage calculation based on subtotal in webi 4.0

    Hi Experts ,
    How do i calculate the % column in webi 4.0  so that % would be calculated by the amount of Primary channel / Subtotal ) in one block.
    =[Amount Of promary Channel]/Sum([Amount Of promary Channel]) In Block  - not giving correct output.
    Thanks,
    Rajib

    Hi Rajib, As per my understanding, you want to show percentage on the base of subtotal.
    that means if you set break on the Compony then percentage column should contain the percentage calculated on the basis of compony subtotal.
    like this...(just one block of break)
    then just use the simple percentage function ( =percentage(amount) ), this will automatically calculate the percentage based on subtotal.
    and if you want to show 100% in subtotal row also then you can use formula= (amount/sum(amount)),
    i think we dont need to use contex operator here.
    formula for AHW total row = amount/sum(amount)
    Let me know if this will help you,
    Thanks,
    Nitin

  • Crystal report 2011 percentage calculation(Urgent)

    All,
    I am working on a report which looks like the below.
    product>>>>>>> revenue>>>>>>>>> growth percentage
    a  >>>>>>>>>>>     12 >>>>>> >>>>               48%
    b >>>>>>> >>>>>>>13 >>>>>>>>                  52%
    c  >>>>>>>>>>>>>   14 >>>>>>>>>                       
    d>>>>>>>>>>>>>>  16>>>>>>>>>>>>                                     
    total         >>>>>>>   25  >>>>>                          100%
    my requirement is to calculate the individual growth percentage of a and b with the total revenue of a and b only.
    to be more specific 12 divided by 25  and then 13 divided by 25.
    i want these growth percentages in growth percentage column in my report.
    I achieved the selective summation of revenue for a and b in the report footer but i am not able to use the total revenue 25 (that i get in the report footer)  in the body of the report(detail section) for growth percentage calculation.
    I tried using shared variables and global variables but of no use.i am not able to assign the grand total in the footer to a variable in the detail section in order to calculate the growth percentage.
    Is there any easy work around to achieve this? need urgent help.
    I also tried running totals and stuff but of no use.
    Any help would be appreciated.
    Reji.
    Edited by: reji2011 on Jan 22, 2012 7:32 PM

    Hi Reji,
    I'm not sure how you've added 'a' and 'b', however, whatever way it would be, I'm sure it would be a print time formula.
    Meaning it is calculated a later stage after all the records are printed. So, you would never be able to use a value in the Report Footer or any Footer to calculate against a detail section value and show the calculation on the detail section itself.
    The way I see it, you would need to insert this report as a sub-report, just to calculate a + b, store this value in 'shared variable' and use it for calculations in the Main Report.
    So, in the sub-report, where you have your formula that calculates the addition of a and b, just create a shared variable and assign this value to it.
    Place the sub-report on the Report Header and in the Main report create a formula that calls the shared variable. You can then use this formula/variable in Main-report's calculations.
    Hope this helps!
    -Abhilash

  • Macro and Field Symbol

    Hi Experts,
    I want to assign the fields of a field symbol using a macro because the field names come from a table
    the code look like this
        DEFINE ASSIGN_VALUE.
          &1-&2 = &3.
        END-OF-DEFINITION.
        ASSIGN_VALUE <RESULT_FIELDS> FIELDNAME FIELDVALUE.
    Where FIELDNAME is a CHAR variable containing the name of the field
    I get the following error:
    E:The data object "<RESULT_FIELDS>" does not have a component called
    "FIELDNAME".
    The macro and the call to it are located in a method of a class ( end routine of a transformation in BW)
    Thanks for your help
    Thibault

    Hi
    Welcome to SDN forum
    See the doc of MACROS and do accordingly
    Macros
    If you want to reuse the same set of statements more than once in a program, you can include them in a macro. For example, this can be useful for long calculations or complex WRITE statements. You can only use a macro within the program in which it is defined, and it can only be called in lines of the program following its definition.
    The following statement block defines a macro macro:
    DEFINE makro.
       statements
    END-OF-DEFINITION.
    You must specify complete statements between DEFINE and END-OF-DEFINITION. These statements can contain up to nine placeholders &1, &2,...., &9). You must define the macro before the point in the program at which you want to use it.
    Macros do not belong to the definition part of the program. This means that the DEFINE statement block is not interpreted before the processing blocks in the program. At the same time, however, macros are not operational statements that are executed within a processing block at runtime. When the program is generated, macro definitions are not taken into account at the point at which they are defined. For this reason, they do not appear in the overview of the structure of processing logic.
    A macro definition inserts a form of shortcut at any point in a program and can be used at any subsequent point in the program. As the programmer, you must ensure that the macro definition occurs in the program before the macro itself is used. Particular care is required if you use both macros and include programs, since not all include programs are included in the syntax check (exception: TOP include).
    To use a macro, use the following form:
    makro [p1 p2... p9].
    When the program is generated, the system replaces the macro by the appropriate statements and the placeholders &1, &2, …, &9 by the parameter p1, p2, …, p9. You can use macros within macros. However, a macro cannot call itself.
    REPORT demo_mod_tech_macros.
    DATA: result TYPE i,
          n1     TYPE i VALUE 5,
          n2     TYPE i VALUE 6.
    DEFINE operation.
      result = &1 &2 &3.
      output   &1 &2 &3 result.
    END-OF-DEFINITION.
    DEFINE output.
      write: / 'The result of &1 &2 &3 is', &4.
    END-OF-DEFINITION.
    operation 4 + 3.
    operation 2 ** 7.
    operation n2 - n1.
    This produces the following output:
    The result of 4 + 3 is          7
    The result of 2 ** 7 is        128
    The result of N2 - N1 is          1
    In this example, the two macros operation and output are defined. output is nested in operation. operation is called three times with different parameters. Note how the placeholders &1, &2,... are replaced in the macros.
    The following example shows that a macro definition only works in the program lines following its definition. Do not copy it!
    Let us have a look at a program with a subroutine test:
    PROGRAM macro_test.
    FORM test.
      WRITE '...'.
    ENDFORM.
    We can rewrite the program by introducing a macro macro:
    PROGRAM macro_test.
    FORM test.
    DEFINE macro.
        WRITE '...'.
      ENDFORM.
    END-OF-DEFINITION.
    MACRO.
    Inserting the macro changes nothing in the generated form of the program. Processing blocks - here a subroutine - are always indivisible. We could also write the program as follows:
    PROGRAM macro_test.
    DEFINE macro.
        WRITE '...'.
      ENDFORM.
    END-OF-DEFINITION.
    FORM test.
    MACRO.
    The most essential feature of a macro definition is that it should occur before the macro is used.
    Macro in ABAP
    Macro in ABAP
    Submitted by : SAP Basis, ABAP Programming and Other IMG Stuff
                   http://www.sap-img.com
    REPORT ZMACRO.
    DATA: RESULT TYPE I,
          N1     TYPE I VALUE 5,
          N2     TYPE I VALUE 6.
    DEFINE OPERATION.
       RESULT = &1 &2 &3.
       OUTPUT   &1 &2 &3 RESULT.
    END-OF-DEFINITION.
    DEFINE OUTPUT.
       WRITE: / 'The result of &1 &2 &3 is', &4.
    END-OF-DEFINITION.
    OPERATION 4 + 3.
    OPERATION 2 ** 7.
    OPERATION N2 - N1.
    *-- End of Program
    Regards
    Anji

  • DRILL_UP and DRILL_DOWN DP Macro and data view refresh

    Folks,
    Need your help with the following:
    I have the following characteristics in the data view:
    Site, Plant, Unit, Product Family, Material.
    1. When go into the data view, I am at the most detailed level.
    2. I created a macro so that I DRILL_UP( 'Material' ; INTERNAL ) and run it.
    3. Then I run another macro to perform calculations at this level. Basically, I am disaggregating a key figure based on another key figure in this step (since disaggregation at the lowest level does not make sense). This works because there is nothing fancy here.
    4. I created a macro so that I DRILL_DOWN( 'Material' ; INTERNAL )
    Problem: When I run this macro in the data view, the whole data view values look like they are messed up. Only the totals values can be seen and no other values. This is the case when I drill up, and when I drill down. This is actually the case even when I did not use the INTERNAL option for DRILL_UP and DRILL_DOWN.
    Here is the thing. When I save the data view, everything gets refreshed and all the values get correctly populated at the lowest level as expected. So, it seems that the problem is with refresh.
    Please let me know if you have any suggestions.
    Thanks,
    Satish

    Hello,
    Just to add to the above replies from our two experts.
    I checked your scenario, and I think maybe you can acheive this just by changing the macro's execution level, from detailed level to aggregated level. Here you do not need the drill_down and drill_up macros, which are time consuming ...
    Please have a try and good luck
    Best Regards,
    Ada

  • Downloaded data in Excel from SAP table data to have the macro and control?

    We know that in SE16 screen to display SAP table data, there is a menu item or button to download the table data to excel sheet, but in the excel sheet, the data is for display only and some calculation functions (e.g. sum) are not be able to be downloaded to the excel sheet as macro.
    Our customers would like us to see if there is a way that in the excel sheet with the download SAP table data, only some certain rows/columns of data are allowed to be changed by customers or in other words, other areas in the excel sheet should be frozen and users can not even insert a column and do the copy/paste rows/columns.  And also the original calculated column in SAP table (e.g., sum) would be in the corresponding column in the excel sheet, but with macro to do the same function (e.g., sum).  After the customers perform some changes in some allowed certain rows/columns in the excel file, then the changed data can be uploaded back to SAP.
    Wonder if there are such ABAP program to fullfill the above task to download SAP table data to an excel file and to make the downloaded data in the excel with only some certain row/columns to be changeable and all other areas frozen?
    Thanks and we will give you reward points for valuable answers!

    Hi,
    This scenario can be met with the FM : RH_START_EXCEL_WITH_DATA
    This is available in Older versions. Starts Excel with a macro.
    I have never tried using this FM.
    However, I came across : http://www.jt77.com/development1/programming-23850.html
    Showing the use of it.
    To get useful hints, also refer :
    1) Transaction : DWDM
    2) MS EXCEL as OLE Client : 
    http://help.sap.com/saphelp_nw04/helpdata/en/40/b297f3c32711d194ac00a0c94260a5/frameset.htm
    3) Read the content at any table + Defined Macros used to call Function Modules
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c043d836-166c-2910-b99e-ae3633dec547
    Once you get a solution, would appreciate a mail to me @ <REMOVED BY MODERATOR>
    Cheers,
    Remi
    Edited by: Alvaro Tejada Galindo on Feb 29, 2008 5:41 PM

  • Why I can not find the percentage calculation %ct

    Hi,
    I m trying to use the Percentage Calculation %ct for a calculated KeyFigure. There are only two Functions: %  and  %A
    Can anyone explain why it is so?
    thanks and regards

    Hi,
    Percentage Variance (%)
    <Operand1> % <Operand2>
    This gives the percentage variance between operand 1 and operand 2. 
    Percentage Share (%A)
    <Operand1> %A <Operand2>
    This gives the percentage share of operand 1 and operand 2. It is identical to formula 100 * <Operand1> / abs(<Operand2>) , if <Operand2> is not equal to 0 and the character for u201CDivision by 0u201D if <Operand2> is equal to 0.
    Use
    You use the following percentage functions as operators when you define a formula or a calculated key figure.
    Features
    NULL values are displayed as empty cells, not as 0. For more information about when NULL values occur and how they are displayed, see Technical Notes About the Formula Operators.
    Percentage Variance (%)
    <Operand1> % <Operand2>
    This gives the percentage variance between operand 1 and operand 2. It is identical to:
    Formula 100 * (<Operand1> - <Operand2>) / abs(<Operand2>) , if <Operand2> is not equal to 0 and the character for u201CDivision by 0u201D if <Operand2> is equal to 0.
    Plan Sales % Actual Sales specifies the percentage difference between the plan sales and the actual sales.
    Percentage Share (%A)
    <Operand1> %A <Operand2>
    This gives the percentage share of operand 1 and operand 2. It is identical to formula 100 * <Operand1> / abs(<Operand2>) , if <Operand2> is not equal to 0 and the character for u201CDivision by 0u201D if <Operand2> is equal to 0.
    Character for "Division by 0" :See SAP Reference IMG  u2192 SAP Customizing Implementation Guide  u2192 SAP NetWeaver  u2192 Business Intelligence  u2192 Settings for Reporting and Analysis  u2192 General Settings for Reporting and Analysis  u2192 Display of Numeric Values in the Business Explorer.
    "Fixed costs" %A "costs" expresses the proportion of the total cost of a product that is the fixed cost.
    Percentage Share of Result (%CT)
    %CT <Operand>
    This shows how high the percentage share is, with regard to the result. The result is the outcome of aggregating the second highest results level (interim result).
    Use
    You use the following percentage functions as operators when you define a formula or a calculated key figure.
    Features
    NULL values are displayed as empty cells, not as 0. For more information about when NULL values occur and how they are displayed, see Technical Notes About the Formula Operators.
    Percentage Variance (%)
    <Operand1> % <Operand2>
    This gives the percentage variance between operand 1 and operand 2. It is identical to:
    Formula 100 * (<Operand1> - <Operand2>) / abs(<Operand2>) , if <Operand2> is not equal to 0 and the character for u201CDivision by 0u201D if <Operand2> is equal to 0.
    Plan Sales % Actual Sales specifies the percentage difference between the plan sales and the actual sales.
    Percentage Share (%A)
    <Operand1> %A <Operand2>
    This gives the percentage share of operand 1 and operand 2. It is identical to formula 100 * <Operand1> / abs(<Operand2>) , if <Operand2> is not equal to 0 and the character for u201CDivision by 0u201D if <Operand2> is equal to 0.
    Character for "Division by 0" :See SAP Reference IMG  u2192 SAP Customizing Implementation Guide  u2192 SAP NetWeaver  u2192 Business Intelligence  u2192 Settings for Reporting and Analysis  u2192 General Settings for Reporting and Analysis  u2192 Display of Numeric Values in the Business Explorer.
    "Fixed costs" %A "costs" expresses the proportion of the total cost of a product that is the fixed cost.
    Percentage Share of Result (%CT)
    %CT <Operand>
    This shows how high the percentage share is, with regard to the result. The result is the outcome of aggregating the second highest results level (interim result).
    If a characteristic has been drilled down in both the rows and the columns, this reference is not unique. The system displays a warning and the relevant symbol for Data Does Not Exist. For more information, see SAP Reference IMG  u2192 SAP Customizing Implementation Guide  u2192 SAP NetWeaver  u2192 Business Intelligence  u2192 Settings for Reporting and Analysis  u2192 General Settings for Reporting and Analysis  u2192 Display of Numeric Values in the Business Explorer.
    Percentage Share of Overall Result (%GT)
    %GT <Operand>
    This shows how high the percentage share is with regard to the overall result. The overall result is the outcome of aggregating the highest results level. Dynamic filters (filters that were not specified in the Query Designer) also play a role in calculating the overall result.
    Percentage Share of Query Result (%RT)
    %RT <Operand>
    This is the same as %GT.
    Unlike the process for calculating the overall result, dynamic filters are not used in the calculation of the query result. This means that the calculation always normalizes to the same value, irrespective of the filter status and the navigational state.
    Reg
    Pra

  • Difference between macro and subroutine

    what is the difference between macro and subroutine? i
    need some example on macro

    Hi,
    <b>
    Subroutines</b>
    Subroutines are procedures that you can define in any ABAP program and also
    call from any program. Subroutines are normally called internally, that is, they
    contain sections of code or algorithms that are used frequently locally. If you want
    a function to be reusable throughout the system, use a function module.
    <b>Defining Subroutines</b>
    A subroutine is a block of code introduced by FORM and concluded by ENDFORM.
    FORM <subr> [USING ... [VALUE(]<pi>[)] [TYPE <t>|LIKE <f>]... ]
    [CHANGING... [VALUE(]<pi>[)] [TYPE <t>|LIKE <f>]... ].
    ENDFORM.
    <subr> is the name of the subroutine. The optional additions USING and
    CHANGING define the parameter interface. Like any other processing block,
    subroutines cannot be nested. You should therefore place your subroutine
    definitions at the end of the program, especially for executable programs (type 1).
    In this way, you eliminate the risk of accidentally ending an event block in the
    wrong place by inserting a FORM...ENDFORM block.
    <b>Macros</b>
    If you want to reuse the same set of statements more than once in a program, you can include
    them in a macro. For example, this can be useful for long calculations or complex WRITE
    statements. You can only use a macro within the program in which it is defined, and it can only
    be called in lines of the program following its definition.
    The following statement block defines a macro <macro>:
    DEFINE <macro>.
    <statements>
    END-OF-DEFINITION.
    You must specify complete statements between DEFINE and END-OF-DEFINITION. These
    statements can contain up to nine placeholders (&1, &2, ..., &9). You must define the macro
    before the point in the program at which you want to use it.
    Macros do not belong to the definition part of the program. This means that the DEFINE...ENDOF-
    DEFINITION block is not interpreted before the processing blocks in the program. At the
    same time, however, macros are not operational statements that are executed within a
    processing block at runtime. When the program is generated, macro definitions are not taken
    into account at the point at which they are defined. For this reason, they do not appear in the
    overview of the structure of ABAP programs [Page 44].
    A macro definition inserts a form of shortcut at any point in a program and can be used at any
    subsequent point in the program. As the programmer, you must ensure that the macro
    definition occurs in the program before the macro itself is used. Particular care is required if you
    use both macros and include programs, since not all include programs are included in the syntax
    check (exception: TOP include).
    To use a macro, use the following form:
    <macro> [<p1> <p2> ... <p9>].
    When the program is generated, the system replaces <macro> by the defined statements and
    each placeholder &i by the parameter <pi>. You can use macros within macros. However, a
    macro cannot call itself.
    DATA: RESULT TYPE I,
    N1 TYPE I VALUE 5,
    N2 TYPE I VALUE 6.
    DEFINE OPERATION.
    RESULT = &1 &2 &3.
    OUTPUT &1 &2 &3 RESULT.
    END-OF-DEFINITION.
    DEFINE OUTPUT.
    WRITE: / 'The result of &1 &2 &3 is', &4.
    END-OF-DEFINITION.
    OPERATION 4 + 3.
    OPERATION 2 ** 7.
    OPERATION N2 - N1.
    The produces the following output:
    The result of 4 + 3 is 7
    The result of 2 ** 7 is 128
    The result of N2 - N1 is 1
    Here, two macros, OPERATION and OUTPUT, are defined. OUTPUT is nested in
    OPERATION. OPERATION is called three times with different parameters. Note
    how the placeholders &1, &2, ... are replaced in the macros.
    Rgds,
    Prakash

  • Production system editing of overhead percentage calculation

    Hi,
    We want to maintain the overhead percentage calculation in the live
    production system through the T.code S_ALR_87008275.when we want to
    change the percentage the following message appers "Client has status
    not modifiable". Without changing the client status we want to change
    the percentage in the live production server. Kindly guide us in this
    regards....
    Regards
    Syamkrishnan

    Hi
    Refer to SAP notes 372620,374609,356483, 135028 and 77430
    This will help you in achieving the same.
    Good Luck
    Hari

Maybe you are looking for

  • Yet another "Can I better optimize my iMac or is it time to buy a new one" question

    Machine Specs: Processor: 2.4 GHz Intel Core Duo Memory: 3 GB 800 MHz DDR2 SDRAM OS X 10.9.2 My iMac has become cripplingly slow, and I need to decide whether there's anything I can do to fix this or if it's just old and I need a new machine. I am no

  • Trying to write an if statement around the return value of a CANCEL_OPTION

    I am writing a program that takes an input String using JOptionPane. The String can be made of only letters of the A-Z alphabet and the space character. I have written an error-checking loop that will pop another input box up along with an error mess

  • Creation of user steps for an custyomizing client ex: 100 in SAP R3 4.7 EE

    Hi All, What are the steps involved for creation of new client EX: 100 as a customizing client and what is the procedure to create an user in client 100, becaz am able to create a client but user is not created proeprly PLZ help me ADV THANX Regds ph

  • VGA output noise

    When I use the VGA port and plug in the power cable into my T430 I notice faint horizontal lines flickering on the external monitor, in areas of certain shades of gray. It is faint, but visible. I have auto-adjusted the external monitor. The flickeri

  • Document Set name as refiner in Search results?

    I'm wondering if there is a way to use the document set name as a refiner in a search results page so a user can search a specific site or document library and choose the document set name to narrow the results? Initially I thought I could create a s