Ranges in function module

HI All,
  how can we use ranges in function module.
please send sample code for this.
regards,
amit.

Hi,
If you have range, you can convert the contents of ranges into internal table.
And then Pass the internal table to FM.
Thanks,
Sriram Ponna.

Similar Messages

  • Export RANGES to function module

    Can anyone tell, how to pass RANGES to function module.
    i have report program in ,
    DATA : BEGIN OF ITAB OCCURS 0,
               MATNR LIKE MARA-MATNR,
              END OF ITAB.
    SELECT-OPTIONS  : S_MATNR FOR MARA-MATNR.
    I want all the values in S_MATNR in ITAB.
    Note that S_MATNR has any value( Include, Exclude,Between, Equal etc.)

    Hi,
    Define a type in the global data declaration of the function module as follows :
    TYPES : BEGIN OF t_range_matnr,
            sign(1) TYPE c,
            option(2) TYPE c,
            low TYPE mara-matnr,
            high TYPE mara-matnr,
    END OF t_range_werk.
    " Define a table type
    types matnr_tab type t_range_matnr occurs 0.
    Once done, define the importing parameter of t_matnr in the function modules signature, lets call it matnr
    In your program where you would call the function, lets say you have the select option as follows
    SELECT-OPTIONS matnr FOR ekpo-matnr.
    " In the call function simply pass matnr[]
    call function 'select_mara'
    exporting
       matnr = matnr[].
    Done.
    P.S. Do not forget the square brackets.
    regards,
    Advait
    Edited by: Advait Gode on Apr 16, 2009 10:05 AM

  • How to import a range in Function module?

    I am using a Function module in which material is getting imported.
    In the import tab we have
    Parameter Name    Typing     Associated Type       optional          pass value
    IM_MATERIAL       TYPE       MATNR                 <checked>         <checked>
    So when the Function module is execute we can enter only one value into the IM_MATERIAL.
    But now it has to be enhanced for entering multiple values. How to import the material as a range?
    Please throw light.
    Thanks.

    Hi
    If you are using a select-options you can use this approach.
    TABLES: MARA.
    DATA: RANGE TYPE WRF_MATNR_RANG_TTY.
    SELECT-OPTIONS: SO_MATNR FOR MARA-MATNR.
    START-OF-SELECTION.
      RANGE[] = SO_MATNR[].
    CALL FUNCTION 'ZTEST'
    EXPORTING
       I_RANGE       = RANGE.
    Where I_RANGE is defined using this table type WRF_MATNR_RANG_TTY
    Parameter Name    Typing     Associated Type     optional          pass value
    I_RANGE       TYPE       WRF_MATNR_RANG_TTY      <checked>     <checked>

  • Date range in function module

    Hi guys,
                 i have a selection screen where i need to give range of date.
    say from 01.01.1998 to 01.02.2007.
    i need to pass this date range to 'Z' funtion module how can i do it.
    do i need to define it in tables declaration. if yes what will be the reference type of this field.
    I want this range of dates in function module.
    Please explain.

    Hi ahmed
           Let us assume s_date is the select option for the date range defined like  
           DATA: s_date for p0001-begda.
           Now while calling the FM pass the s_date-low and s_date-high as 2 parameters for the FM.In the FM create 2 parameters begda and endda of type begda. Use the low value and high value in the FM to populate the range table and u can use this range table for further processing of the dates in the FM.The range table can be forwarded as follows:
    r_date-low = begda.
    r_date-high = endda.
    also provide the sign and options for the ranges table.

  • Help in ABAP function module coding.

    Hi,
    i am having trouble coding the program where i have to select a number from the table and add one to it to create a new record back to the table.  example, i've select 1 from the table, i need the program to be able to return 2 and create a new record back into the table and the next time i generate the program, i will select 2 and create a 3 into the table. It needed to be a custom function module as i need to call it in another function module which would concatenate the generated number with some words..
    i'm very new to abap programing...so could anyone please provide a detailed on how i could code it...
    THANKS alot in advance!!!!

    Hi Lessy,
    i have done the same requirement where my sequence number will automatically get incremented by 1 as new record cames for update.as already discussed you have to cretae the numebr range and call the number range by function module 'Number_get_next'.
    PFB the code which will definitely help you.
    CALL FUNCTION 'NUMBER_GET_NEXT'
            EXPORTING
              NR_RANGE_NR                   = '01'  " specify this number this is
    *the same when you cretae numberrange  have specified.
              OBJECT                        = 'ZSEQNUM'    " This the number range
    *i have created
           IMPORTING
             NUMBER                         = wa_msg-seqnr
           EXCEPTIONS
             INTERVAL_NOT_FOUND            = 1
             NUMBER_RANGE_NOT_INTERN       = 2
             OBJECT_NOT_FOUND              = 3
             QUANTITY_IS_0                 = 4
             QUANTITY_IS_NOT_1             = 5
             INTERVAL_OVERFLOW             = 6
             BUFFER_OVERFLOW               = 7
             OTHERS                        = 8.
          modify lt_message FROM wa_msg TRANSPORTING seqnr.
    to cretete number range.
    goto transaction SNRO
    enter the name,short text, give the number length domain (char10 or what ever is your domain)
    click on number range and cretae interval.
    give the number , from number and to number.
    this number you have to give in FM also (i have given '01').
    hope this will help you.for any problem revert back
    thanks
    Tanmaya
    Code Formatted by: Alvaro Tejada Galindo on Jan 13, 2010 4:16 PM
    Edited by: Rob Burbank on Jan 13, 2010 5:20 PM

  • Select options passed to function module

    Hey
    I would like to know how r the select-options of a program passed to the function module that is called internally in that program? I want to use this select-options in the function module to fetch frm the database tables?
    Shakr

    Hi,
    Use ranges in function modules. You can declare in import/export/ changing or tables parameters
    Example of ranges:
    ERDAT_RAN
    ERDAT_RAN
    SHP_R_ERZET
    RVBELN
    ERNAM_RAN
    Please see them in se11.
    Pass the select options in the report to these ranges or use below coding:
    DATA: wa_cmfre     LIKE     erdat_ran,
          wa_erdat     LIKE     erdat_ran,
          wa_erzet     LIKE     shp_r_erzet,
          wa_vbeln     LIKE     rvbeln,
          wa_ernam     LIKE     ernam_ran.
    SELECT-OPTIONS: s_erdat FOR vbak-erdat,                  s_erzet FOR vbak-erzet NO-EXTENSION,  
    s_cmfre FOR vbak-cmfre OBLIGATORY ,
    s_vbeln FOR vbak-vbeln NO-EXTENSION,         
    s_auart FOR vbak-auart OBLIGATORY,                           s_bsark FOR vbak-bsark.
      wa_cmfre-sign    = s_cmfre-sign.
      wa_cmfre-option  = s_cmfre-option.
      wa_cmfre-low     = s_cmfre-low.
      wa_cmfre-high    = s_cmfre-high.
      IF NOT s_erdat[] IS INITIAL.
        wa_erdat-sign   =  s_erdat-sign.
        wa_erdat-option =  s_erdat-option.
        wa_erdat-low    =  s_erdat-low.
        wa_erdat-high   =  s_erdat-high.
      ENDIF.
      IF NOT s_erzet[] IS INITIAL.
        wa_erzet-sign   =  s_erzet-sign.
        wa_erzet-option =  s_erzet-option.
        wa_erzet-low    =  s_erzet-low.
        wa_erzet-high   =  s_erzet-high.
      ENDIF.
      IF NOT s_vbeln[] IS INITIAL.
        wa_vbeln-sign   =  s_vbeln-sign.
        wa_vbeln-option =  s_vbeln-option.
        wa_vbeln-low    =  s_vbeln-low.
        wa_vbeln-high   =  s_vbeln-high.
      ENDIF.
      IF NOT s_ernam[] IS INITIAL.
        wa_ernam-sign   =  s_ernam-sign.
        wa_ernam-option =  s_ernam-option.
        wa_ernam-low    =  s_ernam-low.
        wa_ernam-high   =  s_ernam-high.
      ENDIF.
    you can pass these work areas to function module.
    Thanks,
    Shravan G.

  • Function Module for getting Number ranges between two number

    Hi guys,
    Is there any Function module which provide us the number range between two numbers?
    For Ex:If i give 1 and 10 to FM it must give me 1
    2
    3
    4.....upto 10.
    is there any FM for doing this,but i'm not able to find exact Fm for same.
    I can write small piece of code for getting number ranges, but if i get FM it could save little work.

    Hi
    But why do u need a fm, can't you do it by yourself?
    DATA: FROM_NUMBER TYPE I VALUE 1,
          TO_NUMBER   TYPE I VALUE 15.
    DATA: NUMBER            TYPE I.
    DATA: BEGIN OF T_NUMBER OCCURS 0,
                  NR TYPE I,
              END    OF T_NUMBER.
    NUMBER = FROM_NUMBER.
    DO.
      IF NUMBER <= TO_NUMBER.
        T_NUMBER-NR = NUMBER.
        APPEND T_NUMBER.
      ELSE.
        EXIT.
      ENDIF.
      NUMBER = NUMBER + 1.
    ENDDO.
    LOOP AT T_NUMBER.
      WRITE: / T_NUMBER-NR.
    ENDLOOP.
    Max

  • Function module for getting periods for date range

    Hi,
    Can anybody tell me the function module which will return the periods along with the year, when we give a date range.
    e.g
    01011999 to 120112000
    so it shoud return peroids between these date with year. Its possible thru programatically, but i m checking if there is any FM, so i can use FM.
    Thanks,

    Hi,
    You can use function module which works exactly what you are expecting FIMA_DAYS_AND_MONTHS_AND_YEARS.
    please reward points to useful answers.
    Thanks,
    Sriram Ponna.

  • 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 to Compare Date within date Range

    Hi All,
            Does anyone know Function Module to Compare Date within date Range...For example i need to find whether 08/02/2006 falls in between 07/15/2006 and 09/15/2006......

    data: datum type sy-datum value '20070802',
          datum_low type sy-datum  value '20070730',
          datum_high type sy-datum value '20070930'.
    If datum between datum_low and datum_high.
    Endif.
    Regards,
    Rich Heilman

  • Function module to calculate no of days between two date ranges

    hi experts,
    can some one please suggest a function module that can calculate no of days between specified date range.
    for example : if i enter date range between 26.02.2011 to 20.05.2011, then it should calculate no of days between these dates.
    Moderator message : Basic date questions not allowed. Read forum rules before posting. Thread locked.
    Edited by: Vinod Kumar on May 25, 2011 10:57 AM

    Hi,
    Please search SDN.. there are lots of posts for teh same.
    [http://wiki.sdn.sap.com/wiki/display/ABAP/FunctionModulerelatedonDate+calculations]

  • Function Module which will take Wekk No & Return date range (from & To dat)

    Hello everyone,
    I need a Function Module which will take Week No as an input Parameter & return me the date range
    (From date & To date of that week) .
    Thanks in advance!
    Cheers!
    Moderator message: date calculation questions = FAQ, please search before posting.
    Edited by: Thomas Zloch on Nov 2, 2010 5:25 PM

    Hi,
         Please write the below logic..
    data : v_date11 type sy-datum,
              monday    type sy-datum,
              sunday  type sy-datum,
              v_count1 type i .
    *v_count1 = 20 * 7.            "   Say U want details for 20th week , or give a parameter for week and multiply with 7*
    v_date11 = '20100101'.     "   take the starting day of the year ....
    v_date11 = v_date11 + v_count1.   " add to the date
    CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'   <-- call this FM
    EXPORTING
       DATE          = v_date11
    IMPORTING
      WEEK          = WEEK
       MONDAY        = MONDAY <-- will have the week starting day
       SUNDAY        = SUNDAY
    Regards,
    Srini.

  • Ranges as export parameter in function modules

    hi guys
    i have to design a function module in such a way that i have to pass a ranges table.
    watt structure or type should i use?
    thanks
    sameer

    Define your range in the datadictionary and then use this type for the changing or exporting parameters.
    In SE11 define a structure of table type.  From the edit menu choose define as ranges table.  After this you may input the field for the high\low data element.  input the name and create the structure:
    Example range table for VKBUR.
    create ZRT_VKBUR as structure (table)
    Input  VKBUR as data element for high/low and input zrl_vkbur in structure row type.  Save and then click on the create button for ZRL_VKBUR which will create a standard range table line definition.

  • Function module find date Range input for scheduling a job

    hi i have created a program for scheduling a back ground job for  purchase order extract in that i have to get the last 7 days records when i schedule it on every sunday can any one tell me the function module which satisfies the requirment
    Date Range input in my program to be calculated for past 7 days from current date (ie from Sunday to Saturday of the week.)

    Hi,
    You can do it simply by
           v_cdate TYPE sy-datum,    " current system date
           v_cdate = sy-datum - 7.         " take date 7 days before current date
    Pass this  v_cdate in your logic
    Hope it will help you.
    Thanks
    Arun Kayal

  • Function Module for separating a date range into days

    Hi all,
    Does anyone know if there is a function module which gives back the list of days when we give a date range as input parameter to the function module. For example, we enter the range 10.07.2006 - 13.07.2006 and the function module gives back a table  in form 10.07.2006, 11.07.2006, 12.07.2006, 13.07.2006.
    Thanks,
    Sükrü

    Hi suekrue,
    1. Exactly for this purpose,
       i have written an
       INDEPENDENT FORM (subroutine)
      wherein we pass
       a) fromdate
       b) todate
       c) ITAB
    2. and it gives all the dates in the internal table.
    3. just copy paste
    4.
    data :  itab type table of sy-datum with header line.
    parameters : fromdate type sy-datum default '20060701'.
    parameters : todate type sy-datum default sy-datum.
    perform getdays tables itab using fromdate todate.
    break-point.
    FORM
    form getdays
    tables itab
    using fromdate todate.
      data : curdate type sy-datum.
      curdate = fromdate.
      do.
        if curdate > todate.
          exit.
        endif.
        itab = curdate.
        append itab.
        curdate =  curdate + 1.
      enddo.
    endform.                    "getdays
    regards,
    amit m.

Maybe you are looking for

  • Siri no longer functions with ios 6.1

    I have an iphone4s that I just upgraded the IOS from 6.01 to 6.1 and Siri no longer functions.   It just freezes at "what can I help you with" and never does anything or it indicates by voice that there is a problem.   Cell WIFI and local WIFI are fu

  • How to do a restore that saves my files and photos on a k330 thinkcente​r win 8.1

    The computer came with windows home premium I upgraded it to windows 78 then windows 8.1 When I tried to restore it it asks for a source disk I offerred it the lenovo windows 7 drivers pac v2.5 and the windows 8 discs both are 64 bit by the way ..no

  • APP - Custom program created with smart forms

    Hi Experts, In the automatic payment program, the ABAPer has created a custom program for payment methods for check. The program is assigned in the payment method for country in the payment program. However went the APP is run we are unable to genera

  • Iterative query to fetch from one column and insert/update in another colum

    i have a table with 5 columns as shown below Devicedetails userid ip deviceid makeby makedate 123 100.00.20.11 | 00002011 xyz 10/11/2009 456 102.03.21.12 | 02032112 def 11/12/2009 678 null 02032112 def 11/12/2009 896 111.22.33.44 02032112 def 11/12/2

  • Élément Organiser refuse de démarrer depuis l'écran de bienvenue de PE 12

    Elément Organiser refuse de démarrer depuis l'écran de bienvenue de Première element 12. J'ai eu le même probléme avec PSE12 qui a été résolu en le démarrant systématiquement depuis la barre des taches. Je n'ai pas réussi à récupèrer l'écran de bienv