How to pass dynamic name to a field-symbol?

Hi All,
I have a requirement like I need to create dynamic internal table with dynamic name. Say like,
Create a new Table
   CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
     it_fieldcatalog = it_fieldcat_fin[]
    IMPORTING
     ep_table        = new_table.
    IF sy-subrc EQ 0.
Create a new Line with the same structure of the table.
     ASSIGN new_table->* to <b>(<fs_table>)</b>.
In the above code, (<fs_table>) is a variable. Actually it is in the loop, so that first time it comes, it has to create an internal table with name as <fs_01>, next time <fs_02> and so on. Hope I am clear.
Please help me. I am sure that i will mark the helpful answers.

DATA: DREF TYPE REF TO DATA,WA_REF TYPE REF TO DATA.
FIELD-SYMBOLS: <TEMP_TAB> TYPE TABLE, <TEMP_WA> TYPE ANY.
*&      Form  DYNAMIC_TABLE
      text
-->  p1        text
<--  p2        text
FORM DYNAMIC_TABLE.
  CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
    EXPORTING
      IT_FIELDCATALOG = LT_LVCFIELDCAT
    IMPORTING
      EP_TABLE        = DREF.
  ASSIGN dref->*  TO <TEMP_TAB>.
ENDFORM.                    " DYNAMIC_TABLE
the above is the procedure to create dynamic internal tables.
now <TEMP_TAB> points to the contents of the table table in DREF.
field symbol it self is meant for dynamic.
then y r u using (<fs_table>).
when everytime the same fieldsymbol is pointing to new contents, y u need new name everytime?
i mean as the data is not static, so what is the use of naming a field symbol every time?.
if u want to store the data in an internal table with a name,
then u can do like below,
data: tabname type string, i type i.
concatenate '<fs_' i into tabname.
"let i be the variable which stores the internal tables count
"MOVE <temp_tab> to tabname.

Similar Messages

  • How to fill Dynamic work area or field symbol?

    HI All,
    I have created dynamic work area(field symbol) by using following code. Now I want to fill the work area with values which are there in other internal table.
    * Create dynamic internal table/structure
      call method cl_alv_table_create=>create_dynamic_table
        exporting
          it_fieldcatalog = it_fieldcat
        importing
          ep_table        = dyn_table.
      assign dyn_table->* to <fs_table>.
    * Create dynamic work area and assign to Field Symbol
      create data dyn_line like line of <fs_table>.
      assign dyn_line->* to <fs_wa>.
    My <FS_WA> contains:
    ROW1
    ROW2
    ROW3
    ROW4 as fields in it without having any data.
    I have other internal table.. where I have FIELDS and Data like following:
    FIELD1  FIELD2   FIELD3
    ID1 ROW1 A1
    ID1 ROW2 A2
    ID1 ROW3 A3
    ID1 ROW4 A4
    ID2 ROW1 B1
    ID2 ROW2 B2
    ID2 ROW3 B3
    ID3 ROW1 C4
    Important thing that I have to share with you is... Source table of my Internal table and Source structure to create my dynamic table are same.
    This dynamic table has fields... with "FIELD2" values.
    Thanks,
    Naveen.I

    Create a dynamic internal table
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = lt_fcat
        IMPORTING
          ep_table        = lt_dy_table.
    Create dynamic work area and assign to FS
      ASSIGN lt_dy_table->* TO <fs_dyn_table>.
      CREATE DATA lt_dy_line LIKE LINE OF <fs_dyn_table>.
      ASSIGN lt_dy_line->* TO <fs_dyn_wa>.
    Define WA
      CREATE DATA dref TYPE (iv_struc_name).
      ASSIGN dref->* TO <fs_final>.
    Populate dynamic table from the file
      OPEN DATASET iv_path FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc = 0.
        DO.
          READ DATASET iv_path INTO ls_str.
          IF sy-subrc <> 0.
            ev_failed = abap_true.
            EXIT.
          ENDIF.
          SPLIT ls_str AT ';' INTO TABLE lt_dyn_tab.  " columns
          LOOP AT lt_dyn_tab INTO ls_dyn_tab.
            READ TABLE lt_struc_fld INTO ls_struc_fld INDEX sy-tabix.
            IF sy-subrc EQ 0.
              MOVE ls_struc_fld-fieldname TO ls_fieldname.
              ASSIGN COMPONENT ls_fieldname OF STRUCTURE <fs_dyn_wa> TO <fs_val>.
              IF sy-subrc = 0.
                <fs_val> = ls_dyn_tab.
              ENDIF.
              ASSIGN COMPONENT ls_fieldname OF STRUCTURE <fs_final> TO <fs_val>.
              IF sy-subrc = 0.
                <fs_val> = ls_dyn_tab.
              ENDIF.
            ENDIF.
          ENDLOOP.
          APPEND <fs_dyn_wa> TO <fs_dyn_table>.
          APPEND <fs_final> TO et_table.
          UNASSIGN: <fs_val>.
        ENDDO.
      ENDIF.
      CLOSE DATASET iv_path.

  • How to pass dynamic filename to Receiver JMS channel

    Hi experts,
    I want to pass the dynamic filename to receiver JMS message Properties.
    for example
    I am passing directory name via adapter module AF_Modules/DynamicConfigurationBean with key and value combination like below. How to pass dynamic filename value to a dynamic property ( say DCJMSMessageProperty1)
    eg.
    key.0 - >insert http://sap.com/xi/XI/System/JMS DCJMSMessageProperty0
    value.0 - >  testdirectory ( which is static value)
    Note: Im have not created any ESR object . i just have to bypass the file to a jms queue. I have used AAE integrated configuration scenario ( file to jms )
    Regards,
    Balaji
    Edited by: Balaji Pichaimuthu on Jan 27, 2011 4:45 PM
    Edited by: Balaji Pichaimuthu on Jan 27, 2011 4:46 PM

    Already given link for the dynamic configuration code snippet in the earlier reply... Below is the code snippet
    Note: Use Adapter Specific Message Attributes for the target Communication Channel(CC).Check the indicator for filename in the advanced tab of CC
    //UDF code
    String filename="";
    String NameSpace = "http:/"+"/sap.com/xi/XI/System/JMS";
    try{
          DynamicConfiguration conf = (DynamicConfiguration) param.get(
            StreamTransformationConstants.DYNAMIC_CONFIGURATION);
          DynamicConfigurationKey key  =  DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File",   "FileName");
           // read filename value
           filename = conf.get(key);     
          // So far we extracted filename value .. now do your logic  something like this...
          DynamicConfigurationKey key2 = DynamicConfigurationKey.create(NameSpace,"yourjmsvalue goes here");
           conf.put(key2,filename);
         } catch(Exception e){

  • How to pass column name at run time in function.

    how to pass column name at run time in function as parameter.
    thank in advance
    pramod patel

    Hello,
    Using dynamic sql you can pass column name to function. well I am not getting what you really want to do ? Please write in more detail. By the way I am providing one example here. see it uses dynamic sql.
    Create or replace function fun_updtest (p_columnname_varchar2 in varchar2,
    p_value_number in number)
    return number is
    v_stmt varchar2(500);
    begin
    v_stmt := 'update emp
    set '||p_columnname_varchar2||' = '||to_char(p_value_number)||'
              where empno = 7369';
    execute immediate v_stmt;
    return 0;
    commit;
    end;
    call to this function can be like this..
    declare
    v_number               number;
    begin
    v_number := fun_updtest('SAL',5000);
    end;
    Adinath Kamode

  • How to pass column name as a   values from one page  to another

    hi
    i have created a report(pivot) from a table
    SQL> SELECT * FROM T;
    C1  C2          C3 D                SEQ
    A   AA           2                    1
    A   AB           3                    2
    A   AC           2                    3
    B   AB           5                    4
    B   AC           6                    5
    SQL> SELECT C1
      2  ,NVL(MAX(CASE WHEN C2='AA' THEN C3 END),'') AA
      3  ,NVL(MAX(CASE WHEN C2='AB' THEN C3 END),'') AB
      4  ,NVL(MAX(CASE WHEN C2='AC' THEN C3 END),'') AC
      5  ,SUM(C3) FROM T GROUP BY C1;
    C1          AA         AB         AC    SUM(C3)
    A            2          3          2          7
    B                       5          6         11
    SQL>
    my requirement in Apex is like this(reverse)
    eg-
    when i click on cell values '2' then,it should return
    C1  C2          C3 D                SEQ
    A   AA           2                    1
    {quote}how to pass column name as a  values from one page to another
    for example i have to pass 'c2' as a value to next page{quote}for report pivot you can reffer below link
    Report
    Amu

    thanks for your reply
    i 'm doing what exactly you mention here .
    my problem here is
    i have 15 columns
    i am executing a query based on the values of the column(column name)  in the target page
    1)here i am passing(all) the column values to the next page-but  i want to pass only one column values(column name)
    when i click on any cell of that  column
    OR
    2)i can pass all column name to target page -there(in the target page) i can filter out
    i think option 1 would good if you filter out the unwanted columns
    Regards
    Amul

  • FTP how to pass dynamic filename/directory location - reading a file in 11g

    Hi All,
    We r using FTP adapter(SOA 11g) for getting files in remote server, May i know how to pass dynamic filename and directory where the file exists for reading in server.
    Thanks,
    Rak

    Hey according to my understanding, the Dynamic partner links are set only for the Outbound invocations only. Is my understanding right? if so, how do we create the dynamic partnerlinks for the ftp get kind of stuff...??
    Thanks in advance

  • How to pass dynamic selection to logical databse using ldb_process function

    dear friends,
                         can anybode tell me how to pass dynamic selection to the logical database when i m using LDB_PROCESS function module.  however, in EXPRESSIONS paramter of the function module i m  passing the selecti-option, it is passing their also but when i used more than  two select-option or paramter it throw an exception FREE_SELECTIONS_ERROR.
    SO PLEASE GUIDE ME HOW TO PASS MORE THAN TWO SELECT-OPTION IN LOGICAL DATANSE DYNAMICALLY USING LDB_PROCESS.

    would be nice if you post the answer to all

  • How to pass user name and password in openConnection method ?

    Hi, Exports,
              I am trying to post data from applet to another application which is
              protected by network password.
              How to pass user name and password when I use openConnection method? In java
              doc, this method looks like do not accept these two parameters.
              Thanks
              ----- my code in applet ---------
              URL url = new URL("http://127.0.0.1/xml/index.cfm");
              URLConnection connection = url.openConnection();
              connection.setDoInput(true);
              connection.setDoOutput(true);
              connection.setUseCaches(false);
              connection.setAllowUserInteraction(false);
              DataOutputStream dos = new DataOutputStream(connection.getOutputStream());
              dos.writeBytes("POST " + path + " HTTP/1.0\r\n");
              dos.writeBytes("Referer: http://127.0.0.1/XML/index.cfm\r\n");
              dos.writeBytes("Content-Type:
              multipart/form-data;boundary=---------------------------7d0b414b04\r\n");
              dos.writeBytes("Host: "+host+":"+port+"\r\n");
              dos.writeBytes("Content-Length:" + buff.length()+"\r\n");
              dos.writeBytes("Connection: Keep-Alive\r\n\n");
              dos.writeBytes("-----------------------------7d0b414b04\r\nContent-Dispositi
              on: form-data;name=\"xmlDoc\"\r\n\r\n");
              dos.writeBytes(buff.toString());
              dos.writeBytes("\r\n-----------------------------7d0b414b04--\r\n");
              dos.close();
              

    you need to negotiate Authentication in ur applet code...
              For example:
              If u r using Form based auth u need to send Post a request with j_user_name &
              j_password to the action j_security_check. and when server returns back the
              cookie
              u need to hold it and pass that cookie to the each and every request made to the
              protected application.
              Basically u need to imitate the browser.
              regards
              aseem
              David wrote:
              > Hi, Exports,
              >
              > I am trying to post data from applet to another application which is
              > protected by network password.
              > How to pass user name and password when I use openConnection method? In java
              > doc, this method looks like do not accept these two parameters.
              >
              > Thanks
              >
              > ----- my code in applet ---------
              > URL url = new URL("http://127.0.0.1/xml/index.cfm");
              > URLConnection connection = url.openConnection();
              > connection.setDoInput(true);
              > connection.setDoOutput(true);
              > connection.setUseCaches(false);
              > connection.setAllowUserInteraction(false);
              > DataOutputStream dos = new DataOutputStream(connection.getOutputStream());
              > dos.writeBytes("POST " + path + " HTTP/1.0\r\n");
              > dos.writeBytes("Referer: http://127.0.0.1/XML/index.cfm\r\n");
              > dos.writeBytes("Content-Type:
              > multipart/form-data;boundary=---------------------------7d0b414b04\r\n");
              > dos.writeBytes("Host: "+host+":"+port+"\r\n");
              > dos.writeBytes("Content-Length:" + buff.length()+"\r\n");
              > dos.writeBytes("Connection: Keep-Alive\r\n\n");
              > dos.writeBytes("-----------------------------7d0b414b04\r\nContent-Dispositi
              > on: form-data;name=\"xmlDoc\"\r\n\r\n");
              > dos.writeBytes(buff.toString());
              > dos.writeBytes("\r\n-----------------------------7d0b414b04--\r\n");
              > dos.close();
              >
              > ------------------------------------------
              

  • How to move a dynamic variable to a FIELD-SYMBOL

    Hello:
    i would like to ask a favor i have been trying to move a dynamic variable to a FIELD-SYMBOL but, when i compile the programm it send a error message that say 'error with assign'.
    The FS is declared like this
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE, <dyn_wa>.
    and then there is a PERFORM that send a dynamic varible and then this variable is asigned to the <dyn_table> and after of this one variable is created like this CREATE DATA wa_dynamic LIKE LINE OF <dyn_table>.
    and finalilly there is a sentences where i trying to send the wa_dynamic to the <dyn_wa>.
    here is where the error appear.
    if you have any tips for this problem i will appreciate.
    thanks a lot
    Definition of FS
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE, <dyn_wa>.
    PERFORM
    Create dynamic internal table and Assign it to Field Symbol
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fldcat
        IMPORTING
          ep_table        = it_dynamic.
      ASSIGN it_dynamic->* TO <dyn_table>.
    Create dynamic work area and assign to FS
    CREATE DATA wa_dynamic LIKE LINE OF <dyn_table>.
    ASSIGN wa_dynamic->* TO <dyn_wa>. "HERE IS THE PROBLEM

    How is wa_dynamic defined?
    data: wa_dynamic type ref to data.
    Regards,
    Rich Heilman

  • Create Dynamic Structure based on Field-Symbol

    Hi Experts!!
    I need to create a structure with dynamic structure included within.
    I have a parameter on sel. screen in which we provide table name.
    PARAMETERS: p_table TYPE tabname.
    FIELD-SYMBOLS: <gt_data> TYPE ANY TABLE.
    CREATE DATA gr_data TYPE TABLE OF (p_table).
    ASSIGN gr_data-* TO <gt_data>.
    Now I need a structure like below:
    TYPES: BEGIN OF type_test,
    struct TYPE <gt_data>, " dynamic structure based on table name entered on sel. screen
    fld1 TYPE c,
    fld2 TYPE n,
    END OF type_test.
    Can somebody suggest how to achieve this?
    Your help is highly appreciated. Thanks a lot

    You can view this thread where our friend Marcin rocks .. Dynamically create a type
    FIELD-SYMBOLS: <gt_data> TYPE ANY TABLE.
    FIELD-SYMBOLS: <gs_wa> TYPE ANY.
    data:wf_ref type ref to data.
    DATA:i_comp TYPE cl_abap_structdescr=>component_table,
         i_tot_comp TYPE cl_abap_structdescr=>component_table.
    CREATE DATA gr_data TYPE TABLE OF (p_table).
    ASSIGN gr_data-* TO <gt_data>.
    create data wf_ref like line of <gt_data>.
    assign wf_ref->* to <gs_wa>.
    *--Getting Compoents from existing type
      lf_struct ?= cl_abap_typedescr=>describe_by_name( '<GS_WA>' ).
      i_comp = lf_struct->get_components( ).
      APPEND LINES OF i_comp TO i_tot_comp.
    The idea is Get all the field details available it to i_tot_comp, then append individual fields manually to
    i_tot_comp as explained in the link and create a dynamic structure and table.

  • Dynamic Work Area and field symbol

    Hi All,
    I'm have a big internal table like this
    data: begin of data occurs 0,
    Field01,
    Field02,
    Field03,
    *bucket 1
    Field04,
    Field05,
    Field06,
    *bucket 2
    Field04,
    Field05,
    Field06,
    *bucket 3
    Field04,
    Field05,
    Field06,
    Field 1, 2 3 will be the same for pernr, first last name.
    Field 4, 5, 6 are the same format but different numbers (or values ) in different buckets.
    Each bucket can be shown (or not) based on the condition of a person, for example if that person live in 2 states, it will show 2 bucket with 2 address info inside each.
    I will run this under get pernr to sort out each person who have many address or not.
    Can I use dynamic work area and field symbol here? if I can, how?
    Really appreciate your help with points...

    You can use the ASSIGN COMPONENT ... and than APPEND the work area to the table.
    Check out this sample program:
    REPORT  ZTEST_NP.
    DATA: BEGIN OF ITAB OCCURS 0,
          F1    TYPE I,
          F2    TYPE I,
          F3    TYPE I,
          END   OF ITAB.
    DATA: WA_ITAB LIKE ITAB.
    DATA: L_CNT TYPE I.
    FIELD-SYMBOLS: <F_FLD> TYPE ANY.
    DO 10 TIMES.    " I want 10 reocrds
      CLEAR L_CNT.
      DO 3 TIMES.   " I have 3 fields
        L_CNT = L_CNT + 1.
        ASSIGN COMPONENT L_CNT OF STRUCTURE WA_ITAB TO <F_FLD>.
        <F_FLD> = L_CNT.
      ENDDO.
      APPEND WA_ITAB TO ITAB.
      CLEAR  ITAB.
    ENDDO.
    LOOP AT ITAB INTO WA_ITAB.
      WRITE: / WA_ITAB-F1,
               WA_ITAB-F2,
               WA_ITAB-F3.
    ENDLOOP.
    Regards,
    Naimesh Patel

  • How to copy the structure of a Field Symbol?

    Hi,
              I have a requirement where in a dynamic Internal table is supposed to be created. I have created that dynamic table using the class method cl_alv_table_create=>create_dynamic_table. Here I have a structure in the field symbol. My requirement is how do I create a internal table with the structure that is there in the field symbol?...
    and i'm unable to refer to the field that is dynamically created in the field symbol.
    Like,
    <gfs_tab>-pernr = itab-pernr.
    in the above stmt the field pernr is created in the field symbol dynamically.
    Thanks,
    Deepak.

    Hi Matt,
                my objective is to create an internal table with structure that i have obtained in <gfs_tab> .
    other than the pernr, there are many fields dynamically generated.
    say if I have generated the following structure in <gfs_tab> :
    pernr            ename1            day1             day2                 day3
    then I want to create an internal table with the above structure so that my internal table will have fields:
    1) pernr
    2) ename1
    3) day1
    4) day2
    5) day3
    for each execution of the report there will be different structure generated in <gfs_tab> depending upon the inputs that I give.
    Thanks,
    Deepak.

  • How to assign ranges ( select-option)to field symbol

    Hi ,
    I have following scenario
    ranges : r_test1 for agr_1251,
                 r_test2 for agr_1251.
    In runtime i am getting which range i have to populate in a field v_rname.for now let it me v_rname  = 'r_test2'
    i want to assign (v_rname ) to <field -symbol> ie is range to field symbol.
    and i want to update the <field -symbol>-sign ='I'
                                        <field -symbol>-LOW ='some value'
                                        append <field -symbol>.
    This is the logic i want to follow,  for this how should i have to declare the field symbol ? I couldn't assign a range to field symbol . Please help me.
    thanks
    Murali

    Try this
    FIELD-SYMBOLS : <field_symbol>  TYPE ANY TABLE.
    ASSIGN (v_rname) to <field_symbol>.
    <field -symbol>-sign ='I'
    <field -symbol>-LOW ='some value'
    append <field -symbol>.
    This should work because your range is a table.
    Hope this helps you.

  • Creating dynamic internal table(Not field symbol table)

    Hi Experts,
    I am facing problem creating Intarnal table
    I have fieldcatalog, I want create dynamic internal table(Not field symbol table).
    I have written----
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
       i_style_table             =
         it_fieldcatalog           = it_fldcat
          it_fieldcatalog           = me->gt_fieldcat
       i_length_in_byte          =
        IMPORTING
          ep_table                  = lt_new_table
       e_style_fname             =
        EXCEPTIONS
         generate_subpool_dir_full = 1
         OTHERS                    = 2.
        ASSIGN lt_new_table->* TO <gt_dyn_repdata>.
        CREATE DATA ls_new_line LIKE LINE OF <gt_dyn_repdata>.
        ASSIGN ls_new_line->* TO <gs_dyn_repdata>.
    above logic creating dynamic field symbol table.... But I want create normal internal table.
    Thanks,
    Rajasekhar

    Hi
    What do you mean?
    It needs to use the field-symbol, this is the price to pay if it wants a dynamic object
    Max

  • How to check data type of the field symbol at run time

    Hi,
    My code is as following:
          LOOP AT <fs> ASSIGNING <wa_covp_ext>.
            ASSIGN COMPONENT 86 OF STRUCTURE <wa_covp_ext> TO <f_zzname>.
            IF sy-subrc = 0.
              ASSIGN COMPONENT 158 OF STRUCTURE <wa_covp_ext> TO <f_pernr>.
              IF sy-subrc = 0.
                  SELECT SINGLE sname INTO <f_zzname> FROM pa0001
                                WHERE pernr = <f_pernr>
                                AND endda GE sy-datum
                                AND begda LE sy-datum.
             ENDIF.
          ENDIF.
        ENDLOOP.
    This query is giving dump when <f_zzname> is type P length 8 and decimals 2, because it tries to put PA0001-sname into it which is type C length 30. So I want to check the type of <f_zzname> before the select statement. If it is character 30, then I will write the select statement else not.
    How to check data type of the field symbol at run time? If it's not possible, then can somebody suggest a workaround? Thanks.

    check this ...
    write describe statement  ...
    field-symbols : <f_zzname> .
    data : sname like pa0001-sname,
           typ(10).
    assign sname to  <f_zzname>.
    describe  field <f_zzname> type typ.
    write : typ. <-- typ contains character type in this case ..
    U can check if typ is of character(C) if so .. write the select statement ...

Maybe you are looking for

  • Transportation Module In Third party process

    Dear Gurus, Required to implement transportation module in third party process and we do not want to take material in. Division directly doing invoice against sales order. S.O. P.O. Invoice thanks Please revert if required more information.

  • Cross domain error while displaying .SWF files in  portal

    Hi Experts, i am working on EP , i am trying to display a .swf file in a iview but that file is  giving an error as Add a cross domain policy file to the external data web server this swf file is retriving data from BI system. Please suggest !! i got

  • Will boot camp support windows XP? thanks.

    hello. does anyone kow if boot camp will support windows XP? thanks.

  • Help on Database design

    Hi Folks, I'm assigned to create a database to test for OLTP before it is used in production. Can you please advice me on how to determine the capacity planning. Do we have any benchmarking for the initilization parameter sizing. Seeking expertise ad

  • Menu directory setting does not stay when I set it.

    I am using 6.1.  I changed the location of the library directory (under tools options) and at first I thought I also wanted my menu directory to be in the same place.   So I set that way and  closed LV and restarted.  Later I decided that I wanted th