Function module required to subtract month from a date

I have a date field..
In that I want to subtract some months..
Date1 = 27.05.2007
Month = 3 months
Date2 = 27.02.2007
Help me to proceed this logic with function module.
...What is the function module to get this liogic.

Hi,
I don't think any FM available for your purposes.
But you can try something like this.
DATA: BEGIN OF ITAB OCCURS 0,
        SPMON TYPE UMC_Y_VALIDFR,
      END OF ITAB.
PARAMETERS PSPMON TYPE UMC_Y_VALIDFR DEFAULT '2007004'.
START-OF-SELECTION.
  ITAB-SPMON = PSPMON.
  DO 12 TIMES.
    IF ITAB-SPMON+4(3) = '000'.
      ITAB-SPMON+4(3) = '012'.
      ITAB-SPMON(4) = ITAB-SPMON(4) - 1.
    ENDIF.
    APPEND ITAB.
    ITAB-SPMON = ITAB-SPMON - 1.
  ENDDO.
  READ TABLE ITAB INDEX 12.
  WRITE: / ITAB-SPMON.
Kishi.

Similar Messages

  • Subtracting months from current date

    how to subtract months from current date in mysql

    You are in an Oracle forum, so the Oracle answer is: use add_months(sysdate,-2) to subtract two months from the current date.
    Regards,
    Rob.

  • Function Module to get planned Quantity from posting date

    hi,
    i need one function module which takes plant and posting date date as an input parameter and get the Planned quantity for that range of that ...i dont want to fetch it from material since the report is run for the whole plant(werks).so it has got a lot of data entries so i need a function for that...
    is there any function module which will fetch this data ...
    Edited by: sonal musale on Jun 23, 2008 3:53 PM

    Hi,
    I have also the same problem. Any solution you have for this one?
    Thanks,
    Raymond

  • Function Module for calculating NEXT MONTH's start date and End date

    Hi Friends,
    I want a function module which could calculate the next months start date and end date...
    Say my input will be like 01.01.2006(start date) it should return
    01.02.2006 and 28.02.2006...
    IS there any FM for this ... or how to go about this scenario ???
    thanks in advance
    Cheers,
    R.Kripa

    Hi kripa,
    1. There is no DIRECT Way.
    2. We have to do in 2 steps.
    3. See this code (just copy paste in new program)
       U can use its FORM anywhere in your program,
       for getting the desired dates.
    4.
    REPORT abc.
    DATA : sdate TYPE sy-datum,
           edate TYPE sy-datum.
    PARAMETERS : dt TYPE sy-datum DEFAULT sy-datum.
    PERFORM getdt USING dt sdate edate.
    WRITE :/ sdate , edate.
    INDEPENDENT FORM
    FORM getdt USING orgdate stdate enddate.
      DATA : mydate TYPE sy-datum.
      CALL FUNCTION 'HR_PSD_DATES_ADD_MONTHS'
        EXPORTING
          v_date             = orgdate
          V_MONTHS           = 1
       IMPORTING
         E_DATE             = mydate
       EXCEPTIONS
         NOT_POSITIVE       = 1
         OTHERS             = 2
      CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
        EXPORTING
          iv_date             = mydate
        IMPORTING
          ev_month_begin_date = stdate
          ev_month_end_date   = enddate.
    ENDFORM.                    "getdt
    regards,
    amit m.

  • How to Add function modules to retrieve current month

    how to Add function modules to retrieve current month from TVARV variables (currently we have functions to do close month).

    Hi
    Double click on the CODE for the line..
    SET PF-STATUS 'XYZ'.
    It will open the Menu Painter (SE41). Click on the Function Keys Tree Node and And assign the
    Function Keys and Function codes for the Menu Items.
    Hope this would help you.
    Murthy

  • Function module to get the month name when start date and end date given

    Hey Experts,
                       I am creating a employee bonus report. In this report each and every employee's month wise working days have to be calculated and displayed in the report. I need to find a function module which helps me split the given dates into that particular month. Please help me with the same.
    Regards,
    G. Shankar

    Hi Shankar,
    I think there are two Function Modules.
    First One is 'HR_RU_MONTH_NAME_IN_GENITIVE' in this u need to pass month number and for that u have extract month number from date.
    And Second One is 'ISP_GET_MONTH_NAME' in this u need to pass date or month number, it directly accepts date.
    Check this two and let me know.
    Cheers,
    Parth Parikh

  • Any function module to transfer File(Excel)  from Appli Serveto Unix Server

    Hi all,
    Do you have any function module to transfer excel file from application server to Unix server.
    Can anyone have some sample code for the same.
    Thanks in Advance.
    Sreedhar Marri

    Hi,
            There is no function module ,instead use open dataset command.
    Syntax example,
    data: e_file like rlgrap-filename.
    data : txtstr type string.
    concatenate  searchpoints-dirname '/scm/' werks '/' filnam into e_file.
      open dataset e_file for output in text mode encoding default.
    loop at itab.
        concatenate itab ',' into txtstr.
         transfer txtstr to e_file.
      endloop.
    where itab is the contents u want to transfer.
    Pls check for required authorisations with ur BASIS for open dataset command.
    Regards,
    Balakumar.G.

  • Function Module required for getting Value Range data

    I need a function module where in i can get the data from a value range in a domain.
    Message was edited by:
            Gurpreet Singh

    Hi,
    You can use this code to get the Doman's fixed values.
    DATA:  lt_fixed_values     TYPE ddfixvalues,
      CALL METHOD cl_abap_typedescr=>describe_by_name
        EXPORTING
          p_data      = 'Domain_name' " Pass the domain name here
        RECEIVING
          p_descr_ref = lcl_abap_typedescr.
      TRY.
          lcl_abap_elemdescr ?= lcl_abap_typedescr.
        CATCH cx_sy_move_cast_error.
      ENDTRY.
      IF lcl_abap_elemdescr IS BOUND.
        CALL METHOD lcl_abap_elemdescr->get_ddic_fixed_values
          EXPORTING
            p_langu        = sy-langu " Give the language
          RECEIVING
            p_fixed_values = lt_fixed_values " This table will have the fixed values
          EXCEPTIONS
            not_found      = 1
            no_ddic_type   = 2
            OTHERS         = 3.
      ENDIF.
    Regards,
    Sesh

  • Function module required for time stamp conversion into MST

    Hello,
    Please let me know if there is a SAP function module that can convert timestamp from GMT or provided timestamp into MST. I will need to use this function in BW transformation.
    Thanks.

    Try this one: TZ_GLOBAL_TO_LOCAL.
    Haven't used it myself yet, but it looks good.
    Good luck!
    Best regards,
    Zhou

  • Function Module for Translation of text from Lower to Upper Case

    Hi All,
    Can any one give me function module for translation of text from lower to upper case.
    If we use Translate statement for the program in the Extended Syntax check it is giving error.
    Thanks in advance.
    Regards,
    srinivas

    Hi Srinivas,
    You can use any of the Function Modules below.
    AIPC_CONVERT_TO_UPPERCASE
    2054_TRANSLATE_2_UPPERCASE
    HR_99S_CONV_UPPER_CASE
    Please reward if useful.
    regards,
    Raj

  • Functional module to Copy measurement points from one equipment to another

    HI,
    Please give some body function module to Copy measurement points from one equipment to another which is not assign to functional location.

    To Copy Measuring Points from one equipment to another , Go to transaction IE10 and copy all the relevant data that need to be copied Check the measuring point check box, it would copy the characteristic for measuring point to the newly created equipment and would create a system generated number for the measuring point. Both the measuring points would have the same characteristics and if they are attached to each other in a hierarchy then the measurement document readings could also be transferred from one measuring point to another.. You could use the following Function Module "EQUIPMENT_COPY" to copy the measuring point from one equipment to another if equipment has already been created.
    Regards...
    Edited by: Usman Kahoot on Jun 9, 2010 2:37 PM

  • SSF function module to disable pop window but OTF data is not coming.

    Hi Experts,
    My requirement is to get the PDF from the SSF function module and email it and i don want to display the pop option
    I passed these parameters
    1.no_dialog = c_x.
    2.-preview = c_x.
    3.-no_open   = c_x.--|
    4.no_close  = c_x.---| if i add these two conditions i don get printer pop up but i don get the data for " job_output_info  " also.
    to this function module ,
    Please tell me how to get data into " job_output_info "  import parameter by not displaying the pop up for printer.
    Thanks and Regards in advance.

    Hello,
    we did it using the following code.
    DATA: w_ctrlop TYPE  SSFCTRLOP,
            w_return TYPE  SSFCRESCL.
      DATA ls_job_output_info TYPE ssfcrescl.
      DATA p_pdf_len          TYPE i.
      DATA pt_tlines          TYPE TABLE OF tline.
    (function_name is the name of the smartform)
    W_CTRLOP-GETOTF = 'X'.
    W_CTRLOP-NO_DIALOG = 'X'.
        CALL FUNCTION function_name
          EXPORTING
            CONTROL_PARAMETERS         = W_CTRLOP
            USER_SETTINGS              = 'X'
         IMPORTING
            JOB_OUTPUT_INFO            = ls_job_output_info
          EXCEPTIONS
            FORMATTING_ERROR           = 1
            INTERNAL_ERROR             = 2
            SEND_ERROR                 = 3
            USER_CANCELED              = 4
          OTHERS                       = 5.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        REFRESH pt_tlines.
        CLEAR:  p_pdf_len.
        CALL FUNCTION 'CONVERT_OTF'
         EXPORTING
            FORMAT                      = 'PDF'
         IMPORTING
            BIN_FILESIZE                = p_pdf_len
          TABLES
            OTF                         = ls_job_output_info-otfdata
            LINES                       = pt_tlines
         EXCEPTIONS
           err_max_linewidth           = 1
           err_format                  = 2
           err_conv_not_possible       = 3
           err_bad_otf                 = 4
           OTHERS                      = 5.
        IF sy-subrc <> 0.
        ENDIF.
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
           bin_filesize                    = p_pdf_len
           filename                        = p_filename
           filetype                        = 'BIN'
          TABLES
            data_tab                        = pt_tlines
         EXCEPTIONS
           file_write_error                = 1
           no_batch                        = 2
           gui_refuse_filetransfer         = 3
           invalid_type                    = 4
           no_authority                    = 5
           unknown_error                   = 6
           header_not_allowed              = 7
           separator_not_allowed           = 8
           filesize_not_allowed            = 9
           header_too_long                 = 10
           dp_error_create                 = 11
           dp_error_send                   = 12
           dp_error_write                  = 13
           unknown_dp_error                = 14
           access_denied                   = 15
           dp_out_of_memory                = 16
           disk_full                       = 17
           dp_timeout                      = 18
           file_not_found                  = 19
           dataprovider_exception          = 20
           control_flush_error             = 21
           OTHERS                          = 22.
        IF sy-subrc <> 0.
          MESSAGE s614(zef) DISPLAY LIKE 'E'.
      ENDIF.

  • Function module reqd for fiscal period using current date

    Hi,
    Is there any function module which gives fiscal period using current date.
    Thnaks,
    Maheedhar

    Hi Maheedhar,
    Try the code below.
    CALL FUNCTION 'GET_CURRENT_YEAR'
      EXPORTING
        BUKRS         = '1000'     " Company Code
        DATE          = SY-DATUM   " Date to find fiscal year for
      IMPORTING
        CURRM         = w_currm    " Current Fiscal Month
        CURRY         = w_curry    " Current Fiscal Year
        PREVM         = w_prevm    " Previous Fiscal Month
        PREVY         = w_prevy.   " Previous Fiscal Year
    Regards,
    Amit.

  • For a function module how can I find its assigned data source name?

    Hi BW Gurus,
    If i know the data source name then the  assigned fn. module/Table/Infoset I could find from RSO2. But for function module How do I know its assigned data source name?
    Thanks a lot for the response.
    Regards
    Ven

    Hi Ram,
    In SE16, enter the table name as ROOSOURCE and in contents choose field EXTRACTOR for selection and enter the name of the function module.
    It will return the list of datasources where the function module has been used.
    Best Regards,
    Ankit Agrawal

  • How to get name of the month from current date.

    Hi,
       How to get the name of the month from current date.
    Thanks,
    Senthil

    Sethil,
    Use your date(let us say Date1) instead of sy-datum.
    CALL FUNCTION 'MONTH_NAMES_GET'
    EXPORTING
    LANGUAGE = SY-LANGU
    IMPORTING
    RETURN_CODE =
    TABLES
    MONTH_NAMES = itab_month
    EXCEPTIONS
    MONTH_NAMES_NOT_FOUND = 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.
    READ TABLE itab_month
    WITH KEY MNR = date1+4(2).
    itab_month-LTX will contain the value you are looking for
    Good luck
    Raghava

Maybe you are looking for

  • Can I have two itunes accounts on my pc? I have one account on the computer and the second on a portable back up.

    Can I have two Itunes accounts on one pc? One is on our PC now, and I have another on a portable back up. I hope I can.......thanks.

  • Urgent PO short fall information

    Hi all, Here suppose i create one PO of 10 Quantity. And i received 5 quantity of it. Now there is short fall. Vendor is not going to deliver rest 5 quantity. Here i want to close PO in Short fall. So i will go to ME22N and in Delivery Tab i will sel

  • Strange recurring event on calendar

    I have a recurring event on the 2nd or 3rd day of each month on the calendar of my iphone - "Enjoy the music. Charge ipod". I don't know where this came from and I can't get rid of it. Edit is not available if I select it. Does anyone know what this

  • Unable to login webmail after enable SSL

    Dear Sun, After i enable ssl on our webserver which hosting our office communication express, i was unable to login ce and the link seem so weird. But after i disable the ssl, every thing become normal. The ssl cert is from the CA. after i enable the

  • INIT output problems

    After recent update I got these problems: https://bugs.archlinux.org/task/23121?p - pened=8457 Does anyone also have 'em?