Function module for select-options

Hi Colleagues !
Is there any function module to read select-options fields in a window ?
Thanks a lot and kind regards
Peter

Hi
I had this requirement as well, I came up with a workaround....
I ended up creating a Z structure EG. ZRANGESTRUC with the fields:
SIGN - CHAR1
ZOPTION - CHAR2
LOW - CHAR18
HIGH - CHAR18 (this would depend on your maximum length of field)
I had to make a ZOPTION field because option was a reserved system field.
I then declare tables in my function module pointing at ZRANGESTRUC data type.
Inside your function module declare ranges and then simply say S_MATNR[]  =  ZSTRUC_MATNR[] and then use the standard range inside your select statement.
I hope I understood your requirement correctly...
Edited by: Brad Gorlicki on Feb 10, 2010 9:36 PM

Similar Messages

  • Standard function modules for selection from vbak/vbup/ekko/ekpo

    hi experts ,
    do you know if there is an existing standard function modules for selection from vbak/vbup/ekko/ekpo.
    please help

    Hi,
    for VBAK
    ADSPCM_READ_VBAK               Read VBAK (with SPEC2KM-data)
    PRS_GET_GLOBAL_VBAK            Get global structure VBAK
    Regards,
    Jyothi CH.
    Edited by: Jyothi Chinnabathuni on Feb 23, 2009 2:46 PM

  • Function modules for selection ID of Demand planning

    Hello All,
    I need a function module which can return product / location combinations associated with a selection ID.
    OR, a function module which can return me 1) Planning book 2) data view and 3) Version associated with a selection ID.
    For the second case I have checked FM /SAPAPO/MCPSH_SELECTION_GET , however this function module is returning version and planning book only. But I also need dataview associated with the selection ID.
    Kindly Help.
    Thanks & Regards,
    Vivek

    Hi Vivek,
    I am not sure about the FM but, you can play with /sapapo/ts_sekpo (Item Selection Variants) and /SAPAPO/TS_SELKO (Header Selection Variants) table to get the infromation you need. First table will give you details and based on that selection profile GUID you can find PB/DV.
    Hope this helps.
    Regards,
    Hashil Desai

  • Dynamic select / function module for select queries

    Hello experts,
    Is there any function module to build dynamic select queries and also to build standard select queries .
    Thanks,
    krishnakumar

    What are you meaning by 'to build' ???
    BR, JAcek
    Message was edited by: Jacek Slowikowski

  • Function Module for selecting date by day

    Is there any function module to choose date by day. for example if I give today's date the FM should give me next thursday's date.
    Thanks
    Tharani

    this works good........
    *& Report  YCHATEST                                                    *
    REPORT  YCHATEST
    data:day like DTRESR-WEEKDAY.
    parameters:curr_dat like sy-datum default sy-datum.
    CALL FUNCTION 'DATE_TO_DAY'
      EXPORTING
        DATE          = CURR_DAT
    IMPORTING
       WEEKDAY       = day.
    write : / day.
    case day.
    when 'Monday'.
       CURR_DAT = CURR_DAT + 3.
    when 'Tuesday'.
       CURR_DAT = CURR_DAT + 2.
    when 'Wed.'.
       CURR_DAT = CURR_DAT + 1.
    when 'Thursday'.
       CURR_DAT = CURR_DAT + 7.
    when 'Friday'.
       CURR_DAT = CURR_DAT + 6.
    when 'Sat.'.
       CURR_DAT = CURR_DAT + 5.
    when 'Sunday'.
       CURR_DAT = CURR_DAT + 4.
    endcase.
      write :/ CURR_DAT.

  • How to get calender in f4 help for select options in module pool (URGENT)

    Hi All,
    how to get calender in f4 help for select options in module pool
    Please help .
    Thanx in advance,
    amruta

    Hi Amruta,
    First of all, you can not create select-options directly in module pool.
    For creating <b>select-option is dialog prog</b> follow these steps:
    1. create your selection screen model as subscreen by:
    SELECTION-SCREEN BEGIN OF SCREEN 2000 AS SUBSCREEN.
    PARAMETRS: P_MATNR LIKE MARA-MATNR.
    SELECT-OPTIONS: S_BISMAT FOR MARA-BISMAT.
    SELECTION-SCREEN END OF SCREEN 2000.
    2. create a screen ( example 100 ) in your module-pool dedicated for selection-screen. on this screen layout sketch a sub-screen name like subscree_2000.
    3. write this bit of code in PBO and PAI of the screen 100;
    CALL SUBSCREEN SUBSCREEN_2000.
    4. include this code in PBO:
    INCLUDING SY-REPID '2000'
    6. write user_command of PAI, call screen which is going to executable after selection-screen.
    5. create a transcation for this dialog module pool with screen 100.
    6. execute this transaction and you can see it's behaving like cool with select-options.
    After that in [bprocee on value-request]</b>, use F4_DATE for both from and to option field.
    Hope it will solve the problem.
    Regards
    Krishnendu

  • Function module for multiple selection.

    Hi
    I have three parameters on selection screen 1. Process order number, 2.Order category and 3. order type.
    My requirement is:
    As i press F4 on order number and select one of the available orders, the other two fields should populate automatically with their correnponding values.
    Is there any Function module for this purpose?
    Thanks in advance,
    Alok

    Hi Alok..
    Check this FM:
    F4IF_INT_TABLE_VALUE_REQUEST
    This FM is used to dsiplay values stored in an internal table as input help.
    This FM is used to program our own custom help if no such input help exists in ABAP dictionary for a particular field.
    The parameter VALUE_TAB is used to pass the internal table containing input values.
    <b>The parameter RETFIELD is used to specify the internal table field whose value will be returned to the screen field or RETURN_TAB.
    </b>  
    If DYNPNR,DYNPPROG and DYNPROFIELD are specified than the user selection is passed to the screen field specified in the DYNPROFIELD. If RETURN_TAB is specified the selectionis returned in a table.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                RETFIELD           = field from int table whose value will be returned
                DYNPPROG        = SY-CPROG
                DYNPNR             = SY-DYNNR
                DYNPROFIELD    = 'screen field'
                VALUE_ORG       = 'S'
           TABLES
                VALUE_TAB        = internal table whose values will be shown.
                RETURN_TAB      = internal table of type DDSHRETVAL
           EXCEPTIONS
                parameter_error    = 1
                no_values_found   = 2
                others                  = 3.
    <b>reward if Helpful</b>

  • Function modules for the following

    Hi,
    I want to know the function modules for the following purposes.
    1) Check whether a date is valid or not
    2) Calculate the no of days between two dates.
    Expecting an early response.
    Thanks n Regards,
    Amit

    Hi,
    PARAMETERS: p_list LIKE t009b-bumon AS LISTBOX
                         VISIBLE LENGTH 11 OBLIGATORY ,
                p_list1 LIKE t009b-bdatj OBLIGATORY.
    SELECTION-SCREEN POSITION POS_HIGH.
    PARAMETERS: p_list2 LIKE t009b-bumon AS LISTBOX
                          VISIBLE LENGTH 11 OBLIGATORY,
                p_list3 LIKE t009b-bdatj OBLIGATORY.
    Calling Function Module for calculating no of days between the
    selected period
        CALL FUNCTION 'NUMBER_OF_DAYS_PER_MONTH_GET'
             EXPORTING
                  par_month = p_list
                  par_year  = p_list1
             IMPORTING
                  par_days  = ws_n_days.
        CALL FUNCTION 'NUMBER_OF_DAYS_PER_MONTH_GET'
             EXPORTING
                  par_month = p_list2
                  par_year  = p_list3
             IMPORTING
                  par_days  = ws_n_days1.
    For Concatenating the month and year into the date format
        CONCATENATE  p_list1  p_list ws_i INTO ws_c_date1.
        CONCATENATE p_list3  p_list2 ws_n_days1 INTO ws_c_date2.
      date = ws_c_date1 - ws_c_date2.
    In the above sample code the selection screen has month and year as input.
    Also check this link
    http://www.sapdevelopment.co.uk/tips/date/datehome.htm
    Check FM
    <b>RP_CALC_DATE_IN_INTERVAL</b> Add/subtract years/months/days from a date
    <b>SD_DATETIME_DIFFERENCE</b> Give the difference in Days and Time for 2 dates
    <b>Also for checking valid date:</b>
    U can specify the date field as
    Select-options:  s_date like likp-date(similar to ur requirement)
    This itself ceck for the valid date no seperate validation needed.
    Thanks & Regards,
    Judith.

  • Function Modules for Data and Time

    Hi all,
              I need 2 function modules for date and time. when we pass current data(sy-datum) and current time (sy-uzeit) into function modules, shoud get date in <b>dd/mm/yyyy or dd.mm.yyyy</b> and time in<b> HH:MM:SS</b> formats.
    Thanks in advance

    Hi Ranjith,
    i think this will b usefull for you..
    SAP Bar Chart Function Modules and what they are used for
    Function module
    Used for
    BARC_GRAPHIC_PBO
    Starting bar chart at PBO time, using a graphic profile (parameter PROFILE)
    BARC_GRAPHIC_PAI
    Analyzing data returned by the graphic
    BARC_SET_TIME_AXIS
    Setting start and end of time axis
    BARC_SET_OPTIONS
    Setting options
    BARC_ADD_CHART
    Creating a chart
    BARC_SET_CHART_ATTRIB
    Setting chart attributes
    BARC_ADD_SECTION
    Creating a section on the time axis
    BARC_SET_SECTION_ATTRIB
    Setting section attributes
    BARC_ADD_RIBBON
    Adding a ribbon to the time axis
    BARC_SET_RIBBON_ATTRIB
    Setting attributes for ribbons in the chart
    BARC_ADD_GRID
    Adding a time grid
    BARC_SET_GRID_ATTRIB
    Setting grid attributes
    BARC_ADD_LAYER
    Adding a layer (graphic elements)
    BARC_SET_LAYER_ATTRIB
    Setting layer attributes
    BARC_ADD_LINE
    Adding a line
    BARC_ADD_CALENDAR
    Creating a calendar
    BARC_SET_CALENDAR_ATTRIB
    Setting attributes for a calendar
    BARC_ADD_TIME_PROFILE
    Creating time profiles
    BARC_SET_TIME_PROFILE_ATTRIB
    Setting attributes for time profile
    BARC_ADD_INTERVAL
    Adding a time interval
    BARC_SET_INTERVAL_ATTRIB
    Setting time interval attributes
    BARC_ADD_TIME_OBJECT
    Creating a time object
    BARC_CONVERT_DATE
    Creating a date string in bar chart format
    BARC_REVERT_DATE
    Converting a date string in bar chart format to date and time
    BARC_ADD_DATELINE
    Creating a date line
    BARC_SET_DATELINE_ATTRIB
    Setting dateline attributes
    BARC_GET_PROFILE_CONTENTS
    Obtaining profile contents for customizing a chart
    BARC_GET_COLUMN_WIDTH
    Selecting new column width
    BARC_SET_COLUMN_WIDTH
    Setting the column width
    BARC_GET_TEXTINDEX
    Obtaining the text index of a field
    BARC_SET_LABELS
    Positioning the chart display
    BARC_SET_COLUMN_ATTRIB
    Setting column attributes
    BARC_SET_ROW_ATTRIB
    Setting row attributes
    BARC_SET_ROW_HEIGHT
    Setting the line height
    BARC_SET_MAXCHARTS
    Setting the maximum number of charts sent
    <b>If its usefull reward points
    </b>

  • Function Modules for time subtraction.

    Hello abapers..
    I want two function modules...
    1)  to subtract 1 hour from time and date.
    for eg if the date entered is 23.3.08 and time is 00:00:00
    then the function module should give the result as
    22.3.08 and 23:00:00.
    or if the date is 21.03.08 and time is 12:00:00.
    The result should be 21.03.08 and time 11:00:00.
    2) the second one is for validation..i am not sure if there is
    a function module for that.
    I want to validate whether the date entered by the user
    in the select option for type sy-datum is in the correct format.
    I mean the user should not enter anything except a date.
    For eg:
    If the user enters  97898jjjj then it should also invalidate this
    as well as if the user enters 34.07.08 then also the FM should invalidate this..
    Points will be rewarded for helpful answer.

    Try this
    DATA : diff TYPE i.
    PARAMETERS :
           iv_stime TYPE  t,
           iv_sdate TYPE  d,
           iv_atime TYPE  t.
    ev_endtime = iv_stime - iv_atime.
    diff = ev_endtime - iv_stime.
    IF diff > 0.
       ev_enddate = iv_sdate - 1.
    ELSE.
       ev_enddate = iv_sdate.
    ENDIF.
    WRITE : ev_endtime.
    WRITE : ev_enddate.

  • F4 help for select option

    HI ALL,
    please help me.
    i need to get f4 help for zlsch field, if i give only one company code its working fine , if u give 2 company codes its not working,even though i kept s_bukrs-high code.
    please help me
    its urgent
    s_bukrs  FOR lfb1-bukrs  no intervals OBLIGATORY,
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_zlsch-low.
    data : l_dyname type standard table of DYNPREAD with header line.
    l_dyname-FIELDNAME = 'S_BUKRS-LOW'.
    append l_dyname.
    l_dyname-FIELDNAME = 'S_BUKRS-HIGH'.
    append l_dyname.
    CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
    dyname = sy-cprog
    dynumb = sy-dynnr
    tables
    dynpfields = l_dyname
    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 s_bukrs.
    loop at l_dyname.
    s_bukrs-low = l_dyname-FIELDVALUE.
    s_bukrs-SIGN = 'I'.
    s_bukrs-OPTION = 'EQ'.
    append s_bukrs.
    endloop.
      SELECT zbukr
             zlsch
             FROM t042e
             INTO TABLE gt_t042e
             WHERE zbukr IN s_bukrs.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield               ='ZLSCH'
         dynpprog               = sy-cprog
         dynpnr                 = '1000' "sy-dynnr
         dynprofield            = 'S_ZLSCH'
      VALUE                  = '*'
         value_org              = 'S'
        TABLES
          value_tab              = gt_t042e
      RETURN_TAB             = return_tab
       EXCEPTIONS
         parameter_error        = 1
         no_values_found        = 2
         OTHERS                 = 3

    Hi,
    The code will not get executed for s_zlsch-high.
    Put the code in which you are using the function module for fetching the values in a PERFORM.
    Call this perform twice.
    Once for  s_zlsch-low and once for s_zlsch-high.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_zlsch-low.
    perform <perfname>.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_zlsch-high.
    perform <perfname>.
    Reward if helpful.
    Regards.

  • Any function module for  validation

    Hi,
    I am new to ABAP.
    Can any body tell me whether there is any built in function module for
    field validation.
    Thanks in advance
    Archana

    Hi,
    u can validate the field values using at selectiion-screen
    •     AT SELECTION-SCREEN
    When user enters the values in the fields of selection screen and clicks on execute button, this event gets triggered. This event is basically for checking the values entered by the user for the fields of the selection screen i.e., data validity checking. This event is for entire selection screen.  For example:
    You are accepting carrid, connid, fldate from user and you don’t want to proceed if user enters no value for carrid and fldate.  Using AT SELECTION-SCREEN can do this.
    Select-options: carrid1 for sflight-carrid,
              Connid1 for sflight-connid,
              F1date1 for sflight-f1date.
    AT SELECTION-SCREEN.
    If carrid1-low ne ‘  ’ and fldate1-low = ‘  ’.
        Error message.
    Endif.
    In this case, if both the fields are entered blank, then the user gets error message.
    Basically, this event is for many fields on selection screen.  Usually, it is for the fields which are logically related.
    •     AT SELECTION-SCREEN ON  <field>
    When you want to check for specific value of a field. For example, carrid should be in the range of ‘LH’ and ‘SQ’. This can be done in this event.  Basically, this event is for checking individual fields. You can have many AT selection-screen events in your program (i.e., for each field specified in the Select-Options).
    Select-Options carrid1 for sflight-carrid.
    AT SELECTION-SCREEN.
    If carrid1-low ne ‘LH’ and carrid1-high ne ‘SQ’.
       Error message.
    Endif.
    Here the system will not proceed on entering wrong values.
    Regards,
    Sruthi

  • Generic function module for delta - which FM ?

    Hi all,
    I want to create a custom generic datasource in R3 which uses a function module for delta extraction. This is straight forward for full extract (copy FM RSAX_BIW_GET_DATA_SIMPLE - I already did this and have a full extraction working to BW). However I need to extract delta - and the above function module does not have example code for that (I have seen some forum posts that it 'can' be used - but this looks like a pseudo get around where the delta field name is passed in I_T_SELECT).
    FM RSVD_BW_GET_DELTA_DATA seems to be an example code of a FM which can allow delta (i.e. manually codes how to fill date/time stamp information). However when I code this and try test in RSA3 it seems to try to populate the delta selection field before calling my function module! I need it to call my function and allow the function to specifiy the date criteria.
    Can anyone help with an example of how this should best  be done ?
    Or can it only be done in a pseudo form using 'RSAX_BIW_GET_DATA_SIMPLE' example FM.
    Note: I have setup the RSO2 datasource to allow delta.
    Also - I have spent several hours searching the forum - but please answer with a link if you think it does answer exactly this problem.
    Thanks for any help
    Martin

    Hi again,
    Have had a few requests for the code I used - I created a new custom function copied from 'RSAX_BIW_GET_DATA_SIMPLE'. AEDAT has been set as the delta date for this data source in transaction RSO2.
    Main sample code is -
    1. Code to receive selection criteria and store in internal ranges -
    FUNCTION zbw_sodetail_get_detail.                                   
    ""Global interface:                                               
    *"   IMPORTING                                                  
    *"       VALUE(I_REQUNR) TYPE  SRSC_S_IF_SIMPLE-REQUNR        
    *"       VALUE(I_DSOURCE) TYPE  SRSC_S_IF_SIMPLE-DSOURCE      
    *"       VALUE(I_MAXSIZE) TYPE  SRSC_S_IF_SIMPLE-MAXSIZE      
    *"       VALUE(I_INITFLAG) TYPE  SRSC_S_IF_SIMPLE-INITFLAG    
    *"       VALUE(I_READ_ONLY) TYPE  SRSC_S_IF_SIMPLE-READONLY   
    *"       TABLES                                                     
    *"              I_T_SELECT TYPE  SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL 
    *"              I_T_FIELDS TYPE  SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL 
    *"              E_T_DATA STRUCTURE  ZBW_SODETAIL OPTIONAL           
    *--- Sales order item create date                                      
       LOOP AT i_t_select INTO l_s_select WHERE fieldnm = 'ERDAT'.         
          MOVE-CORRESPONDING l_s_select TO r_erdat.                        
          APPEND r_erdat.                                                  
       ENDLOOP.                                                                               
    *--- Sales order item change date - DELTA only - auto filled before    
       this function is called.                                          
       C (Initialise Delta) - Low = blank, High = today - safety limit   
       D (Delta) - low = , High =   .       *from roosgendlm             
       LOOP AT i_t_select INTO l_s_select WHERE fieldnm = 'AEDAT'.         
          MOVE-CORRESPONDING l_s_select TO r_aedat.                        
          APPEND r_aedat.                                                  
       ENDLOOP.                                                                               
    2. Code to use selection criteria to get initial or delta. Note that for delta the delta date field to be used is automatically populated with the date of the last delta run (from table roosgendlm) -
       SELECT VBAK~KNUMV
              VBAPVBELN VBAPPOSNR VBAPMATNR VBAPARKTX VBAP~SPART
              VBAPWERKS VBAPERDAT VBAPAEDAT VBAPNETWR VBAP~WAERK
              VBAPABGRU VBAPZPROMISE VBAP~CUOBJ
              VBEP~EDATU
          INTO CORRESPONDING FIELDS OF TABLE ZBW_SODETAIL_ITAB
          FROM VBAK JOIN VBAP ON VBAKVBELN = VBAPVBELN
                    JOIN VBEP ON VBAPVBELN = VBEPVBELN
                             AND VBAPPOSNR = VBEPPOSNR
       WHERE VBAP~VBELN IN R_VBELN        "Order number
         AND VBAP~POSNR IN R_POSNR        "Order item number
         AND VBAP~ERDAT IN R_ERDAT        "Order item date created
        AND ( VBAP~ERDAT IN R_AEDAT OR   "Created date in      Delta range
                  VBAP~AEDAT IN R_AEDAT OR   "Order item change    Delta range
                  VBAK~AEDAT IN R_AEDAT ).   "Order header change  Delta range
    Note that if the data source is called in initial or full extract mode the delta change date (aedat) will automatically be blank.
    I have been using this successfully.
    I hope this helps
    Martin.

  • Sample Outbound Function Module for IDocs

    Hello All,
    Does anyone have sample code for an outbound function module for an IDoc - they created themselves. Custom or extended? Weblogs, sample code will be useful
    ty, dd
    Message was edited by:
            Demi Douglas

    Hi,
      Check this program:
    REPORT  zmatmas_idoc.
    INCLUDE zmatmas_idoc_top.
    INCLUDE zmatmas_idoc_selscreen.
    INCLUDE zmatmas_idoc_formroutine.
    START OF SELECTION
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM create_idoc.
      PERFORM distribute_idoc.
    TABLES
    TABLES: mara.
    Structures
    *Header
    TYPES: BEGIN OF gs_h_mara,
           matnr TYPE mara-matnr,
           ersda TYPE mara-ersda,
           ernam TYPE mara-ernam,
           laeda TYPE mara-laeda,
           aenam TYPE mara-aenam,
           pstat TYPE mara-pstat,
           END OF gs_h_mara.
    *Item
    TYPES: BEGIN OF gs_i_makt,
           spras TYPE makt-spras,
           maktx TYPE makt-maktx,
           maktg TYPE makt-maktg,
           matnr TYPE makt-matnr,
           END OF gs_i_makt.
    TYPES: BEGIN OF gs_i_mbew,
           lvorm TYPE mbew-lvorm,
           lbkum TYPE mbew-lbkum,
           salk3 TYPE mbew-salk3,
           vprsv TYPE mbew-vprsv,
           verpr TYPE mbew-verpr,
           stprs TYPE mbew-stprs,
           peinh TYPE mbew-peinh,
           matnr TYPE mbew-matnr,
           END OF gs_i_mbew.
    TYPES: BEGIN OF gs_i_mvke,
           vkorg TYPE mvke-vkorg,
           vtweg TYPE mvke-vtweg,
           lvorm TYPE mvke-lvorm,
           versg TYPE mvke-versg,
           bonus TYPE mvke-bonus,
           provg TYPE mvke-provg,
           matnr TYPE mvke-matnr,
           END OF gs_i_mvke.
    TYPES: BEGIN OF gs_i_mlan,
           aland TYPE mlan-aland,
           taxm1 TYPE mlan-taxm1,
           taxm2 TYPE mlan-taxm2,
           taxm3 TYPE mlan-taxm3,
           taxm4 TYPE mlan-taxm4,
           matnr TYPE mlan-matnr,
           END OF gs_i_mlan.
    *Segment & control record
    DATA:  gs_segment_h  LIKE zmara_h,
           gs_segment_i1 LIKE zmakt_i,
           gs_segment_i2 LIKE zmbew_i,
           gs_segment_i3 LIKE zmvke_i,
           gs_segment_i4 LIKE zmlan_i,
           gs_control_rec LIKE edidc.
    Internal Table and work area
    *Header & Item
    DATA: gt_h_mara TYPE STANDARD TABLE OF gs_h_mara,
          gt_i_makt TYPE STANDARD TABLE OF gs_i_makt,
          gt_i_mbew TYPE STANDARD TABLE OF gs_i_mbew,
          gt_i_mvke TYPE STANDARD TABLE OF gs_i_mvke,
          gt_i_mlan TYPE STANDARD TABLE OF gs_i_mlan.
    DATA: gw_h_mara TYPE gs_h_mara,
          gw_i_makt TYPE gs_i_makt,
          gw_i_mbew TYPE gs_i_mbew,
          gw_i_mvke TYPE gs_i_mvke,
          gw_i_mlan TYPE gs_i_mlan.
    *EDIDD & EDIDC
    DATA: gt_edidc LIKE TABLE OF edidc WITH HEADER LINE,
          gt_edidd LIKE TABLE OF edidd WITH HEADER LINE.
    SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    SELECT-OPTIONS: s_matnr FOR mara-matnr OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    *&  Include           ZMATMAS_IDOC_FORMROUTINE
    *&      Form  get_data
    FORM get_data .
      SELECT matnr ersda ernam laeda aenam pstat
      FROM mara
      INTO TABLE gt_h_mara
      WHERE matnr IN s_matnr.
      IF sy-subrc <> 0.
        MESSAGE e003(zkaren_msgclass).
      No data found according to the selection criteria
      ENDIF.
      IF gt_h_mara IS NOT INITIAL.
        SELECT spras maktx maktg matnr
        INTO TABLE gt_i_makt
        FROM makt
        FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
        SELECT lvorm lbkum salk3 vprsv verpr stprs peinh matnr
        INTO TABLE gt_i_mbew
        FROM mbew
        FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
        SELECT vkorg vtweg lvorm versg bonus provg matnr
        INTO TABLE gt_i_mvke
        FROM mvke
        FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
        SELECT aland taxm1 taxm2 taxm3 taxm4 matnr
        INTO TABLE gt_i_mlan
        FROM mlan
        FOR ALL ENTRIES IN gt_h_mara WHERE matnr = gt_h_mara-matnr.
      ENDIF.
    ENDFORM.                    " get_data
    *&      Form  create_idoc
    FORM create_idoc .
    *Control data
      gs_control_rec-mestyp = 'ZKAR_MATMAS_MSG_TYPE'.       "Message type
      gs_control_rec-idoctp = 'ZKAR_MATMAS'.                "IDoc
      gs_control_rec-rcvprt = 'LS'.                         "Partner type of receiver
      gs_control_rec-rcvprn = 'T90CLNT810'.                 "Partner number of receiver
      LOOP AT gt_h_mara INTO gw_h_mara .
    *Header data.
        gs_segment_h-matnr = gw_h_mara-matnr.
        gs_segment_h-ersda = gw_h_mara-ersda.
        gs_segment_h-ernam = gw_h_mara-ernam.
        gs_segment_h-laeda = gw_h_mara-laeda.
        gs_segment_h-aenam = gw_h_mara-aenam.
        gs_segment_h-pstat = gw_h_mara-pstat.
    *Header segment
        gt_edidd-segnam = 'ZMARA_H'.
        gt_edidd-sdata = gs_segment_h.
        MOVE gt_edidd-sdata TO gs_segment_h.
        APPEND gt_edidd.
        WRITE:/ gs_segment_h-matnr, gs_segment_h-ersda, gs_segment_h-ernam,
                gs_segment_h-laeda, gs_segment_h-aenam, gs_segment_h-pstat.
    *ITEM 1
        LOOP AT gt_i_makt INTO gw_i_makt.
          IF gw_i_makt-matnr = gw_h_mara-matnr.
    *Item data
            gs_segment_i1-spras = gw_i_makt-spras.
            gs_segment_i1-maktx = gw_i_makt-maktx.
            gs_segment_i1-maktg = gw_i_makt-maktg.
    *Item segment
            gt_edidd-segnam = 'ZMAKT_I'.
            gt_edidd-sdata = gs_segment_i1.
            APPEND gt_edidd.
          ENDIF.
        ENDLOOP.                                            "at gt_i_vbak
    *ITEM2
        LOOP AT gt_i_mbew INTO gw_i_mbew.
          IF gw_i_mbew-matnr = gw_h_mara-matnr.
    *Item data
            gs_segment_i2-lvorm = gw_i_mbew-lvorm.
            gs_segment_i2-lbkum = gw_i_mbew-lbkum.
            gs_segment_i2-salk3 = gw_i_mbew-salk3.
            gs_segment_i2-vprsv = gw_i_mbew-vprsv.
            gs_segment_i2-verpr = gw_i_mbew-verpr.
            gs_segment_i2-stprs = gw_i_mbew-stprs.
            gs_segment_i2-peinh = gw_i_mbew-peinh.
    *Item segment
            gt_edidd-segnam = 'ZMBEW_I'.
            gt_edidd-sdata = gs_segment_i2.
            APPEND gt_edidd.
          ENDIF.
        ENDLOOP.
    *ITEM3
        LOOP AT gt_i_mvke INTO gw_i_mvke.
          IF gw_i_mvke-matnr = gw_h_mara-matnr.
    *Item data
            gs_segment_i3-vkorg = gw_i_mvke-vkorg.
            gs_segment_i3-vtweg = gw_i_mvke-vtweg.
            gs_segment_i3-lvorm = gw_i_mvke-lvorm.
            gs_segment_i3-versg = gw_i_mvke-versg.
            gs_segment_i3-bonus = gw_i_mvke-bonus.
            gs_segment_i3-provg = gw_i_mvke-provg.
    *Item segment
            gt_edidd-segnam = 'ZMVKE_I'.
            gt_edidd-sdata = gs_segment_i3.
            APPEND gt_edidd.
          ENDIF.
        ENDLOOP.
    *ITEM4
        LOOP AT gt_i_mlan INTO gw_i_mlan.
          IF gw_i_mlan-matnr = gw_h_mara-matnr.
    *Item data
            gs_segment_i4-aland = gw_i_mlan-aland.
            gs_segment_i4-taxm1 = gw_i_mlan-taxm1.
            gs_segment_i4-taxm2 = gw_i_mlan-taxm2.
            gs_segment_i4-taxm3 = gw_i_mlan-taxm3.
            gs_segment_i4-taxm4 = gw_i_mlan-taxm4.
    *Item segment
            gt_edidd-segnam = 'ZMLAN_I'.
            gt_edidd-sdata = gs_segment_i4.
            APPEND gt_edidd.
          ENDIF.
        ENDLOOP.
      ENDLOOP.                                              "at gt_h_kna1
    ENDFORM.                    " create_idoc
    *&      Form  distribute_idoc
    FORM distribute_idoc .
      CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
        EXPORTING
          master_idoc_control            = gs_control_rec
        TABLES
          communication_idoc_control     = gt_edidc
          master_idoc_data               = gt_edidd
        EXCEPTIONS
          error_in_idoc_control          = 1
          error_writing_idoc_status      = 2
          error_in_idoc_data             = 3
          sending_logical_system_unknown = 4
          OTHERS                         = 5.
      IF sy-subrc <> 0.
        WRITE:/ 'Error'.
      ELSE.
        LOOP AT gt_edidc.
          WRITE:/ gt_edidc-docnum.
        ENDLOOP.                                            "at gt_edidc
      ENDIF.
    ENDFORM.                    " distribute_idoc

  • Function Modules for uploading the file

    Hi experts ,
                      I have a requirement to download a file (csv) from my local sytem (say desktop) into an internal table first and then update the contents of the same internal table into the database table.
    Can anybody provide me with a sample program for doing the same or at least the name of function modules for the same.
    Prompt replies will be rewarded.
    TIA
    Abhishek

    Hi Abhishek,
    How to use INSERT Statement..
    Check this Sample Program..
    TABLES:MARA.
    DATA:ITAB LIKE MARA OCCURS 0 WITH HEADER LINE.
    START-OF-SELECTION.
    ITAB-MATNR = '123ABCDA'. .
    ITAB-MBRSH = 'C'.
    ITAB-MTART = 'FERT' .
    ITAB-MEINS = 'KG' .
    APPEND ITAB.
    ITAB-MATNR = '123ABCDB'. .
    ITAB-MBRSH = 'C'.
    ITAB-MTART = 'FERT' .
    ITAB-MEINS = 'KG' .
    APPEND ITAB.
    LOOP AT ITAB.
    INSERT MARA FROM ITAB.
    MODIFY MARA .
    ENDLOOP.

Maybe you are looking for