Custom Exit for determining previous-year time range

Dear all:
I have a problem about custom exit:
We have created a new object for combining Fiscal Year/Month and Period. So the format will be shown as " yyyymmp"
now we have one requirement which is determining the same period but previous year based on user input. For Example, if user input start and end period as
"2006041" and "2006111". There are should be 2 custom exit which are able to convert the user input to be "2005041" and "2005111". We created 2 custom exit for telling the previous-year period.
Then based on this converted time range, we should be able to extract applicable data. But after testing, we cant get supposing result. The code is following:
We will be very grateful for any input. thank you all so much
Calculate (Start)previous year/month/period by current
*year/month/period
*user-entry calendar year/month/period
WHEN 'ZFACLV19'.
      LOOP AT i_t_var_range INTO loc_var_range
      WHERE vnam = 'ZFACYMP1'.
        CLEAR l_s_range.
        LOC_YEAR = LOC_VAR_RANGE-LOW(4).
        LOC_MONTH = LOC_VAR_RANGE-LOW+4(2).
          LOC_YEAR = LOC_YEAR - 1.
        L_S_RANGE-LOW(4) = LOC_YEAR.
        L_S_RANGE-LOW+4(2) = LOC_MONTH.
        L_S_RANGE-LOW6(1) = LOC_VAR_RANGE-LOW6(1).
        l_s_range-sign = 'I'.
        l_s_range-opt = 'EQ'.
        APPEND l_s_range TO e_t_range.
        EXIT.
      ENDLOOP.
Calculate (End)previous year/month/period by current
*year/month/period
*user-entry calendar year/month/period
WHEN 'ZFACLV20'.
break ab_william.
      LOOP AT i_t_var_range INTO loc_var_range
      WHERE vnam = 'ZFACYMP2'.
        CLEAR l_s_range.
        LOC_YEAR = LOC_VAR_RANGE-LOW(4).
        LOC_MONTH = LOC_VAR_RANGE-LOW+4(2).
          LOC_YEAR = LOC_YEAR - 1.
        L_S_RANGE-LOW(4) = LOC_YEAR.
        L_S_RANGE-LOW+4(2) = LOC_MONTH.
        L_S_RANGE-LOW6(1) = LOC_VAR_RANGE-LOW6(1).
        l_s_range-sign = 'I'.
        l_s_range-opt = 'EQ'.
        APPEND l_s_range TO e_t_range.
        EXIT.
      ENDLOOP.
SzuFen

Hi,
Try with following modifications:
ZYEAR1(4) = LOC_VAR_RANGE-LOW(4).
ZYEAR1(4) = ZYEAR1(4)- 1.
ZMONTH1(2) = LOC_VAR_RANGE-LOW+4(2).
CONCATENATE ZYEAR1(4) ZMONTH1(2) INTO LOC_VAR_RANGE-LOW(6).
With rgds,
Anil Kumar Sharma .P

Similar Messages

  • Customer exit for Batch management

    Hi experts,
    I'm using customer exit for batch management for internal number assignment.
    I need the Batch number as i mentioned below 
    DDMMYYB01
    DD-Date
    MM-Month
    YY-Year
    B-Block
    01-Number
    For this i need to give logic. How to give i'm not getting. This batch number creation will come at the time of GR.
    Anybody help me?
    Naren

    Hi
    Please use the user exit SAPLV01Z as I mentioned in your other thread, please go to SMOD to read its documentstion.
    In SMOD, select the 'Documentation' and click 'Display', this will show the overview documentation.
    Select the 'Componnet', then ciick the 'Display'. select each component and click 'Documentation Ctrl+F4) this will show the detailed documentation of them.
    Best Regards.
    Leon.

  • Customer Exit for Calendar Month based on the day (system Date)

    Hello,
    I need help in creating a customer exit for Calendar month without the user input. The logic is as follows:
    For the BEx variable created with customer exit option and no user input:
    If the day on the system date falls in between 1 to 14 take the calendar year/month value as previous month.
    If the day on the system date falls in between 15 through 31 then take the calendar year/month as current month.
    eg if report is run on March 24th2009 the calendar year/month variable should be calculated as 03/2009 (March 2009)
    if the report is run on March 1st2009 the calendar year/month should be calculated as 02/2009 (Feb 2009).
    The code should be effective when run in the first 15 days of Jan when the previous month would contain the previous year as well.
    Thank You
    Srishti

    Thanks Shanthi. I am trying to incorporate the logic when the query is run in beginning of Jan when the year should be the previous year.Following is the code.please let me know if it would work. Is there a way I can test it as well?
    CASE I_VNAM.
    WHEN 'ZCURCALMON'.
    IF i_step = 2.
    data: mm(2),
            dd(2),
            yy(4),
            FM(6).
    if sy-datum+4(2) EQ 1.
    sy-datum(4) = sy-datum(4) - 1.
    else.
    sy-datum(4) = sy-datum(4).
    endif.
    if sy-datum+6(2) LE 15.
      mm = sy-datum+4(2) - 1.
      concatenate sy-datum(4) mm into FM.
    else.
      concatenate sy-datum(4) sy-datum+4(2)  into FM.
    endif.
    l_s_range-low = FM.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    append l_s_range to e_t_range.
    Endif.
    ENDCASE.
    Thanks
    Srishti

  • Customer Exit for 13 month from current month

    Hi Gurus,
    I need a customer exit for 13 months from current month. Based on the requirement I have written following code
    When 'VPI_13CALYRMON'.
        IF i_step = 1.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'BT'.
          l_s_range-low = sy-datum+0(6).
          l_s_range-high = sy-datum+0(6) + 13.
          append l_s_range to e_t_range.
        endif.
    Please could you guide me the code.
    Thanks
    Ganesh Reddy.

    Hi,
    I think you can do it in below way.
    When 'VPI_13CALYRMON'.
    IF i_step = 1.
    temp1 = sy-datum+0(4).
    temp1 = temp1 +1. (because adding 13 months would take year to next year)
    temp2 = sy-datum+4(2).
    temp2 = temp2 + 1. (after adding 13 months, the month would be one more than of previous year)
    concatenate temp1 temp2 into temp3.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'BT'.
    l_s_range-low = sy-datum+0(6).
    l_s_range-high = temp3.
    append l_s_range to e_t_range.
    endif.
    Hope this helps.

  • User Exits for FI transaction at time of 'Save'

    Hi All,
    I'm looking User Exits for the FI transaction - FBD1.
    I used CMOD to identify the user Exits available for the 'FBAS' package:
    F050S001 - FIDCMT, FIDCC1, FIDCC2: Edit user-defined IDoc segment   
    F050S002 - FIDCC1: Change IDoc/do not send                          
    F050S003 - FIDCC2: Change IDoc/do not send                          
    F050S004 - FIDCMT, FIDCC1, FIDCC2: Change outbound IDoc/do not send 
    F050S005 - FIDCMT, FIDCC1, FIDCC2 Inbound IDoc: Change FI document  
    F050S006 - FI Outgoing IDoc: Reset Clearing in FI Document          
    F050S007 - FIDCCH Outbound: Influence on IDoc for Document Change   
    F180A001 - Balance Sheet Adjustment                                 
    FARC0002 - Additional Checks for Archiving MM Vendor Master Data    
    RFAVIS01 - Customer Exit for Changing Payment Advice Segment Text   
    RFEPOS00 - Line item display: Checking of selection conditions      
    RFKORIEX - Automatic correspondence                                 
    SAPLF051 - Workflow for FI (pre-capture, release for payment)       
    However I'm looking for an user exit that is called at the time of 'Save'. I'm looking to make some changes
    so that no entry can be posted in the above transactions until a document has been attached. None of the User exits above seem to be available at the time of 'Save'.
    Is there any OSS note for a User Exit/BADI that can be used at the time of 'Save' for these transactions?
    Thanks in advance..
    Deepika.

    Hi Deepika,
      for your requirement you can use FI substitutions (entire document). Check transaction GGB1. They allow to change fields from FI tables (BKPF,BSEG,BSIK,BSAK, etc...)
    Please remember to reward points if the answer is useful and eventually to close the post if it solves your problem.
    Regards, Manuel

  • How to find CUSTOMER EXIT for a Standard SAP program

    How to find CUSTOMER EXIT for a Standard SAP program

    Hi
    To introduce the techniques of enhancement in standard SAP system. SAP creates customer exits for specific programs, screens, and menus within standard R/3 applications. These exits do not contain any functionality. Instead, the customer exits act as hooks. You can hang your own add-on functionality onto these hooks.
    They do not affect standard SAP source code.
    When you add new functionality to your SAP System using SAP’s exits, you do not alter the source code of standard SAP programs in any way. The code and screens you create are encapsulated as separate objects. These customer objects are linked to standard applications, but exist separately from SAP’s standard software package.
    They do not affect software updates.
    When you add new functionality to your SAP System using SAP’s exits, your objects (called customer objects) must adhere to strict naming conventions. When it comes time to upgrade a to a new software release, customer objects’ names ensure that they will not be affected by any changes or new additions to the standard software package.
    Customer exits are not available for all programs and screens found in the SAP System.
    Any change made to an SAP object in a customer system is called a modification. Customers usually modify their systems for one of two reasons. Either they make changes to the SAP standard in order to adjust the R/3 System to their specific business needs (actual modifications), or they alter individual SAP objects in order to correct an error (as recommended in an SAP error note).
    You should only modify the SAP standard if the modifications you want to make are absolutely necessary for optimizing work flow in your company. Be aware that good background knowledge of application structure and flow are important prerequisites for deciding what kind of modifications to make and how these modifications should be designed.
    SAP application programmers create SAP enhancements in transaction SMOD using function module exits, menu exits, and screen exits.
    Customers are given a catalog containing an overview of existing SAP enhancements. They can then combine the SAP enhancements they want into an enhancement project using transaction CMOD.
    SAP enhancements are made up of component parts. These components include function module exits, menu exits, and screen exits. A specific component may be used only once in a single SAP enhancement (this guarantees the uniqueness of SAP enhancements).
    Customer enhancement projects consist of SAP enhancements. Each individual SAP enhancement may be used only once in a single customer enhancement program (this guarantees the uniqueness of a customer project).
    SAP application programmers preplan function module exits, menu exits, and screen exits for their applications and combine them to create useful enhancements for the R/3 System.
    Customers create their own enhancement projects for their systems using SAP enhancements. You can customize the individual components of an enhancement project by creating your own include programs (for function module exits), texts (for menu exits), and subscreens (for screen exits).

  • How to find the customer exits for a particular transaction

    hi
    how to find the customer exits for a particular transaction

    Hi jyothsna vankadari ,
    ther is a convenient way to find all BADIS called. You may know that BADIS are the newer version of EXITs.
    I would suggest you to go for BADI.
    Follow the below steps to find out what all BADI's are called when you press any button in any transaction.
    1) Goto se24 (Display class cl_exithandler)
    2) Double click on the method GET_INSTANCE.
    3) Put a break point at Line no.25 (CASE sy-subrc).
    Now
    4) Execute SAP standard transaction
    5) Press the required button for which you need to write an exit logic, the execution will stop at the break point.
    6) Check the values of variable 'exit_name', it will give you the BADI name called at that time.
    7) This way you will find all the BADIs called on click of any button in any transaction.
    Regards,
    Clemens

  • Customer Exit for 15 month from current month

    Hi Gurus,
    I have a requirement to write customer exit for 15 months from current month based on todays day.
    if current day is less than 10 then we have to get 15 months from current month other wise from next month to 15 months.
    this exit I am writing on calendar year/month.
    Please assist for logic.
    Thanks
    Ganesh Reddy.

    I hope this code will do the trick.
    DATA: L_S_RANGE TYPE RSR_S_RANGESID,
    LOC_VAR_RANGE LIKE RRRANGEEXIT,
    zcalmonth(6) type c.
    zcurrentmonth(6) type c.
    zyear(4) type n,
    znextyear(4) type n,
    zyear1(4) type c,
    znextyear1(4) type c,
    zmonth(2) type n,
    zmonth1(2) type n,
    zmonth2(2) type c,
    zmonth3(2) type n,
    zmonth4(2) type c,
    IF i_step = 2.
    CASE i_vnam.
    WHEN '<VARNAME>'.
    zyear = sy-datum+0(4).
    znextyear = zyear + 1.
    zyear1 = zyear.
    znextyear1 = zlastyear.
    zmonth = sy-datum+4(2).
    if sy-datum+6(2) LE 10.
    zmonth1 = zmonth + 2.
    if zmonth1 GT 12.
    zmonth1 = zmonth1 - 12.
    zmonth2 = zmonth1.
    zcurrentmonth = sy-datum+0(6).
    endif
    concatenate znextyear1 zmonth2 into zcalmonth.
    else.
    zmonth1 = zmonth + 3.
    ZMONTH3 = ZMONTH + 1.
    if zmonth1 GT 12.
    zmonth1 = zmonth1 - 12.
    zmonth2 = zmonth1.
    endif
    if zmonth3 GT 12.
    zmonth3 = zmonth3 - 12.
    zmonth4 = zmonth3.
    endif
    concatenate znextyear1 zmonth2 into zcalmonth.
    concatenate znextyear1 zmonth4 into zcurrentmonth.
    endif.
    l_s_range-low = zcurrentmonth.
    l_s_range-high = zcalmonth.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'BT'.
    APPEND l_s_range TO e_t_range.
    ENDIF.
    ENDIF.
    rgds, Ghuru

  • How to select data from an aggregate in a customer exit for a query?

    Hi,
    I have written a virtual key figure customer exit for a query. Earlier the selection was from the cube, where there was severe performance issue. So I have created an aggregate, activated and have loaded the data.
    Now when I select that data I find that the Key table is different in development and production. How do I resolve this.
    My code is attached below. The table in developemnt is KEY_100027 and in production is KEY_100004. This code is activated and running in BW development server.
    SELECT
        F~KEY_1000041 AS K____035
         F~KEY_1000271 AS K____035
         F~QUANT_B AS K____051
         F~VALUE_LC AS K____052
    INTO (xdoc_date, xval1, xqty1)
    UP TO 1 ROWS
    FROM
    FROM
    */BIC/E100004 AS F JOIN
    /BIC/E100027 AS F JOIN
    /BIC/DZMM_CGRNU AS DU
    ON FKEY_ZMM_CGRNU = DUDIMID
    JOIN /BI0/SUNIT AS S1
    ON  DUSID_0BASE_UOM = S1SID
    JOIN /BI0/SCURRENCY AS S2
    ON DUSID_0LOC_CURRCY = S2SID
    JOIN /BI0/SMATERIAL AS S3
    *ON FKEY_1000042 = S3SID
    ON FKEY_1000272 = S3SID
    JOIN /BI0/SMOVETYPE AS S4
    *ON FKEY_1000043 = S4SID
    ON FKEY_1000273 = S4SID
    JOIN /BI0/SPLANT AS S5
    *ON FKEY_1000044 = S5SID
    ON FKEY_1000274 = S5SID
    JOIN /BIC/D100004P AS DP
    *ON FKEY_100004P = DPDIMID
    ON FKEY_100027P = DPDIMID
    WHERE
    WHERE
    ( ( ( ( F~KEY_1000041 BETWEEN 20051230 AND 20060630  ) ) AND  ( (
    ( ( ( ( F~KEY_1000271 BETWEEN 20051230 AND 20060630  ) ) AND  ( (
             S3~MATERIAL = <l_0material> ) ) AND  ( (
                s2~movetype BETWEEN '101' AND '102' OR
             s4~movetype BETWEEN '921' AND '922' OR
             s4~movetype BETWEEN '105' AND '106' OR
             s4~movetype BETWEEN '701' AND '701' OR
             s4~movetype BETWEEN '632' AND '632' ) ) AND  ( (
             S5~PLANT = <l_0plant> ) ) AND  ( (
             DP~SID_0RECORDTP = 0  ) ) ) )
    GROUP BY
        ORDER BY F~KEY_1000271 DESCENDING.
          IF sy-subrc NE 0.
            EXIT.
          ENDIF.
        ENDSELECT.
    How do I transport the code and make it work?
    Whats the reason that the two key fields are different.
    I had transported the aggregate from development to production. Activated it and filled the data.
    What is the way out? Please help.
    Regards,
    Annie.

    Hi Sonu,
    The main task is to move the contents of the one internal table to another with some condition.
    First sort and delete the duplicate entries from the First Internal table like below : 
    sort it_tab by material ascending date_modified descending.
    delete adjacent duplicates from it_tab.
    Then move that Internal table contents to another internal table.
    Define another internal table with the same structure as you have first internal table and then
    Second Step :
    it_itab1 = it_itab.
    If you are using seperate Header line and Body then you can do like below :
           it_itab1[] = it_itab[].
    This will fix the issue.
    Please let me know if you need any further explonation.
    Regards,
    Kittu
    Edited by: Kittu on Apr 24, 2009 12:21 PM

  • Giving error while creating a sales contact for the previous year (2008)

    Hi Friends,
    We are currently with SP12. When we try to create a sales contract for the previous year it is giving error like "Schedule line is for the item 100 cannot be after the order's latest delivery date".
    i tried debugging and found that that there is a rule created for this (in SP12). I commented the rule and tried to create a contract but, again got an error "Error while saving". This error I can't catch while debugging.
    I even didn't find where the schedule line date and header cancel dates are set so that I can change the dates manually.
    If any one has any idea, kindly help me.
    Best regards,
    Swarna Seeta

    Hi Wolfhard,
    Thanks for the reply.
    You are right and I have uncommented the line which assigns true to the return value and the contract got saved now.
    Thank you so much.
    I just want to know whether commeting this rule effects any of the functionalities of the sales contract.
    Best regards,
    Swarna Seeta

  • Problem in creating include program for customer exit for BC425_01

    Hi,
         I want to write a customer exit for transaction BC425_01. For identifying the include program for exit , i go to System->Status.There I double click on the program name(GUI).Then I perform a 'FIND' in main program for 'customer-function' keyword. I get 3 search results with "CALL CUSTOMER-FUNCTION '001' " , "CALL CUSTOMER-FUNCTION '002' " , "CALL CUSTOMER-FUNCTION '003' ".
    Now i double click on CALL CUSTOMER-FUNCTION '001'  and i am taken to the code of program where this function is called in MODULE cust_check INPUT. I double click on CALL CUSTOMER-FUNCTION '001'  and then I am taken to the function module code which contains a single statement 'INCLUDE ZXBC425G01U01 .' .
    Now I double click on this include program so that I can write my own code. But when i double click on it , a message displayed 'Program names ZX.. are reserved for includes of exit function groups'. Hence I am not able to creates this include program and write my coding.
    Kindly Help
    THANKS

    Hi Amber,
    Then you click enter button.It is asking to create object with that include name ZXBC425G01U01 in a pop-up.You  should select YES option.It will ask package . Give the package name and save.Then include program is created and allowed you to write your own code.
    Thanks,
    Prasad GVK.

  • How to Write a CUstomer Exit for a variable in BEx

    Hi,
    How to write a customer exit variable in bex Query designer
    Do i need developers key for this (If so what type of key do i need so that i can ask basis tean to generate)
    Info Object: ZEXP_DTE (Expiry Date)
    Variable on ZEXP_DTE :
    ZEDTE
    Type: Customer Exit
    Can any one please tell me how to write a code in CMOD from this (Step-by Step)
    Expiry Date > Current Cal Day
    As arun said
    'l_s_range-low = SY-DATUM.
    l_s_range-opt = 'I'.
    l_s_range-sign = 'GT'.
    APPEND l_s_range TO e_t_range.'
    I want to insert the above code for the above customer exit but as i am new to BW as  ABAP please explain me what are the steps involved in CMOD
    Thanks

    Hi,
    To write customer exit for a variable, you require Access key.
    Contact your BASIS to get that.
    Access Key,BASIS?
    To write Customer exit,
    User Exits
    User Exit for Variable
    /thread/809285 [original link is broken]
    Hope these helps u...
    Regards,
    KK.

  • How to find out query name in customer exit for variables

    We use the same customer exit variable in different queries. In the customer exit we want to find out, which query has called the customer exit. With the technical query name we want to read a master data table entry.
    e.g. If we come from query ZG1_TEST1 we want to use selection sel1
    Query name  |  selection
    ZG1_TEST1   |  sel1
    ZG1_TEST2   |  sel2  
    How can we find out the query name in the customer exit for variables?
    Thanks for your help,
    Evi

    Hi Evi,
    check out the structure I_S_RKB1D in your exit. It contains the query.
    Siggi

  • Customer exit for IDOC_INPUT_SALESORDER_CREATEFR

    Hi All,
          I am doing the salesorder creation through IDOC_INPUT_SALESORDER_CREATEFR but i couldn't find any customer exit in this. I am in version 4.7.
    Can anyone tell me if you find any user exit for this
    Regards,

    Hi,
    There are no customer exits for this particular FM I suppose.
    If you require to modify you need to customize it and do the necessary changes.
    Regards,
    Sharath

  • How to create customer exit for characteristic variables and for text vars.

    hi friends,
      can anybody tell me how to create customer exit for characteristic variables and for text variables in bw ides system.
    thanks,
    sree

    Hi,
    Please have a look at:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f1a7e790-0201-0010-0a8d-f08a4662562d
    Krzys

Maybe you are looking for