Passing range table in a Subroutine

I got 3 select options like this:
Tables : VBRK.
*SELECTION SCREEN GUI
SELECT-OPTIONS:
so_fkdat   FOR vbrk-fkdat OBLIGATORY,
so_fkart   FOR vbrk-fkart,
so_vbeln   FOR vbrk-vbeln.
Now In the title of my alv I want to show
what user hav input in these 3 select-options. (the alv part is okay)
FORM form_so_title
                    USING itab_so  TYPE ANY TABLE
                    it_so
                    CHANGING p_ls_line_info TYPE slis_entry.
  LOOP AT itab_so into it_so.
* this is not working with type any
* so i hav to loop instead of read line
*  READ TABLE it_so INDEX 1.
    EXIT.
  ENDLOOP.
*When i am trying to access it_so-low, i m getting error
   l_describe = cl_abap_typedescr=>describe_by_data( it_so-low ).
    IF l_describe->type_kind EQ 'D'.
      WRITE it_so-high TO p_ls_line_info DD/MM/YYYY.
    ELSE.
      p_ls_line_info = it_so-high.
    ENDIF.
* this routine is complex but i am only posting
* certain part of it
ENDFORM.
Here is how I am calling the routines
  ls_line-key  = 'Billing Date'.
  PERFORM form_so_title USING so_fkdat[] so_fkdat
                        CHANGING ls_line-info.
  APPEND ls_line TO lt_top_of_page.
  ls_line-key  = 'Billing No.'.
  CLEAR ls_line-info.
  PERFORM form_so_title USING so_vbeln[] so_vbeln
                        CHANGING ls_line-info.
  APPEND ls_line TO lt_top_of_page.
  ls_line-key  = 'Billing Type'.
  CLEAR ls_line-info.
  PERFORM form_so_title USING so_fkart[] so_fkart
                        CHANGING ls_line-info.
  APPEND ls_line TO lt_top_of_page.
P.S.

*& Report  ZT_SO
REPORT  zt_so.
* ALV
TYPE-POOLS: slis, kkblo.
*TABLES
TABLES: usr01, sscrfields, vbrk.
TABLES: thead,                         "Textheader
        tline.                         "Textline
DATA:
it_vbrk LIKE TABLE OF vbrk.
*SELECTION SCREEN GUI
SELECT-OPTIONS:
so_fkdat   FOR vbrk-fkdat OBLIGATORY,
so_fkart   FOR vbrk-fkart,
so_vbeln   FOR vbrk-vbeln.
AT SELECTION-SCREEN.
  CASE sscrfields-ucomm.
    WHEN 'ONLI'.
      PERFORM form_extract_data.
    WHEN OTHERS.
      MESSAGE s001(00) WITH '' sscrfields-ucomm.
  ENDCASE.
START-OF-SELECTION.
  PERFORM form_show.
*&      Form  form_so_title
*       text
*      -->P_SO_FKDAT[]  text
*      <--P_LS_LINE_INFO  text
FORM form_so_title
                    USING itab_so  TYPE ANY TABLE
                    CHANGING
                    it_so
                    p_ls_line_info TYPE slis_entry.
  FIELD-SYMBOLS:
  <fs_low> TYPE ANY, <fs_high> TYPE ANY,
  <fs_option> TYPE ANY, <fs_sign> TYPE ANY.
  DATA comp_low(3) TYPE c VALUE 'LOW'.
  DATA comp_high(4) TYPE c VALUE 'HIGH'.
  DATA comp_sign(4) TYPE c VALUE 'SIGN'.
  DATA comp_option(6) TYPE c VALUE 'OPTION'.
  LOOP AT itab_so INTO it_so.
    EXIT.
  ENDLOOP.
  DATA:
           str_where(255), str_low(10), str_high(10), str_option(50), typ1.
  DATA l_describe TYPE REF TO cl_abap_typedescr.
  ASSIGN COMPONENT comp_low OF STRUCTURE it_so TO <fs_low>.
  ASSIGN COMPONENT comp_high OF STRUCTURE it_so TO <fs_high>.
  ASSIGN COMPONENT comp_sign OF STRUCTURE it_so TO <fs_sign>.
  ASSIGN COMPONENT comp_option OF STRUCTURE it_so TO <fs_option>.
  l_describe = cl_abap_typedescr=>describe_by_data( <fs_low> ).
  typ1 = l_describe->type_kind.
  IF <fs_high> IS NOT INITIAL
  AND <fs_low> IS NOT INITIAL.
    IF typ1 = 'D'.
      WRITE <fs_low>  TO str_low DD/MM/YYYY.
      WRITE <fs_high> TO str_high DD/MM/YYYY.
    ELSE.
      str_low = <fs_low>.
      str_high = <fs_high>.
    ENDIF.
*     "BT", "NB"
    IF <fs_option> = 'BT'.
      str_option = 'between'.
    ELSEIF <fs_option> = 'NB'.
      str_option = ' not between'.
    ENDIF.
    CONCATENATE  str_option str_low 'and' str_high INTO p_ls_line_info
    SEPARATED BY space.
  ELSEIF <fs_high> IS NOT INITIAL.
    IF typ1 = 'D'.
      WRITE <fs_high> TO p_ls_line_info DD/MM/YYYY.
    ELSE.
      p_ls_line_info = <fs_high>.
    ENDIF.
  ELSEIF <fs_low> IS NOT INITIAL.
*    "EQ", "NE", "GE", "GT", "LE", "LT", "CP" and "NP"
    CASE  <fs_option>.
      WHEN 'EQ'.
        str_option = ''.
      WHEN 'NE'.
        str_option = 'not equal to'.
      WHEN 'GE'.
        str_option = 'greater than or equal to'.
      WHEN 'GT'.
        str_option = 'greater than'.
      WHEN 'LE'.
        str_option = 'less than or equal to'.
      WHEN 'LT'.
        str_option = 'less than'.
      WHEN 'CP'.
        str_option = 'like'.
      WHEN 'NP'.
        str_option = 'not like'.
    ENDCASE.
    IF typ1 = 'D'.
      WRITE <fs_low> TO str_low DD/MM/YYYY.
    ELSE.
      str_low = <fs_low>.
    ENDIF.
    CONCATENATE  str_option str_low INTO p_ls_line_info
       SEPARATED BY space.
  ENDIF.
ENDFORM.                    " form_so_title
*&      Form  form_extract_data
*       text
*  -->  p1        text
*  <--  p2        text
FORM form_extract_data .
  SELECT SINGLE * FROM vbrk.
  APPEND vbrk TO it_vbrk.
ENDFORM.                    " form_extract_data
*&      Form  form_show
*       text
*  -->  p1        text
*  <--  p2        text
FORM form_show .
  DATA:
  gt_list_top_of_page TYPE slis_t_listheader,
  wa_gt LIKE LINE OF gt_list_top_of_page.
*"List Header for Top-Of-Page
  PERFORM comment_build USING gt_list_top_of_page[].
  FORMAT COLOR COL_TOTAL.
  LOOP AT gt_list_top_of_page INTO wa_gt.
    FORMAT INTENSIFIED ON.
    WRITE:/ wa_gt-key.
    FORMAT INTENSIFIED OFF.
    WRITE wa_gt-info.
  ENDLOOP.
  FORMAT COLOR OFF.
  FORMAT COLOR COL_KEY.
  LOOP AT it_vbrk INTO vbrk.
    WRITE:/ vbrk-vbeln.
    WRITE vbrk-fkdat.
  ENDLOOP.
  FORMAT COLOR OFF.
ENDFORM.                    " form_show
*&      Form  comment_build
*       text
*      -->LT_TOP_OF_PAGE  text
FORM comment_build USING lt_top_of_page TYPE
                                        slis_t_listheader.
  DATA: ls_line TYPE slis_listheader,
         str_select TYPE string,
         str_where(255), str_low(10), str_high(10), str_option(50).
  CLEAR ls_line.
  ls_line-typ  = 'H'.
  ls_line-info = 'SDN BLOG'.
  APPEND ls_line TO lt_top_of_page.
  CLEAR ls_line.
  ls_line-typ  = 'H'.
  ls_line-info = 'Form report'.
  APPEND ls_line TO lt_top_of_page.
  CLEAR ls_line.
  CLEAR str_where.
  ls_line-typ  = 'S'.
  ls_line-key  = 'Report generated on'.
  WRITE sy-datum TO ls_line-info DD/MM/YYYY.
  APPEND ls_line TO lt_top_of_page.
  ls_line-key  = 'Billing Date'.
  PERFORM form_so_title USING so_fkdat[]
                        CHANGING so_fkdat ls_line-info.
  APPEND ls_line TO lt_top_of_page.
  ls_line-key  = 'Billing No.'.
  CLEAR ls_line-info.
  PERFORM form_so_title USING so_vbeln[]
                        CHANGING so_vbeln ls_line-info.
  APPEND ls_line TO lt_top_of_page.
  ls_line-key  = 'Billing Type'.
  CLEAR ls_line-info.
  PERFORM form_so_title USING so_fkart[]
                        CHANGING so_fkart ls_line-info.
  APPEND ls_line TO lt_top_of_page.
ENDFORM.                    "comment_build

Similar Messages

  • I am passing range table from the method of ODATA Service to FM but In FM range table is becoming initial.What would be the reason for the same?

    I am passing range table from the method of ODATA Service to FM but In FM range table is becoming initial.What would be the reason for the same?

    Vinod, Can you share detail on how are you sending and how are you reading.

  • Passing internal table with the subroutines

    hi experts,
                   cud u plz tell me how to pass two internal tables in a perform ,form statement plz make me understand with the help of simple logic....actually i have to subtract the data of current month to the data of previous month depending upon the number of months on selection screen...........thnx in advance....sud i apply some other logic for this........

    Hi
    DATA: BEGIN OF line,
            num1 TYPE i,
            num2 TYPE i,
          END OF line.
    DATA itab LIKE STANDARD TABLE OF line.
    PERFORM fill CHANGING itab.
    PERFORM out  USING    itab.
    FORM fill CHANGING f_itab LIKE itab.
      DATA f_line LIKE LINE OF f_itab.
      DO 3 TIMES.
        f_line-num1 = sy-index.
        f_line-num2 = sy-index ** 2.
        APPEND f_line TO f_itab.
      ENDDO.
    ENDFORM.
    FORM out USING value(f_itab) LIKE itab.
      DATA f_line LIKE LINE OF f_itab.
      LOOP AT f_itab INTO f_line.
        WRITE: / f_line-num1, f_line-num2.
      ENDLOOP.
    ENDFORM.
    Regards,
    S.Suresh.
    Rewards if Useful.

  • Select options range table to be passed to Assistance class

    Hi Guru's,
    I have an assistance class where I have to write all my select queries. I have a selection screen with multiple Select options (as input fields). Now I want to pass the select options range table to assistance class.
    Please let me know if you have any sample code for this which may also include building range tables for select options.
    Thanks,
    Pradeep

    Hi Pardeep,
    U can use following code: for field ERDAT
    data: rt_ERDAT      type ref to data,
            R_ERDAT       TYPE RANGE OF VIQMEL-ERDAT,
            R_ERDAT_line  LIKE LINE OF R_ERDAT,
    field-symbols: <fs_ERDAT> type table.
    Retrieve the data from the select option
      rt_ERDAT = wd_this->m_handler->get_range_table_of_sel_field( i_id = 'ERDAT' ).
    Assign it to a field symbol
      assign rt_ERDAT->* to <fs_ERDAT>.
    copy field symbols to local variable
      R_ERDAT = <fs_ERDAT>.
    CALL METHOD WD_ASSIST->"METHOD_NAME"
          R_ERDAT        = R_ERDAT
    where in class method:
    R_ERDAT     Importing     Type     ZU5QNM_ERDAT_T
    ZU5QNM_ERDAT_T : is a table type of ZU5QNM_ERDAT_R
    and ZU5QNM_ERDAT_R has following structure :
    SIGN     ACE_SIGN     CHAR     1     0     Debit/Credit Sign (+/-)
    OPTION     ACE_OPTION     CHAR     2     0     Option for Ranges Tables
    LOW     ERDAT     DATS     8     0     Date on Which Record Was Created
    HIGH     ERDAT     DATS     8     0     Date on Which Record Was Created
    I hope this wiol solve ur problem.
    Regards,
    Vishal.

  • Passing internal tables as parameters to subroutines

    Hi,
    This was going to be a question but I just had it answered by someone. Hopefully, this piece of information is going to be useful to other people as well.
    I had a subroutine in my code which looks like this.
    form fr_sub_get_data USING uf_file
                                    TABLES ct_int_log STRUCTURE zinterface_log.
    endform.
    I was told by someone at work to change it as follows: -
    form fr_sub_get_data USING uf_file
                                    CHANGING ct_int_log type ty_tab_int_log.
    endform.
    The reason is that when using the tables' clause to pass internal tables as parameters, a header line is automatically created in the subroutine which lasts for as long as the subroutine is being excecuted. Its considered to be a bad practise to use header lines (Work-Areas are preferable).
    Another important point to remember is that the 'tables' clause can only be used to pass <b>standard</b> internal tables as parameters. It can not be used for internal tables of other types.
    Cheers!

    HI
    GOOD
    GO THROUGH THIS LINK
    http://www.abapforum.com/forum/viewtopic.php?t=1962&language=english
    THANKS
    MRUTYUN

  • Passing internal tables dynamically to a subroutine

    Hi All,
    How to pass internal tables dynamically to a subroutine?
    In subroutine logic i'm fetching data from MARA table for all entries in the internal table passed to the subroutine. Based on some condition the internal table varies. I'm placing the code below
    Both GT_AUFM & GT_AUFM1 are of 2 different structures having MATNR.
    IF WA_AUFM1-BWART EQ '261'.
        PERFORM GET_IF_SEMIFINISHED USING GT_AUFM1.
    ELSE IF WA_AUFM1-BWART EQ '262'.
        PERFORM GET_IF_SEMIFINISHED TABLES GT_AUFM.
    ENDIF.
    FORM GET_IF_SEMIFINISHED  USING P_TABLE TYPE ANY TABLE.
      REFRESH GT_MARA.
      SELECT MATNR FROM MARA INTO TABLE GT_MARA
                     FOR ALL ENTRIES IN P_TABLE
                     WHERE MATNR EQ P_TABLE-MATNR
                       AND MTART IN R_MTART.
      ENDFORM.
    With this logic i'm getting an error that the specified type has no structure and therefore no component called MATNR.
    Thanks,
    Anil.

    refer this link
    dynamic internal table

  • Passing select options to a subroutine

    hi experts
    can somebody tell me how to pass a select options to
    a subroutine. tell  me how to pass using pass by reference and
    value.
    thanks.

    Hi AJAY,
    yes, as  Sumit Agarwal  already said, the select-options are internal tables. They are implicitly declared as range tables with header line.
    SELECT-OPTIONS:
      s_matnr for mara-matnr.
    decalares a table and will generate the input fields on the selection screen.
    data:
      s_matnr TYPE RANGE OF mara-matnr WITH HEADER LINE.
    declares the same table.
    You may pass this to a subroutine using the TABLES parameter. But as this is obsolete, it is better to find or declare an appropriate type for this.
    TYPES:
      ty_sel_mat TYPE RANGE OF mara-matnr .
    PERFORM select_material USING s_matnr[]. "[] means table body only
    FORM select_material USING pt_selmat type ty_sel_mat.
    SELECT ... INTO ... FROM mara WHERE matnr IN pt_selmat.
    ENFORM
    is the appropriate syntax.
    Note: SAP has dictonary types for many fields frequently used in select-option ranges. They are defined as table types and may be found by searching for names like range.
    Regards,
    Clemens

  • Passing a table to a subrutine

    Hi,
    I have an internal table itab[].
    i want to pass this internal table to a subroutine
    using field-symbol.
    Can any one tell how to pass the field symbol of the table to the subroutine and subsequently process it. Thanks.

    Hi Sibi,
    You can not pass a field symbol to a form routine as defining subroutine parameters as field symbols is not allowed. You can pass a field symbol that points to a table to the form routine parameter which is a table. Then in the form routine you can create a local field symbol for the passed table and assign the passed table to the local field symbol and handle it as you like with in the form routine.
    See below:
    data itab type STANDARD TABLE OF sflight.
    FIELD-SYMBOLS: <itab> type STANDARD TABLE,
                   <gfs_itab> type sflight.
    ASSIGN itab to <itab>. "assign the table to the field symbol
    perform get_name USING <itab>. "pass the field symbol
    loop at <itab> ASSIGNING <gfs_itab>. "use the modified table
      write :/ <gfs_itab>-carrid,
               <gfs_itab>-connid.
    ENDLOOP.
    form get_name using p_itab type standard table.
      FIELD-SYMBOLS: <lfs_itab> type STANDARD TABLE. "define a local field symbol
      data: lwa_itab type sflight.
      assign p_itab to <lfs_itab>. "assign the passed table to the local field symbol
    " modified the local field symbol (table)
      lwa_itab-carrid = 'AA'.
      lwa_itab-connid = '123'.
      append lwa_itab to <lfs_itab>.
      lwa_itab-carrid = 'LH'.
      lwa_itab-connid = '456'.
      append lwa_itab to <lfs_itab>.
    endform.
    Hope this helps.
    Thanks
    Sanjeev

  • For all entries table handled by Tables parameter of Subroutine!

    Hi....
    See my code...
    Dont leave as it seems very big code... Actually its very small one...
    In sourse code of function module...
    data:itab1  type standard table of <local structure of top include> with header line,
                     itab2 type standrad table of knvp with header line.
    perform routine_data tables  itab1
                          using    p_var
    Subroutine code, saved in F include of that function group...
    form routine_data  tables itab1 type standard table
                               using    p_var
      select * from <db table>
                  into corresponding fields of table itab
                  where <keyfield> = p_var.
    endform.
    Back to source cod eof Function module..
    if sy-subrc is = 0.
        select parvw kunn2 kunnr from knvp
                            into corresponding fields of table itab2 for all entries in itab1
                             where kunnr = itab1-kunnr
                             and ( parvw = 'WE' or parvw = 'RE' or parvw = 'RG').
    endif.
    This code is working fine......
    ==================Now coming to my problem==========================
    In source code of function module...
    data:itab1  type standard table of <local structure of top include> with header line,
                     itab2 type standrad table of knvp with header line.
    perform routine_data tables  itab1
                                   using    p_var
    Subroutine code, saved in F include of that function group...
    form routine_data  tables itab1 type standard table
                               using    p_var
      select * from <db table>
                  into corresponding fields of table itab
                  where <keyfield> = p_var.
    endform.
    Function module source code...
    perform routine2_data tables itab1
                                     itab2.
    F include coding part for above subroutine....
    form routine2_data  tables itab1 type standard table
                                          itab2 type standard table
        select parvw kunn2 kunnr from knvp
                            into corresponding fields of table itab2 for all entries in itab1
                             where kunnr = itab1-kunnr                                         <-----causing error
                             and ( parvw = 'WE' or parvw = 'RE' or parvw = 'RG').
    endform.
    Giving error message....
    >>> The specified type has no structure and therefore no component called 'KUNNR".....
    So here the problem is there is a incorrect way to declare parameters....
    Plz remind that SUBROUTINES OF FUNCTION MODULES SAVING IN INCLUDE PROGRAMS, because they making some deffenrce with normal external subroutines...
    also...
    Here for all entries is mandatory!
    And Two sub routines are mandatory!
    Thanks for your attention...
    Naveen Inuganti.

    Hi ,
    Use the below  syntax to pass the tables as parameters
    *The below perform is in the source code of the F.M
    PERFORM goods_movement_post TABLES itab1
                                       itab2
                                       itab3
                                   USING ls_goodsmvt_header
                                         g_mov_code.
    suppose u are using the itab1 & itab2 tables data to get the itab3 Data 
    And The below code is in the Frms include
    FORM goods_movement_post
                      TABLES
                         pt_itab1 STRUCTURE vbak
                         pt_itab2 STRUCTURE vbap
                         pt_itab3 STRUCTURE bapiret2
                      USING
                         p_ls_goodsmvt_header STRUCTURE bapi2017_gm_head_01
                         p_g_mov_code.
    ENDFORM
    Thanks & Reagrds
    Mallikharjuna Reddy

  • Problem in selection from data base with RANGE-TABLE.

    Dear folks,
                   I am facing weird problem with range table in selection query.I have problem with bold part of code.Here when i give input to both ranges r_salesno,r_brandid then and the selection occurs ,when i put black in one of those it does not work.I haev passed Empty table to range if no inpiut in elements..although it does not work..I dont know why it is happening...By the i m using this code in Webdynpro ABAP.Please help points will be awarded..
    if  Stru_Cn_Selcrtr-ca_slsrl is not initial.
        wa_salesno-sign = 'I'.
        wa_salesno-option = 'EQ'.
        wa_salesno-LOW = Stru_Cn_Selcrtr-ca_slsrl.
        APPEND wa_salesno TO r_salesno.
        CLEAR : wa_salesno .
      else.
        wa_salesno-sign = 'I'.
        wa_salesno-option = 'EQ'.
        wa_salesno-LOW = space.
        APPEND wa_salesno TO r_salesno.
         CLEAR : wa_salesno .
      endif.
      if  Stru_Cn_Selcrtr-ca_brand is not initial.
        wa_brandid-sign = 'I'.
        wa_brandid-option = 'EQ'.
        wa_brandid-LOW = Stru_Cn_Selcrtr-ca_brand.
        APPEND  wa_brandid TO  r_brandid.
        CLEAR :  wa_brandid .
      else.
        wa_brandid-sign = 'I'.
        wa_brandid-option = 'EQ'.
         wa_brandid-LOW = space.
        APPEND wa_brandid  TO  r_brandid.
        CLEAR : wa_brandid  .
      endif.
    *If any of these are given then select data accordingly.
        <b>select * from ZNSLVWHDIMMD_LCL
                 into corresponding fields of table IT_VIEW
                 WHERE SALESRLNO in  r_salesno
    *             and   CREATEDBY in It_crtby_selopt
    *            and   STARTDATE in It_validfrm_selopt
    *             and   ENDDATE   in It_validto_selopt
    *             and  STATUS     in It_status_selopt1
                 and   BRANDID   in r_brandid.
    *             and   MODELNO   in It_model_selopt.</b>

    Hello Nirad
    Your coding is problematic. I assume that field SALESRLNO (of table ZNSLVWHDIMMD_LCL) probably means sales number (or sales order) and, thus, must not be empty. If this is correct then the first IF statement is probably wrong:
    if  Stru_Cn_Selcrtr-ca_slsrl is not initial.
        wa_salesno-sign = 'I'.
        wa_salesno-option = 'EQ'.
        wa_salesno-LOW = Stru_Cn_Selcrtr-ca_slsrl.
        APPEND wa_salesno TO r_salesno.
        CLEAR : wa_salesno .
      else.
        REFRESH: r_salesno.  " means: select all sales numbers
    " NOTE: If you fill the range like below this means that only sales order
    "            with no sales number (= ' ', space) should be select.
    " Thus, there will never be any sales order selected.
    *   wa_salesno-sign = 'I'.
    *   wa_salesno-option = 'EQ'.
    *   wa_salesno-LOW = space.
    *   APPEND wa_salesno TO r_salesno.
    *    CLEAR : wa_salesno .
      endif.
    The same logic applies to the second IF statement. If you want to select all BRANDID if none has been provided as selection criteria then code:
      if  Stru_Cn_Selcrtr-ca_brand is not initial.
        wa_brandid-sign = 'I'.
        wa_brandid-option = 'EQ'.
        wa_brandid-LOW = Stru_Cn_Selcrtr-ca_brand.
        APPEND  wa_brandid TO  r_brandid.
        CLEAR :  wa_brandid .
      else.
        REFRESH: r_brandid.  " means: select all BRANDID
    *    wa_brandid-sign = 'I'.
    *    wa_brandid-option = 'EQ'.
    *     wa_brandid-LOW = space.
    *    APPEND wa_brandid  TO  r_brandid.
    *    CLEAR : wa_brandid  .
      endif.
    Regards
      Uwe

  • PASSING INTERNAL TABLR FROM ONE SUBROUTINE TO OTHER SUBROUTINE

    hi i want to pass one internal table to other subroutine like this
    form abc
    data: begin of itab occurs 0.
              end of itab
    perform xyz tables itab.
    endform.
    form xyz tables itab like itab[].
    end form
    it is giving and error that itab is not defiend by data statement
    and also tell how to pass two internal tables to the subroutine
    thanx in advance
    its very urgent
    points wil be rewarded
    plz help its very urgent

    Hi,
    Check this Example
    PROGRAM FORM_TEST.
    TYPES: BEGIN OF LINE,
    COL1 TYPE I,
    COL2 TYPE I,
    END OF LINE.
    DATA: ITAB TYPE STANDARD TABLE OF LINE WITH HEADER LINE,
          JTAB TYPE STANDARD TABLE OF LINE.
    PERFORM FILL TABLES ITAB.
    MOVE ITAB[] TO JTAB.
    PERFORM OUT TABLES JTAB.
    FORM FILL TABLES F_ITAB LIKE ITAB[].
      DO 3 TIMES.
        F_ITAB-COL1 = SY-INDEX.
        F_ITAB-COL2 = SY-INDEX ** 2.
        APPEND F_ITAB.
      ENDDO.
    ENDFORM.
    FORM OUT TABLES F_ITAB LIKE JTAB.
      LOOP AT F_ITAB.
        WRITE: / F_ITAB-COL1, F_ITAB-COL2.
      ENDLOOP.
    ENDFORM.
    Regards,
    Satish

  • How to pass Dynamic Table(s) to FM

    Hello All i hv an requirement in which i need to process a block of code recursively. right now i am trying to do the same with Subroutine but its hard i know. I have an option to use FM instead but i am not sure if we can pass dynamic tables to FM, so is there anybody who had solution for the same. otherwise i can use it using TOP include to declare dynamic table in comon arae as im calling it from another FM(RFC) but i  dont want to use that as it will consume more memory.
    So i have 2 question
    1. should i use FM instead of subroutine for recursive operation if yes how can know if i reached the maximum alloted size of memory for a program. is there any FM which can tell me about the memory used or somethign like that so that i can avoid any ABAP dump.
    2.how can i pass dynamic tables as input to parameters.
    Note : i allready seen https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f50dcd4e-0501-0010-3596-b686a7b51492

    Hello Mani
    Perhaps the sample report ZUS_SDN_TABLE_READ_VIA_RFC_XML in thread
    How to return back a structure of dynamic tables in a Function Module
    might be a useful approach for you.
    Regards
      Uwe

  • To yashpal Gupta-Select option range table

    Dear Yashpal,
                        I have created range table and put conditions and passed empty table in this fashion.still the result is the same (If i give both input then functionality works,only one of then is given then sy-subrc = 4.).I am wondering ehther u haev passed empty table correctly or not.
    if  Stru_Cn_Selcrtr-ca_slsrl is not initial.
        wa_salesno-sign = 'I'.
        wa_salesno-option = 'EQ'.
        wa_salesno-LOW = Stru_Cn_Selcrtr-ca_slsrl.
        APPEND wa_salesno TO r_salesno.
        CLEAR : wa_salesno .
      else.
        wa_salesno-sign = 'I'.
        wa_salesno-option = 'EQ'.
        wa_salesno-LOW = space.
        APPEND wa_salesno TO r_salesno.
         CLEAR : wa_salesno .
      endif.
      if  Stru_Cn_Selcrtr-ca_brand is not initial.
        wa_brandid-sign = 'I'.
        wa_brandid-option = 'EQ'.
        wa_brandid-LOW = Stru_Cn_Selcrtr-ca_brand.
        APPEND  wa_brandid TO  r_brandid.
        CLEAR :  wa_brandid .
      else.
        wa_brandid-sign = 'I'.
        wa_brandid-option = 'EQ'.
         wa_brandid-LOW = space.
        APPEND wa_brandid  TO  r_brandid.
        CLEAR : wa_brandid  .
      endif.
    **Situation where these fields are not provided  on the screen.
    *If any of these are given then select data accordingly.
        select * from ZNSLVWHDIMMD_LCL
                 into corresponding fields of table IT_VIEW
                 WHERE SALESRLNO in  r_salesno
    *             and   CREATEDBY in It_crtby_selopt
    *            and   STARTDATE in It_validfrm_selopt
    *             and   ENDDATE   in It_validto_selopt
    *             and  STATUS     in It_status_selopt1
                 and   BRANDID   in r_brandid.
    *             and   MODELNO   in It_model_selopt

    dynamic selection on data.thnx

  • Can I make a static range table?

    Hi, Is there any way to make a Range Table as below STATIC?
    SELECT RANGES
      RANGES: LR_RYEAR    FOR GLPCA-RYEAR.     " Fiscal Year
    Thanks!

    Hi Kenneth,
    <li>You have to use STATICS statement inside subroutine. Check F1 help for where to use.
    <li>You have to use range table like below.
    *&      Form  xyz
    form xyz.
    STATICS: lr_ryear TYPE RANGE OF glpca-ryear.
    DATA:    wa_ryear LIKE LINE OF lr_ryear.
    ENDFORM.                    "xyz
    Thanks
    Venkat.O

  • Range table type conflict

    Hi!
    Can anybody please tell me what is wrong with this code.
    I am trying to pass a range table to a function that takes a following type of table:
    Range table type: rangetab_tty
    Structured Row Type: ranges_row
    Associated type for LOW/HIGH components: some_element
    Here is my test program:
    DATA:
    lt TYPE rangetab_tty,
    lt_line TYPE LINE OF rangetab_tty.
    lt_line-sign = 'I'.
    lt_line-option = 'BT'.
    lt_line-low = '0'.
    lt_line-high = '1'.
    APPEND lt_line TO lt.
    and now I am passing this table and then I get the runtime error "table type conflict" because it seems I am passing the range table wrong.
    regards

    Hi,
    You can do this way:
    Ranges: lt_line for <table-fieldname>.
    Then fill the values as you are doing
    lt_line-sign = 'I'.
    lt_line-option = 'BT'.
    lt_line-low = '0'.
    lt_line-high = '1'.
    APPEND lt_line .
    Rgds,
    HR

Maybe you are looking for

  • How to create a single login for multiple apps on tomcat server?

    Hello, I am running the most recent versions of apache and tomcat on several dells with XP pro. When I login to an app I have created, a session variable is set, but when I browse to one of the other apps on the same computer, it does not recognize t

  • Ad hoc query for  om

    Dear gurus, could you please tell me that ad hoc query is written by Sap functional people.like sao hr people ,or this is standard one. actually my DOJ and Relationship is not showing in that Ad Hoc Query report for OM. Pls suggest me what i need to

  • Adding fields to a form based on stored procedure

    I have a store procedure and a form based on it. I'd added a new parameter to the store procedure. How can I do to add a field in the form which takes the new parameter. I'd tried adding a new field with the same name of the parameter but it didn't w

  • Password protecting test site

    Hi I wanted to password protect a test site I have been making to show to selected people. I found this tutorial using PHP which seems pretty straightforward. http://www.zubrag.com/scripts/password-protect.php The one problem is it says It will show

  • Scheduling an Automatic Startup

    I cant get my macbook pro to startup automatically from with the schedule tool in system preferences.I can get it to wake up from sleep mode but not from a complete shutdown.