Dynamic TABLE parameter in Sub routine call

Hi,
Is it possible to have a dynamic TABLE parameter in a sub-routine call? The structure of the internal table will be different during different calls to the sub-routine.
I have a subroutine which has the FM "HR_INFOTYPE_OPERATION" to update the infotype data for an Applicant. Now i want to call this subroutine for every Infotype update. So every time the structure of the internal table to be passed will vary depending on Infotype ( eg P0002 for Infotype 0002, p0006 for infotype 0006).
Any pointers will be appreciated.
Thanks in advance.

Hi Navin,
yes, why not.
just use a generic type parameter, i.e.
FORM process USING IT_00x type table IV_type typc.
It depend what yout FORM shall do. If you pass the types name, you can dynamically assign to a field-symbol of the respective type.
Regards,
Clemens

Similar Messages

  • Pass Structured table into dynamic table parameter in public method

    Ladies and Gentlemen,
    I have a requiremet to pass (1 at a time) any number of tables into a reuseable method in a custom class.  The Method code is as follows:
    method CREATE_OUTBOUND_FILE.
    * Importing VALUE( IV_PATHNAME )  TYPE PATHEXTERN File Destination
    * Importing VALUE( IT_FILE_RECORD ) TYPE REF TO DATA  Table with Output
    * Importing VALUE( IV_RECORD_STRUCTURE )  TYPE STRING OPTIONAL  Record Structure
    * Importing VALUE( IV_DELIMITER )     TYPE STRING     File Delimiter
    * Exporting VALUE( EV_RECORD_CNT )  TYPE STRING Record Count
      Data:
            ls_line_cnt(6) type n,
            lt_data_struc  type zty_ddic_struc_T,
            ls_string      type string.
      field-SYMBOLS: <fs_string> type any.
    * Open Dataset for outputting file details
      Open dataset iv_pathname for output in text mode encoding default.
      Assign ls_string to <fs_string> CASTING TYPE (iv_record_structure).
      loop at it_file_record into <fs_string>.
        transfer <fs_string> to iv_pathname.
        Add 1 to ls_line_cnt.
        clear <fs_string>.
      endloop.
      ev_record_cnt = ls_line_cnt.
    where IV_PATHNAME = output destination & filename
                IT_FILE_REC     = data table
                IV_RECORD_STRUCTURE = is ddic structure definition for the data table
                IV_DELIMITER = file delimiter, in this case, let's say it's C (for CSV)
         and EV_RECORD_CNT is a count of numbe of records processed.
    Lets say, for example, I wish to load data from table SFLIGHT into the method when program A is executed.  Then another time I wish to excute Program B which is passing in data of table  SFLCONN2.  I hope that by using the "type ref to data" defintion, I can pass the table contents through. Is this true?
    Secondly, I'm getting a syntax error saying that "IT_FILE_RECORD" is not defined as a table (and therefore can't be looped at), and therefore can't be read.  How can I access the data in this table in preparation for output.
    Any assistance or thoughts would be greatly appreciated.
    Regards,
    Steve

    Hi Stephen ,
    Graham already gve part of the solution.
    If you declare
    Importing VALUE( IT_FILE_RECORD ) TYPE REF TO DATA
    it does not make sense to declare to pass by VALUE because you will not change this refernce in the method. Calling this method, you must pass a refefernce.
    data:
      lr_ref type ref to data.
    get reference of <your itab here> into lr_ref.
    CREATE_OUTBOUND_FILE( ...IT_FILE_RECORD = lr_ref ... )
    In the method, it goes as graham explained.
    Anyway, I would declare the table parameter as
    Importing IT_FILE_RECORD TYPE TABLE
    The your code could work, but you will have troube with any non-character fields in the tables.
    Regards,
    Clemens

  • Tables parameter at Form routines

    Dear All!
    I have heard that this version is obselete:
    Form showMara tables itab_mara type mara.
    Endform.
    Can you pls say to me what the cuurent coorectly
    version is to handle with tables at form routines.
    rregards
    sas

    yes it works
    no prblem...
    this is worarea
    Form showMara tables itab_mara type mara.
    Endform.
    this is for table
    Form showMara tables itab_mara[] type table mara.
    Endform.
    like that
    for exact checking ...c the help
    ok

  • Table parameter of RFC FM in background task

    hi
    I have a RFC FM in system A which has two table parameters, first table parameter table1 will have the data and the second table parameter table2 will be filled with in the FM with the error and success messages. Now i am calling this RFC FM in a program in system B in background task. I am passing the values to the first table paramter table1. after the call i am using commit work. now my question is can i read the values in the second table parameter table2?
    report
    call function 'ABC' destination dest in background task
    tables
    table1 = itab1
    table2  = itab2
    commit work
    will the values be populated in itab2.?
    thanks

    Hi,
    yes u can surely read the values of the second table ,
    what ever parameters you pass to the FM whether it is an RFC enabled or simple FM they can be accessed by the report in which you r calling it.
    Call Function <FM>.
    Tables
       table1 = itab1
       table2 = itab2
    loop at itab1 into wa.
    write: wa-field1.               " Read the values of table1
    endloop.
    loop at itab2 into wa1.
    write: wa1_field1.            " Read the values of table2
    endloop.
    thanks
    ravi

  • Dynamic Function Module call with table parameter?

    Hi All,
    I'm trying to call FMs dynamically with PARAMETER-TABLE. These FMs are mainly about searching data from inputs and returning internal table as outputs. I managed to pass data into import parameters as query conditions, but still failed to set tables parameter. The code is like below, could you please help me check what's the problem? Thank you very much!!
    data: lv_val type RS38L_TYP value 'ls_service_para-fmparam'.
    data: lt_interface TYPE rsfbintfv,
               ls_import_para TYPE rsfbpara,
               ptab TYPE abap_func_parmbind_tab,
               ptab_line TYPE abap_func_parmbind,
               ref_wa type ref to data.
    Field-symbols: <fs> type any,
    CALL METHOD cl_fb_function_utility=>meth_get_interface
           EXPORTING
             im_name             = LV_FM          "FM name
           IMPORTING
             ex_interface        = lt_interface
           EXCEPTIONS
             error_occured       = 1
             object_not_existing = 2
             OTHERS              = 3.
    ***loop IMPORT parameters and fill in data from lt_params***
    loop at  lt_interface-import into ls_import_para.
         read table lt_params into ls_param with key key = ls_import_para-parameter.  "check if exists query value
        if sy-subrc = 0 and ls_param-value is not initial.
              assign (lv_val) to <fs>.
               <fs> = ls_param-value.
              create data ref_wa type (ls_import_para-STRUCTURE).
              assign ref_wa->* to <fs2>.
               <fs2> = <fs>.  UNASSIGN: <fs>,<fs2>.
               ptab_line-name = ls_import_para-PARAMETER.
               ptab_line-value = ref_wa.
               ptab_line-kind = abap_func_exporting.
              insert ptab_line into table ptab.
         endif.
    endloop.
    ***loop at TABLE parameters to retrieve data from FM***
    loop at lt_interface-TABLES into ls_import_para.
         create data ref_wa type (ls_import_para-STRUCTURE).
          ptab_line-tables_wa = ref_wa.     "set data type
          ptab_line-name = ls_import_para-PARAMETER.
          ptab_line-kind = abap_func_tables.
         insert ptab_line into table ptab. "if commented, no exception occurs,but I cannot get any dataset.
    endloop.
    CALL FUNCTION LV_FM PARAMETER-TABLE ptab.
    if I execute the code, when there has TABLES parameter defined in the FM, I get CX_SY_DYN_CALL_PARAM_MISSING exception with runtime error DATREF_NOT_ASSIGNED. But in debug mode, as shown in the screen shot attached, I did see the field TABLES_WA has correct type. So maybe I misunderstand the usage of PARAMETER-TABLE. Does anyone has experience on it?
    Best Regards,
    Jeff

    Hi Rama,
    Yes, I'm not passing value to the table parameter, but that parameter is where I want to retrieve data from FM, not pass value to, so I don't assign any value to ptab_line-value for that parameter.
    BTW, I just did some test to pass value to the parameter using the following code and still got CALL_FUNCTION_PARM_MISSING exception:
    FM: ZLEAD_CONTACT
    parameters:
    IMPORT:  I_PARTNER TYPE BUT000-PARTNER mandatory
    TABLES: OT_CONT LIKE ZLEAD_INFO_S optional (here ZLEAD_INFO_S is a flat structure)
    ptab_line-name = ls_import_para-PARAMETER.
    ptab_line-kind = abap_func_tables.
    create data ref_type type table of (ls_import_para-STRUCTURE).
    ptab_line-tables_wa = ref_wa.
    ptab_line-value = ref_type.
    The detail of ptab:
    VALUE
    TABLES_WA
    KIND
    NAME
    ->2000000025
    {A:initial}
    10
    2000000025
    ->Standard Table[0x10(588)]
    ->Structure: flat & not charlike
    30
    OT_CONT
    And the same error if I set parameter using below code:
    create data ref_wa type RS38L_TYP.
    assign ref_wa->* to <fs>.
    <fs> = ls_import_para-STRUCTURE.
    ptab_line-tables_wa = ref_wa.
    The detail of ptab:
    VALUE
    TABLES_WA
    KIND
    NAME
    ->2000000025
    {A:initial}
    10
    2000000025
    ->Standard Table[0x10(588)]
    ->ZLEAD_INFO_S
    30
    OT_CONT
    Regards,
    Jeff

  • Call Function with RFC  dynamic table

    Hi all
    I create a function compare TABLE_ENTRIES_GET_VIA_RFC and CTVB_COMPARE_TABLES, everything is.dynamic
    it works well but, how could i create a dynamic output parameter for table.
    the system show me that RFC and dynamic table don't work.
    i don't want line by line i would like to have the real structure inside of the Function i have everything but i can't move the data to the output parameter table .
    could somebody help ?

    Thx RE (and Mani) for the feedback.
    I think that this URL is sufficient to understand how to pass dynamic internal table via RFC function module, whatever it is input or output. This URL says to use a STRING to store the table content in XML format, via CALL TRANSFORMATION ID, and pass this string as parameter. In the calling program, we have to "decode" the XML back into abap data, Just notice that we don't need to create an XSLT, ID is sufficient.
    For any other information, open a new thread, or ask a precise question.

  • How to call a function with generic table parameter

    Hi everybody
    I need to call function module RSAR_ODS_API_GET (from BW). It recive an internal table with request ids and should return in E_T_DATA "unstructured" data from the psa and in E_T_RSFIELDTXT the description of the data structure, I guess
    from sap help only thing I have reggarding how to use the function module is :
    "You can call up the function module RSAR_ODS_API_GET with the list of request IDs given by the function module RSSM_API_REQUEST_GET. The function module RSAR_ODS_API_GET no longer recognizes InfoSources on the interface, rather it recognizes the request IDs instead. With the parameter I_T_SELECTIONS, you can restrict reading data records in the PSA table with reference to the fields of the transfer structure. In your program, the selections are filled and transferred to the parameter I_T_SELECTIONS.
    The import parameter causes the function module to output the data records in the parameter E_T_DATA. Data output is unstructured, since the function module RSAR_ODS_API_GET works generically, and therefore does not recognize the specific structure of the PSA. You can find information on the field in the PSA table using the parameter E_T_RSFIELDTXT."
    unfortunately I when running de report bellow, I get a dump which says:
    Function parameter "E_DATA" is unknown
    in the definition of the interface E_DATA has no type, which  means it can recive any table type, right?
    So I have two questions?
    1) How to get the code working
    2) How do I use the parameter E_T_RSFIELDTXT to parse the data returned in E_DATA
    by debuging RSSM_API_REQUEST_GET for this code I found it try to put an internal table with the struct of the database table /BIC/B0000151000 in E_DATA
    Thanks a lot for any help
    rgds
    my test report is:
    REPORT  ZTEST_PSA_API.
    TABLES: /BIC/B0000151000 .
    TYPE-POOLS: RSSM.
    TYPES: BEGIN OF STC_REQ_LINE,
      sign(1),
             option(2),
             low  TYPE rsa_request,
             high TYPE rsa_request,
             END OF STC_REQ_LINE,
      IT_REQUEST TYPE STC_REQ_LINE OCCURS 0.
    DATA: lit_request TYPE RSSM_T_API_REQUEST_GET WITH HEADER LINE,
          lc_system TYPE RSSM_T_API_LOGSYS,
          lit_request1 TYPE IT_REQUEST WITH HEADER LINE.
    DATA: lc_dtarget_name TYPE RSA_ODSNAME,
          lit_meta_data TYPE RSARC_T_RSFIELDTXT.
    DATA: lt_psa_data LIKE /BIC/B0000151000 OCCURS 0.
    CALL FUNCTION 'RSSM_API_REQUEST_GET'
      EXPORTING
        I_SOURCE    = '2LIS_13_VDITM'
        I_TYP       = 'D'
        I_DATEFROM  = '20060627'
      IMPORTING
        E_T_REQUEST = lit_request[]
        E_T_LOGSYS  = lc_system
        EXCEPTIONS  = 1.
    READ TABLE lit_request.
    lit_request1-sign = 'I'.
    lit_request1-option = 'EQ'.
    lit_request1-low = lit_request-request .
    APPEND lit_request1 .
    break-point .
    CALL FUNCTION 'RSAR_ODS_API_GET'
      EXPORTING
        I_T_REQUEST = lit_request1[]
      IMPORTING
        E_ODSNAME = lc_dtarget_name
        E_T_RSFIELDTXT = lit_meta_data
      TABLES
        E_DATA = lt_psa_data
      EXCEPTIONS
        NO_DATA_FOUND = 1
        PARAMETER_FAILURE = 2
        REQUEST_NOT_AVAILABLE = 3
        NO_REQUEST_FOUND = 4
        NO_FIELDS_TO_ODS = 5
        NO_ODS_FOUND = 6
        PACKAGE_LOCKED_BY_LOADING = 7 .

    Try to pass table parameter without "[]" :
    CALL FUNCTION 'RSAR_ODS_API_GET'
    EXPORTING
    I_T_REQUEST = lit_request1
    IMPORTING
    E_ODSNAME = lc_dtarget_name
    E_T_RSFIELDTXT = lit_meta_data
    TABLES
    E_DATA = lt_psa_data

  • Table parameter does not contain values in RFC call

    Hello Experts,
    I created RFC in R/3 with table parameter I_CUSTOMER. This RFC will be called by the CRM to pass all the customers data to R/3. The RFC was triggered by CRM passing 20 entries in I_CUSTOMER. However, when the debugger jumps in R/3 the table I_CUSTOMER in R/3 is empty. Can anyone help me to resolve the issue? any idea? thanks in advance!
    Best Regards,
    Alezandro

    Hi Alezandro ..
    what is the type of table parameter I_CUSTOMER u have declared??
    if CRM is passing 20 values through  I_CUSTOMER, u must take
      type <b>TABLE TYPE</b> which is to be created in dictionary.
    if it doesn't helps u ...can u be more clear??
    Ram

  • Dynamic export table parameter

    Hi all
    Currently im having this issue whereby i need a dynamic export table parameter in the function module. this is because there is a dynamic selection from the database and then i do not know what is the reference type for the exporting table. how to define a dynamic reference type. btw im developing on 4.6C

    If you are using an RFC FM it would be different 'cause you always have to type all the parameters.
    In case it's not an RFC, of course you can do it.
    FUNCTION ZJMOTERO.
    *"*"Interfase local
    *"  IMPORTING
    *"     REFERENCE(I_RUTA) TYPE  ZJMOTERO3
    *"  TABLES
    *"      TABLE
    field-symbols: <fs> type table.
    data: a type ref to data.
    data: tabla type table of pa0001.
    select * into table tabla from pa0001 where pernr eq 1.
    assign tabla to <fS>.
    table[] = <fs>[].
    ENDFUNCTION.

  • Component called BANKNAME already exists. already 5 BANKNAME(000015) in dynamic table

    Dear All,
    In R3, company wise bank balance has to display for the given period, after that when i click on company it has to drill down to bankwise balance has to display so i have used two dynamic table to display alv. when i click on company i have got Component called BANKNAME already exists. already 5 BANKNAME(000015).
    Kindly suggest solution.
    Thanks & Regards,
    Ranjini

    When you create a dynamic internal table, don't give twice (or five times) the same name to different fields but use an increment in their names (e.g. BANKNAME01, BANKNAME02, BANKNAME03, etc.
    Regards,
    Raymond

  • Dynamic table sub total.

    Quite new for Jdeveloper11g 1.1.4,
    May I konw is there a solution for dynamic table sub total. eg, when i enter a row in a af:table, the sub total will also changed. any sample is welcomed, Thanks!

    check example: 64.Recalc Sum of Salary at the View Object Level
    in this link:
    http://blogs.oracle.com/smuenchadf/examples/

  • Call same RFC from Web dynpro twice (table parameter passing)

    We have one table on our Iview bind to RFC A output table. We execute the RFC A with input parameters (p1=val1, p2=val2) and the data (task name and chkbox field) gets displayed on Iview table.
    The user will click a select deselect all checkbox to select all rows of the table.
    We want to execute SAME RFC A with input parameters (p1=val3, p2=val4) by passing the Iview table for processing. Please suggest the way to do this.

    Hi Sanjay,
    I am not sure about your requirement. I assume you need to call the same RFC twice, the first time with some simple parameters & the second time with a table parameter. Is this the case? If so:
    You needn't switch data between the contexts. You simply need to check if the RFC is being called when the WD table has some data. If so, add the table parameter to the RFC Input object. Let your WD table be bound to a node 'TableNode' having two attributes - 'task' and 'chk' (chk of type 'boolean'). I assume you need to add the row only if the checkbox has been selected.
    Assuming that your BAPI/RFC uses a table ‘MyTable’ of some type 'ZTAB' and that your RFC call is being done from your view:
    ZTAB table;
    IPrivate<your view>.ITableNodeElement elmt;
    <i>// create an instance of the Input class;</i>
    <BAPI_name>_Input input = new <BAPI_name>_Input ()
    <i>// Populating the RFC Object for the first time call
    i.e when the table node is empty</i>
    if(wdContext.nodeTableNode.size()==0)
    input.setParam1(<some default value>);
    input.setParamN(<some default value>);
    else
    for(int i=0;i<wdContext.nodeTableNode.size();i++)
    elmt = wdContext.nodeTableNode().getTableNodeElementAt(i);
    if(elmt.getChk())
    table = new ZTAB();
    <i>//if you do not know table type of 'MyTable’ , check the function input.add<MyTable> (<table type>)</i>
    table.set<property1>(elmt.getTask());
    <i>// If you need to add more parameters :</i>
    table.set<propertyN>(<your-value>);
    input.add<MyTable>(table);
    wdcontext.node<BAPI_name>_Input().bind(input);
    <i>Now execute the BAPI using the following line</i>
    wdContext.current<BAPI_Name>_InputElement().modelObject().execute();
    wdContext.nodeOutput.invalidate()
    <i>// Refreshes the value in the output node</i>
    Hope this helps,
    Best Regards,
    Nibu.

  • Dynamic table in Oracle report data model using laxical parameter is giving error Ora-00936: missing expression

    Hi ,
    I am using Oracle report 10G
    And trying to create report with dynamic table
    SELECT &COL1, &COL2
    FROM &TAB
    If I put this on data model it gives below error
    ORA-00936: missing expression
    ==> from
    Can anybody advise to solve this issue.
    Regards,
    Brajesh

    Look in the Reports Builder Help:
    If you want to use lexical references in your SELECT clause, you should create a separate lexical reference for each column you will substitute. In addition, you should assign an alias to each lexical reference.
    Does adding the column alias solve the problem?

  • Dynamic table page not passing ID parameter

    I have a page with a simple dynamic table:
    http://www.lenoxweb.net/idea/test10.php.
    BUt it does not show the data in the dynamic table.
    I have attached a record set to the page,and have it set for
    10 records at a time (there are three records in the database
    table); everything looks fine but when I view in Dreamweaver, but
    when I look it on the web, there is no data in the table.
    The URL for the page is:
    http://www.lenoxweb.net/idea/test10.php
    and there is no data there
    I have also attached the code for this simple page.
    I have another page that looks at the exact same data and it
    works fine. When I look at it on the web, it shows all three DB
    entries:
    http://www.lenoxweb.net/idea/control_panel_news.php
    Can anyone tell me why the dynamic table on the page is not
    working properly?
    Regards,
    BIll Schaepe

    Problem solved!
    I found my problem. I wanted the table to show all the data
    from the MySQL table, but I had the Filter set to ID. If I added
    ?ID=1 to the end of the URL, it showed record one.
    So I just took the filter off on the RecordSet, and it works.
    IT shows all records.

  • How to export dynamic table to changing parameter of a method

    Hi ,
    There is one method in which i have created a dynamic table and populated the data now i want to send the same dynamic table which is in the form of field symbol to the changing parameters of the method
    with data

    Hi,
    Check these blogs,
    SAP Developer Network Blog: Dynamic Internal Tables and Structures - ABAP
    SAP Developer Network Blog: Dynamic Internal Table
    Regards,
    Alok Bansal
    Edited by: alok bansal on Dec 6, 2008 10:35 AM

Maybe you are looking for

  • Importing .GIF into Fc will not play the animated gif in output

    I imported a animated .gif  (attached video.gif) into Fc (of a sequence of pics I took saved as an animated .gif) It inported as a "bitmap image" and upon export to swf it did NOT show the .gif as an animated .gif but just shows the first frame.. (It

  • In Free goods how to restrict the quantity to not to alter.

    Dear All, I have maintain condition record for free goods in VBN1.EX.102.While creating sales order for 20 quantities system populates 204.But if am changing this as 152 or 205,system is allowing to do.Same is the case at delivery.How can we restrict

  • HT1550 how to convert a voice memos to MP3

    Hello, I need to convert a voice memo to MP3 then upload to FPT, any ideas? Thanks very much.

  • ARIS for SAP NetWeaver?

    Hi all, 1.What is ARIS? 2.What is ARIS for SAP NetWeaver? 3.How it is related to Solution Manager? Regards Neni

  • Strange look of certain buttons in Safari

    Hi all, Recently, Safari 4.0.3 started displaying certain buttons incorrectly. See http://avhproductions.be/img/screens.png for a screenshot. I tried disabling plug-ins, resetting Safari, repairing permissions et cetera, but no luck. Any ideas?