Customer exit for calweek is not working

Hi,
I have written a customer exit to derive calweek from a calday. But its not displaying the correct value.
Can u please let me know if there is any error in the code.  The return value for calweek is a single value.
CASE I_VNAM.
WHEN 'zfclweek'.
DATA : zday like sy-datum.
IF I_STEP = 2.
      LOOP AT I_T_VAR_RANGE INTO L_S_VAR
      WHERE VNAM = 'ZFCLDAY'. ((ZFCLDAY  is also a customer exit to derive date and its working fine )
ENDLOOP.
        zday = L_S_VAR-LOW .
        zday = zday + 1.  ( i need week of the next day of ZFCLDAY )
CALL FUNCTION 'DATE_GET_WEEK'
        EXPORTING
          DATE               = zday
       IMPORTING
          WEEK               = xweek
      EXCEPTIONS
       DATE_INVALID       = 1
OTHERS             = 2
      IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      l_s_range-low  = xweek.
      l_s_range-sign = 'I'.
      l_s_range-opt  = 'EQ'.
      append l_s_range to e_t_range.
exit.
    endif.
    clear l_s_range.
    clear zday.
    clear xweek.
endcase.

Hi,
  I have changed my code as follows. But when i run the report its showing, "variable contains invalid values :
please do me the needful.
CASE I_VNAM.
WHEN 'zfcweek'.   " it is a customer exit variable on calweek
IF I_STEP = 2.
LOOP AT I_T_VAR_RANGE INTO L_S_VAR
WHERE VNAM = '0fper'.    " curent fiscal period
endloop.
YEAR = L_S_VAR-LOW+0(4) .
        PER = L_S_VAR-LOW+4(3).
        IF per = 01.
             per = 12.
             year = year - 1.
         else.
        PER = PER - 1.
        endif.
        CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'   " need to calculate first day of last fiscal period
          EXPORTING
            I_GJAHR              =  YEAR
            I_PERIV              = 'Z1'
            I_POPER              = PER
  I_MONMIT             = 00
         IMPORTING
           E_DATE               =   FDAY.
EXCEPTIONS
  INPUT_FALSE          = 1
  T009_NOTFOUND        = 2
  T009B_NOTFOUND       = 3
  OTHERS               = 4
        IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CALL FUNCTION 'DATE_GET_WEEK'                  " to calculate the calweek of the first day of last fiscal period
        EXPORTING
          DATE               = FDAY
       IMPORTING
          WEEK               = xweek
       EXCEPTIONS
         DATE_INVALID       = 1
OTHERS             = 2
      IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      l_s_range-low  = xweek .
      l_s_range-sign = 'I'.
      l_s_range-opt  = 'EQ'.
      append l_s_range to e_t_range.
    endif.
    clear l_s_range.
    clear year.
    clear fday.
    clear per.
endcase.

Similar Messages

  • Customer Exit variable of Query not working in View

    Hi,
    I have a customer exit variable in my query to calculate the last 6 month period on Calendar month. I have used 0CMONTH for the same and then using offset of 6 on its value range to get it.
    Now, I have many views based on this query, which should ideally be having the same filter condition for the calendar month, but it is not happening. Although, it is working fine for the query! The views do not seem to be catching the selection correct.

    Hi there,
    As far as I Know, yes they exist. The only difference here, is that you build a query with a selection screen, and  you execute the query with some selection parameters, and therefore all customer exit variables, offsets, etc, will be read and changed at the runtime execution of the query, and you can rearrange your query visualization drilling down free char., making filters, etc. and storing that visualization in a view.
    If you save your view and execute it afterwards, you'll get the same selection parameters to input, the same offsets, etc, that you have with the query, but with a visualization stored by you.
    So that should have been working.
    Diogo.

  • Customer Exit - APOSC002 in APO not working as desired

    Hi Experts,
    Customer Exit - APOSC002 (function module EXIT_/SAPAPO/SAPLVCRM_002)
    Development logic is set in such a way that for a specific route (Maintained in transaction ZSC01), the departure calendar and Duration calendar is being filled to the fields CT_DURAS- TSTRID_DEP and CT_DURAS- TSTRID respectively.
    However the departure calendar is not taken into account when the departure date is calculated in the APO availability check.
    I have checked the exit and the values are filling correctly. But still the issue remains.
    If any of you has worked in this exit before, let me know how to resolve this?
    Thanks,
    Dinesh.

    Hi there,
    As far as I Know, yes they exist. The only difference here, is that you build a query with a selection screen, and  you execute the query with some selection parameters, and therefore all customer exit variables, offsets, etc, will be read and changed at the runtime execution of the query, and you can rearrange your query visualization drilling down free char., making filters, etc. and storing that visualization in a view.
    If you save your view and execute it afterwards, you'll get the same selection parameters to input, the same offsets, etc, that you have with the query, but with a visualization stored by you.
    So that should have been working.
    Diogo.

  • Customer Exit  ---  Select statement is not working

    Hi All,
             I am working on Master Data Text Datasource customer exit. Reading only restricted records using select statement if it is valid then those records move into I_T_DATA. If not they are not going to read.
           I have written the following code .
    Data : ls_rotextstr2 TYPE ROTEXTSTR2. '' Extrct Struct Name
    *&Assigning  values language and chart of accounts to variables
    Data : lc_zspras     TYPE SKAT-SPRAS VALUE 'E',
           lc_Zktopl     TYPE SKAT-KTOPL VALUE 'GCOA',
           lc_zsaknr     TYPE SKAT-SAKNR.
    LOOP AT I_T_DATA INTO ls_rotextstr2.
    gi_tabix = SY-TABIX.
    SELECT SINGLE SPRAS KTOPL SAKNR FROM SKAT INTO
    (lc_zspras, lc_Zktopl, lc_zsaknr)
    WHERE SPRAS = lc_zspras
    AND   KTOPL = lc_Zktopl.
    IF SY-SUBRC EQ 0.
    MODIFY I_T_DATA FROM ls_rotextstr2.
    ENDIF.
    ENDLOOP.
    Here select statement reading all records like other than 'EN" and 'GCOA' and  going to Subrc condition.
    Please some one take a look at the programme and tell me where I am making mistake. I just want the records that are language = 'EN' and Chart of Accounts = 'GCOA'.
    Your suggestions are very help full to me,
    Thanks
    Ganesh.

    Hi,
    Apply the following changes :
    Data : ls_rotextstr2 TYPE ROTEXTSTR2. '' Extrct Struct Name
    Data : lc_zspras TYPE SKAT-SPRAS VALUE 'E',
    lc_Zktopl TYPE SKAT-KTOPL VALUE 'GCOA',
    lc_zsaknr TYPE SKAT-SAKNR.
    LOOP AT I_T_DATA INTO ls_rotextstr2.
    gi_tabix = SY-TABIX.
    SELECT SINGLE SPRAS KTOPL SAKNR FROM SKAT INTO
    (lc_zspras, lc_Zktopl, lc_zsaknr)
    WHERE SPRAS = lc_zspras
    AND KTOPL = lc_Zktopl.
    IF SY-SUBRC NE 0.
    DELETE I_T_DATA INDEX gi_tabix.
    CONTINUE.
    ENDIF.
    ENDLOOP.
    hope it works...
    regards,
    Raju

  • Cp8 pc, action 'exit' (for close app), not work for iphone app

    i found bug,
    when you use the action 'exit' on pc( it work well).
    but on iphone, it not work

    action "cpCmdExit" , it not work for iphone.

  • 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 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

  • 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.

  • 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.

  • 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

  • Content enrichment service for SP 2013 not working

    Content enrichment service for SP 2013 not working
    Not able to debug content enrichment service.. Can you please specify the steps for debugging the content enrichment service
    Any help will be greatly appreciated.
    Regards
    BKPA
    BKPA

    Hi ,
    Please see the following articles, run and debug service with breakpoints using F5 from VS, then register the custom content enrichment service with DebugMode and long Timeout to SharePoint, then start a full crawl to call the web service.
    http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2014/04/08/how-to-use-the-sharepoint-2013-content-enrichment-web-service.aspx
    http://www.jeanpaulva.com/index.php/2014/05/21/content-enrichment-web-service/
    http://msdn.microsoft.com/en-us/library/office/jj163968(v=office.15).aspx#content_enrichment_configuration
    http://www.blendmaster.net/blog/2012/09/using-content-enrichment-web-service-callout-in-sharepoint-2013-preview/
    Thanks,
    Daniel Yang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]
    Daniel Yang
    TechNet Community Support

  • (fn+F2 and fn+F3) for brightness are not working

    (fn+F2 and fn+F3) for brightness are not working, while the other function working properly... help me plz
    DJanoon

    What is the product number?
    Did anything change before this started happening?
    Power the system on and press F10 about once a second to get into BIOS.  Once you are in BIOS, go to the configuration tab (typically next to last tab) and set Action Keys to enabled.  Save the changes, exit, and the system should reboot automatically.  Test the brightness keys wihtout pressing the Fn key.  I suspect they will not work in this state, but I want to rule out the possibilities while awaiting the product number.
    ↙-----------How do I give Kudos?| How do I mark a post as Solved? ----------------↓

  • Customized strings in iPad viewer not working?

    Hello,
    per request of client i've tried to change one string in viewer for iPad. So i've created template in DSP App Builder, modified this template on my computer, choose this file in App Builder and prepared another build (V28). Unfortunately, i still see old original string (i've double tested that i'm downloading new version of app). When i now check DPS App Builder, it just says "Asset stored on server", so i asume, that everything goes smoothly on this side.
    Any similar experience with customized strings?
    Thanks
    Martin

    Everything was done from scratch with V28.
    1. 10. 2013 v 16:14, Bob Bringhurst <[email protected]>:
    Re: Customized strings in iPad viewer not working?
    created by Bob Bringhurst in Digital Publishing Suite - View the full discussion
    That's odd. It worked for me when I tested it. Perhaps you should try moving the current xml file to a different folder, downloading a new version, copying and pasting, and rebuilding.
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5728130#5728130
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5728130#5728130
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5728130#5728130. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Digital Publishing Suite at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • F4 help for 0MAT_SALES is not working in BI 7

    Hi Gurus,
    The F4 help for 0MAT_SALES is not working when distibution channel is selected as (!=02) in Bex Analyzer. But for all other values for distibution channel  i am getting values in F4 help.
    Since 02 is excluded it is supposed to give values for all other combination. but it not so.
    Could anyone of you please help me on this?
    Thanks in advance.

    Closing Thread

  • Short key for copy does not work all the time now.

    After I have installed the latest OSX - Yosemite, my short key for copy does not work all the time.  It is infrequent how it works. I'm using the same keyboard that I have always used, my wireless logitech keyboard for mac.  Please help.

    I've plugged in my default mac keyboard and the short key copy still does not work.

Maybe you are looking for

  • Error while invoking renderPDFForm with attachment

    hi, I'm using ES4 renderPDFForm service to render pdf along with attachment. This service works if I dont have PDF attachment but doesn't work PDF with attachments. I'm sending the PDF attachment like below.      Map attachments = new Map();      Map

  • How to display newly added bookmarks on top of the list in Unsorted Bookmarks? (not in Bookmark Manager window)

    I have hundreds of bookmarks.The Bookmarks Toolbar is filled.I made a shortcut of the "Unsorted Bookmarks" folder and placed it in on the Bookmarks Toolbar.Whenever I click the star to add a bookmark, it adds one to the real Unsorted Bookmarks, which

  • Payment advise in german

    Hi now payment advise in english, user wants to generates in german language. how can change it and where can i changes it value points will be assigned thanks sunitha

  • Customer Consignment (MSKU)

    Hi All, I'm trying to find the customer consignment quantity at the end of a period and the table MSKU has some data regarding this. |--------------------------------------------------------| | MATNR    | WERKS  | KUNNR      | LFGJA | LFMON | KULAB |

  • Get parent path

    How do i get the parent path of my java applicaiton? I see something called getRealPath() but that's for servlets.