Changing position of negative sign on Key figures in APD

Hi BI Gurus,
I got an issue with APD writing data with negative value into Flat File . When it writes to flat file, it's writing as  100- format and not -100 format.  searched on the SDN and found out that this can be achieved by routine in APD.
Can you guys please help me in putting this logic into proper ABAP for BI 7 routine?
Thanks,
Sashi

Hi Vikarm,
Thanks for all your help.
i am getting "Syntax error: "V_NUM1" must be a character-like data object (data type C, N, D, T, or STRING) field string)." error when I used below code.
TYPES: BEGIN OF y_source_fields ,
         COMP_CODE TYPE /BI0/OICOMP_CODE ,
         FISCYEAR TYPE /BI0/OIFISCYEAR ,
         FISCPER3 TYPE /BI0/OIFISCPER3 ,
         PROFIT_CTR TYPE /BI0/OIPROFIT_CTR ,
         ACCOUNT TYPE /BI0/OIACCOUNT ,
         KYF_0001 TYPE /BIC/OIZBALANCE ,
       END OF y_source_fields .
TYPES: yt_source_fields TYPE STANDARD TABLE OF y_source_fields .
TYPES: BEGIN OF y_target_fields ,
         COMP_CODE TYPE /BI0/OICOMP_CODE ,
         FISCYEAR TYPE /BI0/OIFISCYEAR ,
         FISCPER3 TYPE /BI0/OIFISCPER3 ,
         PROFIT_CTR TYPE /BI0/OIPROFIT_CTR ,
         ACCOUNT TYPE /BI0/OIACCOUNT ,
         KYF_0001 TYPE /BIC/OIZBALANCE ,
       END OF y_target_fields .
TYPES: yt_target_fields TYPE STANDARD TABLE OF y_target_fields .
Begin of type definitions -
*TYPES: ...
End of type definitions -
FORM compute_data_transformation
     USING     it_source TYPE yt_source_fields
               ir_context TYPE REF TO if_rsan_rt_routine_context
     EXPORTING et_target TYPE yt_target_fields .
Begin of transformation code -
DATA: ls_source TYPE y_source_fields,
        ls_target TYPE y_target_fields,
        v_num1 TYPE /BIC/OIZBALANCE,
        v_len1 TYPE i.
  LOOP AT it_source INTO ls_source.
  MOVE-CORRESPONDING ls_source TO ls_target.
v_num1 = ls_source-KYF_0001. 
v_len1 = STRLEN( v_num1 ).
v_len1 = v_len1 - 1.
concatenate v_num1+v_len1(1) v_num1(v_len1) into v_num1.
ls_target-KYF_0001 = v_num1.
APPEND ls_target TO et_target.
ENDLOOP
Regards,
Sashi

Similar Messages

  • How to avoid negative values of key figure

    Dear all,
    I have to create one query based on ODS, in which i will use one key figure, which has negative as well as positive values. In report, i want to avoid all negative values or make them zero. Is it possible?  Please guide me for the same.
    I cann't make any modification to the ODS.
    Regards,
    Pravin.

    Hi,
    To make negative values as possitive you can use the formula abs().
    ie:  abs(key figure)
    You can also create a condition in the query to show only values greater than or euqal to 0. Make it active, then you will get all values greater than or equal to 0.
    Now if your intention is to show the negative values as 0 then use the formula as stated above.
    Regards
    Govind.

  • Positive and Negative Sign

    Hello everyone,
    May I know why the standard freight cost is negative sign in SD but positive sign in COPA.
    Also sales and various kind of cost are showing positive sign in COPA. No negative sign in COPA?
    Thank you.
    Regards.

    Hello,
    It is also possible to transfer conditions from MM to update billing data in pooled payment in the Information Systems (IS) retail system. These are transferred according to the same rules as SD conditions. Conditions from SD are always transferred to COPA with + signs, with the exception of credit memos and returns.  The reasons for this is that the signs for revenus are handled differently in the different applications of the system.  For example, revenus are positive in SD, while they are negative in FI. Consequently, COPA accepts all of the values as positive, and then subtracts deductions and costs from revenues in IS.
    Note that indicator transfer +/- is not used to compare the different use of +/- signs between FI or SD and COPA.  If you active the indicator, only the positive and negative values for the condition in question will be balanced.  This guarantees that the sum of the negative and positive condition values are displayed as a correct total value in the value field asigned to that condition.
    In order to perform transfer conditions from the billing documents the same definitions must be established for the value fields in Profitability Analysis and both pricing and conditions types must be defined in SD.
    Regards,
    Ravi

  • Negative values of key figures to be displayed seperately

    Hi,
    I have a requirement where , the postive sales figures are to be displayed in one column and Negative sales figures are to be displayed in another column ina BEX report.... There is only one key figure ( sales )
    how to get this please ?
    PVC

    Hi Pravendar ,
    Thanks for your reply..
    The key figure infoobject is only one called Sales..
    If the value is negative , then it should display in seperate column in teh report..
    I could not understand        (KF < 0) * KF  -
    If the slaes figure is -1233   does this mean i should created a CalKeyfig
    with (Sales < 0) * Sales  ??
    Can you please elaborate ?
    PVC

  • Change position of number sign in ALV (2-) into (-2). I will reward points.

    Hello Gurus, i need to change the position of the sign in a ALV list from the back of the number in the front of the number.
    eg. 2- i need it to be -2.
    Is there some way to do this without having to create a new field that is character type. I know the function CLOI_PUT_SIGN_IN_FRONT but it works only if my field is type char.
    Can anyone help ? I will reward points.

    In edit-mask you can force the position of the minus sign :
    USING EDIT MASK mask
    Effect
    Outputs f according to the formatting template mask.
    Without this addition, f is output in the standard format for that particular type or with a format defined in the ABAP Dictionary. The addition allows you to define a different format.
    You can specify the formatting template as follows:
    '_'represents one character of the field f
    or one digit with type P or I
    'V'only with fields of type P or I:
    output of leading sign
    'LL'at beginning of template:
    left justify (standard)
    'RR'at beginning of template:
    right justify
    '==conv'perform output conversion conv
    ':', ...separator
    (all other characters)
    Regards

  • Button for changing scaling of key figures in BEx?

    Hi everybody!
    Does anybody know if it is possible to create a button in BEx Analyzer for changing the scaling of all/certain key figures?
    Is it possible to use functions from the BEx API? I don't want to use Excel formulas like "divide by 1.000".
    Thanks in advance,
    Joerg

    Hi,
    you cannot  create button in Bex analyzer....infact you can change it's properties at the local view level once the query is run in the key figure properties when you execute the query thorugh bex analyzer....you canot put a buttin justto change the scaling factor...aslo you can change this at the ewb template level...if you run the query on the web.....
    Thanks
    Ajeet

  • Cumulative key figures

    what are non cumulative key figures?

    Hi,
    Cumulative Key Figure:
    Cumulative Values are Keyfigures for which Keyfigure Values are must posted in every time unit that reported on (= time period – specific Values).
    Example:
    Revenue
    Non Comulative key figure:
    Non – Cumulative Values are Keyfigures for which KeyFigures are only evaluated for selected time Periods.
    Cumulative Keyfigures With Exception Aggregation:
    It's a 'normal' KF (with summation, min or max as aggregation behaviour), but you set some exception in this behaviour...for example, you can say that a KF, normally aggregated by 'summation', have to show the max value (or the average, or '0' or something else), that is the 'exception aggregation' when you use it in combination with 0DOC_DATE (or other char), that is the 'exception aggregation char reference'...in this case OLAP processor give to you the possibility to see your KF with different behaviour depending from you use 0DOC_DATE (in our example, MAX) or something else (SUMMATION).
    Non – Cumulative keyfigure with Associated Single Delta:
    If you have a stock KF that is fed from only one (other) movement KF that can assume positive and negative sign.
    KF1 (initial) STOCK (non-***.) = 100
    KF2 flow = -30
    KF2 flow = 70
    KF1 (final) STOCK (non-***.) = 140
    Non-cumulative key figure with associated in and outflow:
    This is the case of 2LIS_03_BF KF stocks fields.
    Here, we have the same situation in point 2, but you will have not only ONE flow KF, but TWO, one dedicated to in and another one dedicated to out !
    You have to use this scenario if you have no KF that have positive and negative sign, but two KFs each one representing positive (in) and negative (out) logical sign!
    KF1 (initial) STOCK (non-***.) = 100
    KF2 (out))flow = 30
    KF3 (in)flow = 70
    KF1 (final) STOCK (non-***.) = 140
    Website Addresses For Non – Cumulative KeyFigures:
    http://help.sap.com/saphelp_nw04/helpdata/en/80/1a62dee07211d2acb80000e829fbfe/frameset.html
    http://help.sap.com/saphelp_nw04/helpdata/en/80/1a62dee07211d2acb80000e829fbfe/frameset.html
    http://help.sap.com/saphelp_nw04/helpdata/en/82/f2dc37f0f12313e10000009b38f8cf/content.html
    http://help.sap.com/saphelp_bw31/helpdata/en/82/f2dc37f0f12313e10000009b38f8cf/content.html
    http://help.sap.com/saphelp_erp2004/helpdata/en/d2/e0173f5ff48443e10000000a114084/content.html
    Re: Non-Cumulative keyfigure example
    Re: Types of non-cumulative keyfigures
    /community [original link is broken]
    http://help.sap.com/saphelp_bw32/helpdata/en/80/1a62dee07211d2acb80000e829fbfe/frameset.html
    /community [original link is broken]?forumID=131&threadID=29557&messageID=273049
    /community [original link is broken]?forumID=131&threadID=111914&messageID=1248243
    http://help.sap.com/saphelp_nw04/helpdata/en/80/1a62dee07211d2acb80000e829fbfe/frameset.html[/url]
    Thanks & Regards
    santo

  • Key Figure values in the Bex Report are different from the cube

    Hi all,
    When I tried to pull data of the cube, the values of the Key Figure 0Lotsize_cm was showing 100 EA. But when I try to run the query of the cube, then the key figure is LotSize is showing up as 500 EA. I don't understand why this is happening.
    When I checked for Aggregation in the Key Figure. It shows up as "Sum" under aggregation and "Last Value" under Exception aggregation.
    Could some one help me find a solution to this issue.
    I look forward to hearing from the experts.
    Regards,
    S.P

    Hi Arun and  Zegion,
    Thank you for your responses.
    Arun, I do not have any aggregates on the cube. I changed the aggregate properties of the Key Figure from SUM to Minimum. this has solved my problem temporarily.
    the reason I am saying temporarily because this is a SAP delivered InfoObject. This is for the datasource 0CO_PC_PCP_01. When I read through the documents, it said, SUMMation for Aggregation and Last value for "Exception Aggregation" will display the value of KF as the last value and does not add them up.
    Since this wasn't the happening in my query, I changed the Aggregation from SUM to Minimum.
    Regards,
    S.P

  • Key figure flag in the planning layout

    Hi,
    Can anyone explain the importance of the key figure flag in the planning layout?
    Regds
    Pavan.

    Hi Arun and  Zegion,
    Thank you for your responses.
    Arun, I do not have any aggregates on the cube. I changed the aggregate properties of the Key Figure from SUM to Minimum. this has solved my problem temporarily.
    the reason I am saying temporarily because this is a SAP delivered InfoObject. This is for the datasource 0CO_PC_PCP_01. When I read through the documents, it said, SUMMation for Aggregation and Last value for "Exception Aggregation" will display the value of KF as the last value and does not add them up.
    Since this wasn't the happening in my query, I changed the Aggregation from SUM to Minimum.
    Regards,
    S.P

  • Problem with Overwrite for Key Figures in ODS

    A bit of a long explanation, but the problem is not so complicated...
    We have an ODS containing contract line items.  Each line item has a key figure "Total Contract Target" that is marked with update type "overwrite".  We have modified the extractor that delivers data for this ODS so that the key figure is set to a value from the contract header.  Since we don't want the key figure to be duplicated if there are multiple line items on the contract, the user exit for the extractor modifies only the first line item delivered.
    For example, overall contract target value = 100.  Contract has 3 line items.  Contract target value for line item 1 is 100.  Target value for line item 2 and 3 is 0.
    This all works fine for initial loads, but there is a problem with the business content extractor for deltas.  Whenever a single change is made, it delivers three sets of  records.  Continuing the example, we would receive 9 records for the contract (3 sets of 3 line items).  Each of the three sets contains the same records.  Only the first set has the correct contract target value.  Since the ODS key figure is set to overwrite, our method of setting the total contract value in the first record doesn't work, because the extractor delivers duplicates so the duplicates overwrite the total with a 0.
    Would setting the key figure for total contract value to update type "additive" solve this? (I'm concerned that additions would be made if there were only a change to characteristics and not the key figure).  Thanks for your assistance.

    Since we ought to post solutions to problems we discover for people who search this forum...
    Solved this by modifying the customer exit for the extractor to set the key figure for the first contract line item encountered AND for all subsequent records with the same contract number / contract line item.  Since the key figure in the ODS is set to overwrite, this makes sure that the last record written doesn't overwrite the key figure with 0.

  • While transporting Key Figures from Dev to Quality system, error occured.

    Hello Experts,
    While transporting Key Figures from Development to Quality system, I am getting this error : " /BIC/AZPA1R_CT40-/BIC/ZPA1RBA10 (specify reference table AND reference
    field)".
    Here, I have changed the data type of the key figure from Number type to Amount type. Then I activated them, captured in request and when transported I got the error saying "/BIC/AZPA1R_CT40-/BIC/ZPA1RBAL9 (specify reference table AND reference field)"
    These Key Figures are used in ODS.
    Is there I am missing something, please tell how can I make these transports successfull.
    Thanks Ishdeep.

    While transporting Key Figures from Development to Quality system, I am getting this error : " /BIC/AZPA1R_CT40-/BIC/ZPA1RBA10 (specify reference table AND reference
    Yes you missed to transport reference object.
    Previously key figure data type is number then you have changed to Amount. While changing data type to amount You should maintain reference char  like 0currency, Doc_currency......in the Unit/currency tab. ( If you use fixed unit or currency no need to maintain any reference Object).
    During transpotation you need to collect this reference char with main key figure and then transport.
    With Regards,
    Kishore.

  • Samples of non-cumulative key figure

    hi experts,
    can u give me samples about:
    1> in what scenario should i use the non-***.Value change to create a non-cumulative key figure?
    Characteristic            : HEADCOUNT
    Aggregation               : (here chose sum?)
    Exception Aggregation:(here chose sumation?)
    Agg.Reference Char   : (here chose a 0calday?)
    N-*** with N-*** Value Change
           Non-***.Value Change: (here what to insert?)
    2> in what scenario should i use the inflow/outflow to create a non-cumulative key figure?
    Characteristic            : HEADCOUNT
    Aggregation               : (here chose sum?)
    Exception Aggregation:(here chose sumation?)
    Agg.Reference Char   : (here chose a 0calday?)
    N-*** with In- and Out-flow
                               Inflow  : (here what to insert?)
                               Outflow: (here what to insert?)

    hI
    1> in what scenario should i use the non-***.Value change to create a non-cumulative key figure?
    Characteristic : HEADCOUNT
    Aggregation :  sum
    Exception Aggregation: sumation
    Agg.Reference Char :  0calday-----* U CAN GIVE 0CALMONTH too to view head count month wise.*
    N-*** with N-*** Value Change
    Non-***.Value Change: * If u are maintaining delta value ie if no. of employees joined is 10 and resigned is 6, then delta value is 10-8=2*
    in this situation use this type.
    2> in what scenario should i use the inflow/outflow to create a non-cumulative key figure?
    Characteristic : HEADCOUNT
    Aggregation : sum
    Exception Aggregation: sumation
    Agg.Reference Char :  0calday
    N-*** with In- and Out-flow
    Inflow : *Inoobject which maintains no of employess joined *
    Outflow: *Inoobject which maintains no of employess resigned. *

  • Calculated Key Figures question

    Hi
    In a Purchase Order report I have included a Calculated Key Figures and this report is transported to the QA environment.
    Then I create another report using the same Calculated Key Figures but when I tried to save the query it gives me an error;
    "The query could not be saved due to a problem in transport"
    "BEx transport request 'BD1K900664' is not suitable or not available".
    I was told that when the 1st report uses that Calculated Key Figures and the report transported over to the QA I cannot reuse the same Calculated Key Figures in the new report. Is this true in SAP BI? If so how can I reuse the same Calculated Key Figures in a new report.

    Hello Lai,
    Once you have transported the earlier report along with the original calculated key figure, create one more request by selecting just the cal. key figure which you want to use.
    dont release this request.
    Now any change you make in the cal. key figure will be stored in this newly created request.
    also go ahead and create a new query using this ckf and save it in the newly created request.
    Then you can always release this and transport the same.
    hope this helps..
    let me know for any further issues...
    thanks,

  • Calculated Key Figures in IP FOX

    Hi,
    I would like to modify the calculated key figures using custom Formula planning fuction (FOX). Can some one let me know how to change these calculated key figures from BEx.
    I have found a thread discussing the same topic.
    Business Planning
    So do we have to definitely create a key figure in real time cube to be able to change the values in BEx calculated key figure.
    this is only for simulation purpose based on some key figure values and not for storing values in the cube.
    Regards
    Bhav

    Hi,
    If I understood correctly, you are asking why we have that "planning" tab in the properties of Calc KFs also? I think its just that the properties tab for all KFs is the same (no special customizing for any kind of KF), but it obviously doesn't make sense to set planning properties for calc KFs.

  • Remove scaling factor from key figure - still shows in Report !

    Hi all,
    A key figure we use somehow had its scaling factor set to 100.
    This was accidental, so I have changed the key figure to have no scaling factor and then activated it.
    The query that uses this key figure still sees it as having the 100 scaling factor however.  While this is the case, I cannot set it to no scaling factor as needed.
    I have tried adding this key figure to a new report and it still comes in with the incorrect scaling factor setting.
    So far I have tried,
    Changed the scaling factor on the key figure to none and activated.
    Regenerated the query through rsrt
    Removing the key figure from the query and then readding as well as adding the key figure to a entirely new report. Incorrect scaling setting still comes through in both cases.
    Checked table RSDIKYFPRO and RSDKYF - both of which have no scaling as their settings for this key figure.
    I know that I could created a restricted key figure in the query from the original and set the scaling factor to none to get around the problem, however I would like the query to see the settings in the key figure.
    Can anyone suggest how I can resolve this ?
    Many thanks,
    Blair

    Was there ever a solution to this problem? I, too, have noticed the same issue. The key figure properties (in my case, # of decimal places) is not inherited in the query, and the only solution was to change the kf properties directly in the query, which I shouldn't have to do. The selection of decimal places "from key figure (0)" does not work; I have to override this and select "0". Anyone seen any notes or anything to fix this?
    Thanks.
    Rachel

Maybe you are looking for