ABAP Code for Key Figure selection in Report

Hello Experts,
I am working on one of the development request that requires following logic to be implemented at query execution. There will one KF column and based on valid combination of characteristics value from the cube, Key Figure value from the same cube will be selected and reported.
If ((Plant = A1) and (Division = B1))
  OR ((Plant =A2 ) and (Division = B1))
  OR ((Plant = A3) and (Division = B2))
  OR ((Plant = A6) and (Division = B2)).
  Price = Moving Avg.
Else
  Price = Standard.
Can somebody please suggest, how to do this? Thanks in advance.
Regards,
Nimesh

Nimesh,
Step 1.Create a formula (say F1)variable with customer exit. In the customer exit code read the values of Plant and Division. If the Plant and Division combination is the one that you specified below return a 1 (for Moving Avg.) or return a 0 (for Standard).
Step 2. Create a column with a formula having the following definition
         (F1=1)'Moving Avg.' + (F1=0)'Standard'
So, if the combination satisfies Moving Avg will be shown else Standard will be shown.
You can avoid customer exit coding by using  replacement variables and using them in a formula, this would make your calculation clumsy and confusing. Let me know if you cannot get the customer exit solution work.
Hope it helps...

Similar Messages

  • Is there any transaction code for uploding logo in ALV reports.

    is there any transaction code for uploding logo in ALV reports.

    hi,
    call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
                i_logo             = 'Z_LOGO'.
    endform.
    Upload Logo for REUSE_ALV_COMMENTARY_WRITE
    For those who wish to upload and use a picture in your ALV abap reports.
    Steps for uploading Logo :-:
    1. Goto the transaction OAER
    2. Enter the class name as 'PICTURES'
    3. Enter the class type as 'OT'
    4. Enter the object key as the name of the logo you wish to give
    5. Execute
    6. Then in the new screen select Standard doc. types in bottom window
    Click on the Screen icon
    Now, it will ask for the file path where you have to upload the logo
    7. Now you can use this logo in REUSE_ALV_COMMENTARY_WRITE
    or
    Import Logo and Background Picture for Reporting
    In this step, you can import a customer-specific logo and a background picture into the R/3 System. These will be displayed in the header area of reports in HR Funds and Position Management.
    From the SPRO:
    HR Funds and Position Management --> Dialog Control --> Customize Reporting Interface --> Import Logo and Background Picture for Reporting.
    Activities
    1. Enter the Name of your logo/background picture as an object key in the initial screen.
    2. Make sure that the class name is PICTURES, and the class type is OT.
    3. Choose Execute.
    4. Double-click the document type Picture on the Create tab page. A dialog box will appear in which you can enter the path in which the logo/background picture can be found.
    5. Enter the path and choose Open. The logo will be uploaded into the current R/3 System. If the logo/background picture is to be transported into other systems as well, choose Transport.
    6. Return to the initial screen and repeat the procedure after having entered the Name of your background picture as an object key.
    Please note that the logo/background picture can only be displayed in ALV-based reports with an HTML header. Manually programmed reports such as business distribution plans are not based on the ALV.
    If you have selected several initial objects, ALV-based reports in HR Funds and Position Management will automatically use a hiearchical-sequential display. A logo is not displayed here either. Note also that the logo cannot be printed (see print preview in program).
    Make sure that the logo does not exceed a height of 100 pixels because it would mean that the header of the report will be scrollable.

  • ABAP  Code for SAP exit varaibles?

    Hi,
    i) Where can I find the abap code for SAP exit variables
    OP_KEYDT used for the net due date
    OP_KEYD2 used for the posting date
    OP_KEYD3 used for the clearing date, which are used in FI AR aging report(0FIAR_C03).
    Based on the Net Due Date, which is key date(0NETDUEDATE), entered by the user at runtime, the posting date and celaring date are populated.
    II) The problem is we want to simulate a similar scenario, but with key date, which user enters is based on the custom Net Due Date(ZNETDUEDATE).And this date is populated to posting date and clearing date variables.
    How do we acheive that.
    Thanks.

    Hi Kumar,
    Try this below mentioned example where default date is current date.
    Step1: Create a variable(ex: cur_date) on requrired characteristic with Processing type "Customer Eixt" and check the check box for ready for input(if this variable need in selection screen).
    Step 2: Goto T Code : CMOD and provide appropriate Project and choose components and click on display.
    Step3: Double click on exit "EXIT_SAPLRRS0_001" you can see include "ZXRSRU01", double click on include.
    Step4: Sample code to populate.
    WHEN 'CUR_DATE'.
    Data : l_p_range_SSS TYPE rrrangesid.
    IF I_STEP = 1.
    l_p_range_SSS-Low = sy-datum.
    l_p_range_SSS-Sign = 'I'.
    l_p_range_SSS-Opt = 'EQ'.
    APPEND l_p_range_SSS TO e_t_range.
    Endif.
    The following values are valid for I_STEP:
    · I_STEP = 1
    Call up takes place directly before variable entry
    · I_STEP = 2
    Call up takes place directly after variable entry. This step is only started up when the same variable could not be filled at I_STEP=1.
    · I_STEP = 3
    In this call up, you can check the values of the variables. Triggering an exception (RAISE) causes the variable screen to appear once more. Afterwards, I_STEP=2 is also called up again.
    · I_STEP = 0
    The enhancement is not called from the variable screen. The call up can come from the authorization check or from the Monitor.
    Also, refer this link..
    http://help.sap.com/saphelp_bw320/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/content.htm
    Cheers,
    Allen

  • Added new key figure in the report

    Experts,
    I have added new key figure in the report .If i display this key figure value in the report it is populating correct value with ERROR(example 22.5 ERROR).The report is on the multiprovider .i have check the value for this in multiprovider it is populating correctly .There is no calculation in the report for this .While extracting in to report i am getting this. Help me to resolve this issue.
    Thanks
    Murali

    Hi,
    I have already created a formula like NODIM(Key field).that only i am using .
    and mapping I did in this way. I went to multiprovider and I have selected this key figure and right click and select (assign) then I have click on create proposal for all infoobjects option.
    Please suggest any thing need to do.
    I am sorry .I did not understand the lonterm solution suggested by you .what is UOM .Please tell me how to map.can you pls tell me clearly please
    Thanks
    Murali

  • Dynamic Texts from Bex ( for Key Figures ) not coming to WEBI Query

    Hi Gurus,
    We have a Query in BEx : Each  Key figure column text changes dynamically - Like based on Present month
    it will Display Month +1 Month +2  up to Month +12.  Used  dynamic Text variables .
    But when i created the universe and Webi report , i am missing the text in the column for Key figures .
    How should i get the column text in Webi which is same as in Bex : Points will be awarded for helpful
    answers.
    Thanks
    Magge

    Hi,
    text variables with replacement path are supported in BO4.0, see following document: SAP BusinessObjects BI4 - Supported BEx Query Elements
    As an example after entering 2012 in the prompts window, the name of the corresponding key figure will dynamically change:
    After refreshing and selecting 2013, the column name will update:
    Im not sure though if this is the case with unv universe access to BEx queries.
    Best regards,
    Victor

  • Abap code for sap exit variables?

    Hi,
    i) Where can I find the abap code for SAP exit variables
    OP_KEYDT used for the net due date
    OP_KEYD2 used for the posting date
    OP_KEYD3 used for the clearing date, which are used in FI AR aging report(0FIAR_C03).
    Based on the Net Due Date, which  is key date(0NETDUEDATE),  entered by the user at runtime, the posting date and celaring date are populated.
    II) The problem is we want to simulate a similar scenario, but with key date, which user enters is based on the custom  Net Due Date(ZNETDUEDATE).And this date is populated to posting date and  clearing date variables.
    How do we acheive that.
    Thanks.

    Please tell how u solved ur issue i have the same scenario to be do.

  • ABAP code for BI 7.0 transformations start routine

    Hi all,
    I am trying to update data from DSO1 (Source1: transaction data) to Infocube(TARGET)
    In the transformations Start routine, I have to read DSO2(Source2: Master data) for some fields.
    DSO1 has CUSTOMER as part of key
    DSO2 has CUSTOMER (key) and other fields....FIELD1, FILED2, FIELD3
    Infocube to be updated with FIELDS1,2 & 3 WHILE READING DSO2.
    WHERE DSO1 CUSTOMER matches with DSO2 CUSTOMER.
    Also, data NOT TO BE UPLOADED into Infocube if FIELD1 in DSO2= NULL
    Please give me the abap code for the above logic.
    Appreciate any help in this regard.
    Thanks.

    This is a doc from this site:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19
    Ravi Thothadri

  • Currency translation for key figure in bex not working.

    Hi friends,
    i want to do currency translation for key figure(invoice value in local currency).
    i have followed the steps as under:
    1st Transferring Global Table Contents: Currencies from R/3 Systems
    2nd than transfer exchange rate - from r/3 to bi
    3 than In SPRO settings of BW there is option "consider translation ratios in translation"
    4th than used transaction RSCUR for creating currency translation type: parameter(exchange rate:m, soure currency fom data records, target currency ISK, time ref: current date)
    5th than in BEX query designer have sated this for key figure
    but when i run query in RSRT, curreny amount not getting convert?
    am i missing any step?
    pl. guide.
    thanks dushyant.

    Hi Dushyant,
    Are these steps followed in Query designer??
    In the Query designer, for that particular key figure property, under Conversion tab >> Currency Translation >> Conversion Type, select the currency translation type you created in RSCUR.
    And in the target currency, select accordingly.
    If you are going to use a variable, use the following link..
    http://help.sap.com/saphelp_nw04/helpdata/en/08/81b98b95e911d4b2ca0050da4c74dc/content.htm
    See also..
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/287bab90-0201-0010-f48e-cc55b0cd13d0
    Hope this helps..!
    -Pradnya
    Edited by: Pradnya Rane on Apr 8, 2009 7:58 AM

  • How to write conversion routine for key figure?

    Our customer has this requirment:
    we need to know the last time of some TV program in BEx report, If a TV program last 500 seconds, we need show the key figure like this:  00:08:20, If a TV program last 100000 seconds, we need show the key figure like 27:46:40 (27 hours and 46 minitues and 27 seconds), If we define a key figure as time,  BW system will report a error that say it is not acceptable time.  If we want to define a integer, but we need display it like hhmmss format.  We know we can write conversion routine for char.  but I don't how to write conversion routine for key figure.   Please give me any hint if any other solutions?
    Edited by: SY DONG on Dec 2, 2010 3:36 AM

    If you want to do in Transformation Layer :
    You can use routine ...break up the seconds into minute hour and seconds
    you will have to handle few cases in this:
    let say your variable lv_seconds holds the number of seconds you want to convert to hour min and seconds
    DATA: lv_seconds type i,
               lv_hrs  type  i,
              lv_sec type i,
              lv_min type i.
    lv_hrs = lv_seconds / 3600
    if lv_hrs >= 1.
    lv_min = (lv_hrs - trunc(lv_hrs))*60
    here again handle seconds if min >60.
    else.
    lv_hrs = '00'.
    lv_min = lv_hrs*60
    It is just hint ..how you can manipulate the seconds to get it...you will have to think about the complete algorithm
    Regards,
    RK

  • Need ABAP code for the below Services requirement

    Hi,
    We have a requirement to show all the services for a particular Purchase order number.For this I built a view on 2 tables ESLL and EKPO.Now based on the below logic I need to bring the services for the Purchase order..
    1.Enter PO number,item no. and Doc category in EKPO and find the Pack no.
    2.Now take the Pack no. of EKPO and give in ESLL and find the Sub pack no.
    3.Now take this Subpack no. and Give this sub pack as Pack no. in ESLL
    4.This will be the Service entry record for that PO number.
    Can any one Please suggest me to how to write the ABAP code for the above logic.
    Thanks & Regards,
    Dinakar

    Hi Dinaker,
    Did you find any solution for this issue. I too have a similar requirement of pulling all the service orders for a specific Purchase Order in the BW report.
    Thanks,
    SAPBWI

  • GRR2- 4FM-RepPaint(put ABAP code for convert data in field)

    Hi,
    If somebody know how possible add ABAP code for convert data in some column-field of report (by RepWriter,UserExit,BADI)?
    Thanks a lot.

    Elaborate your question. Not clear ??

  • Unit 0ORDER_CURR for key figure 0ORDER_VAL is not recognized in the update

    Hello Experts,
    I am getting the below warning while I am installing the business content for Purchasing Cube 0PUR_C04 update Rules
    "Unit 0ORDER_CURR for key figure 0ORDER_VAL is not recognized in the update rules"
    And the business content activation is terminated.
    Can you please let me know how i could resolve.
    Thanks
    Padma

    Hi Amrit,
    Nice to know Toons suggestions have helped you to resolve your issue.
    There is one bug waiting to explode soon although.
    Check this out after your last insert
    INSERT INTO mth_equipment_shifts_d(equipment_fk_key,availability_date,shift_workday_fk_key,from_date,To_Date,line_num,availability_flag,entity_type,creation_date,last_update_date,creation_system_id,
    last_update_system_id) (
    SELECT b.entity_pk_key entity_pk_key,a.shift_date shift_date,a.shift_workday_pk_key shift_workday_fk_key,Trunc(a.shift_date) from_date,Trunc(a.shift_date) To_Date,1 line_num,'Y',
    b.entity_type entity_type,SYSDATE,SYSDATE,-1,-99999
    --INTO l_site_id,l_entity_pk_key,l_entity_name,l_entity_type,l_production_entity,
    --l_shift_workday_pk_key,l1_shift_date,l_from_date,l_to_date
    FROM mth_workday_shifts_d a ,
    SELECT plant_fk_key site_id, entity_pk_key, entity_name, entity_type, production_entity production_entity
    FROM mth.mth_equip_entities_mst
    UNION ALL
    SELECT plant_pk_key site_id, plant_pk_key entity_pk_key, plant_name entity_name, 'Site', production_site production_entity
    FROM mth.mth_plants_d
    UNION ALL
    SELECT plant_fk_key site_id, resource_pk_key entity_pk_key, resource_name entity_name, 'Resource', production_resource production_entity
    FROM mth.mth_resources_d
    UNION ALL
    SELECT plant_fk_key site_id, equipment_pk_key entity_pk_key, equipment_name entity_name, 'Equipment', production_equipment production_entity
    FROM mth.mth_equipments_d
    )b
    WHERE b.site_id = a.plant_fk_key
    AND a.plant_fk_key=l_plant_fk_key
    AND shift_date>=l_start_date
    AND shift_date<=l_end_date
    AND UPPER(a.shift_type)='BOTH'
    AND a.FROM_DATE IS NULL
    AND a .To_Date IS NULL
    --AND a.line_num=NULL
    AND a.shift_num IS NULL
    There is no COMMIT
    You may want to check that out.
    Cheers!!!
    Bhushan

  • ABAP code for Date Range

    Hi All,
    I have requirement to write code for date range.
    Characterstic = Run-Out Date, it was created reference to 0Date.
    Requirement is data should load depends on Run-Out Date 7 days old and 14 days future.
    Logic is -7 days old >= Run_out date <= 14 days future.
    please let me know how I need to proceed with ABAP code for this requirement.
    Thanks.
    Please do not ask for ABAP code here. Its not a training forum
    Edited by: Pravender on Aug 18, 2011 1:46 AM

    >
    Sree vignesh wrote:
    > Hi,
    > In the select option we have a field month range as
    > SELECT-OPTION : FROM 01.2007       TO  01.2009 " Let say Ur Selection option is SO_MONTH
    > but now i need to add the DMBTR field considering the month range in the SELECT OPTION i.e., only FROM 01.2007 TO  01.2009 i mean without 2006 data.
    >
    > LOOP AT LT_DATA WHERE month in SO_MONTH. " Here add a Where condition
    >     ls_output-matnr = lt_data-belnr.
    >     ls_output-werks = lt_data-bukrs.
    >     ls_output-lgort = lt_data-dmbtr.   
    >
    >     COLLECT  ls_output INTO lt_output .
    >
    >   ENDLOOP.
    >
    > please help with code .
    >
    > thanks in advance.
    Regards,
    Suneel G

  • Needs sample ABAP code for field routine

    Dear Expert,
    There is a field "Pay Scale Group" in my DSO which stores the data in the format
    AA1/B1/CCC2/DD2/EEE1, A1/BB2/CC2/DDD3/EE2 etc. These data has to be transferred to
    InfoCube where "pay Scale Group" in the InfoCube will store the data like EEE1,EE2 etc.
    I need to write a field routine on the transformation between DSO and Cube.
    Can any one please help me with the sample ABAP code for this scenario.
    Some more examples for better understanding of the requirement:-
    Data in DSO(Source)            Data in Cube(Target)
    ===================            ===================
    AA1/B1/CCC2/DD2/EEE1            EEE1
    AAA1/BB2/CC1/DDD3/EE2           EE2
    A2/BBB2/CC2/DDD3/EEE5           EEE5
    AA2/BB1/C1/DDD3/EE3             EE3
    A3/B1/CC2/DDD1/EE4              EE4
    Many thanks in advance.
    Regards,
    Prakash
    Please do not dump your code requirements in SDN
    Edited by: Pravender on May 18, 2011 11:37 AM

    Hi,
    You can use the following code :
    Suppose the technical name of the field coming from DSO is ZPAY_SGRP.
    And also for example let me take one record, that is ZPAY_SGRP = AA1/B1/CCC2/DD2/EEE1 .
    My assumption is that there will always be 4 '/'.
    In the field routine write the below code
    data: V1(5) type c,
              V2(5) type c,
             V3(5) type c,
              V4(5) type c,
             V5(5) type c.
    data : VAR1 TYPE /BIC/OIZPAY_SGRP.
    split VAR 1  at '/' into V1 V2 V3 V4 V5.
    result = V5.
    V5 will be having the characters after the last '/' .That is V5 = EEE1.
    Hope the above reply was helpful.
    Kind Regards,
    Ashutosh Singh
    Edited by: Ashutosh Singh on May 17, 2011 3:53 PM
    Edited by: Ashutosh Singh on May 17, 2011 4:17 PM

  • How To Create ABAP Code For HR Context Sensitive Structural Authorization

    Hello,
    We have created a HR Custom Program which IS NOT built off the PCH or PNP Logical Database. As a result, we need to manually create ABAP code for HR Context Sensitive Structural Authorization Check in our custom HR program. Via HR Context Sensitive Structural Authorizations, we are restricting access to personnel numbers and the underlying HRP* tables.
    Any assistance would be greatly appreciated with the identification of the SAP standard function modules (Ex. RH_STRU_AUTHORITY_CHECK, HR_CHECK_AUTHORITY_INFTY, HR_CHECK_AUTHORITY_INFTY , etc) used in HR Context Sensitive Structural Authorization Check, how they are used to control HR Structural authorization (P_ORGINCON), and some sample code.
    Thank you in advance for all your assistance,
    Ken Bowers

    Hello Ken
    You can use the interface methods IF_EX_HRPAD00AUTH_CHECK to get the same structural authorization as you can see in PA20/PA30. You need to use the methods set_org_assignment and check_authorization for this purpose. For more information you can refer to include FP50PE21 from line 237 onwards till 270.
    Regards
    Ranganath

Maybe you are looking for

  • Slow transfer speed over VPN connection

    Hello, Recently I setup an SSL VPN to connect to my parent's home network.  I have some computers there, and want to try to transfer files between my computer and the one at my parent's.  Over the VPN connection, I only get 128kb/s.  On both ends, th

  • Black and White Gray Scale Photos Are Dark When Exported from Indesign to PDF

    When I print right from InDesign the black and white photos look great.  However, if I print the exported pdf file, the black and white photos are much darker.  Is there something I should be doing upon export so that they will look as they do in InD

  • Reformatting

    Hello, I need to reformat my macbook but the option is greyed out in the disk utility. I was wondering if there is any way to do that.

  • Ipod wont show songs after updating.

    Hi there, I have a Ipod 30gig Video. I have just done the 1.2.2 update on it. I am running windows 2000. The only way I can get my songs back and lists, is to plug it into my mac laptop, then Eject it. It seems as Itunes does not support windows 2000

  • Which Pin do I need for Firewire?

    I have a MacBook Pro, one of the first models. What is the pin number of my Firewire into my laptop?