ActionForm with Dynamic Fields/#Fields

I'm new to struts (and JSP for that matter) and I'm having some difficulty setting up particular actionForm and actionForward.
What I want to do is based off a value selected from a drop down present the user with different sets of "volumes" to enter.
I'm placing a collection of volumeBeans in my actionForm as a bean property.
like so
     private ArrayList volumeList;
     * Indexed getter for property volume.
     * @param index Index of the property.
     * @return Value of the property at <CODE>index</CODE>.
    public Collection getVolumeList() {         
        return volumeList;
    public void setVolumeList(Collection list){
        volumeList = (ArrayList)list;
    public volumeBean getVolume(int index){
     return (volumeBean)volumeList.get(index);   
    public void setVolume(int index,volumeBean vol){
        volumeList.set(index, vol);
...I iterate through the collection using a struts iterate tag
like so
     <logic:iterate id="vol" name="sprDataForm" property="volumeList" indexId="ctr" >
     <tr>
         <%-- Writing out vol.volumeName --%>
         <td><bean:write name="sprDataForm" property='<%="volume["+ ctr + "].volumeName"%>'/></td>
         <%-- want to get/store volumeQuantity in sprDataForm.volume[index].quantity --%>
         <td><html:text name="sprDataForm" property='<%="volume["+ ctr + "].quantity"%>'/></td>
         <%-- --%>
         <td><bean:write name="sprDataForm" property='<%="volume["+ ctr + "].unitOfMeasure"%>'/></td>
     </tr>         
    </logic:iterate>
...Now this works fine if I hardcode the values of the volumeList into the actionForm constructor but what I want to be able to do is set the volumeList inside of an LookupDispatchAction actionForward in such a manner that when the page loads the first time the volumeList is empty but after triggering a specific action forward the list gets populated on other values in the form.
like so
public ActionForward pre(ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response)
            throws IOException, ServletException {
        ArrayList volumeList = new ArrayList(3);
        volumeBean a = new volumeBean("Volume A", "vol_ID_a", "tDesc", "Number of Boxes ");
        volumeBean b = new volumeBean("Volume b", "vol_ID_b", "tDesc", "Number of Envelopes");
        volumeList.add(a);
        volumeList.add(b);
        volumeList.trimToSize();    
        SprDataForm sprDataForm = (SprDataForm)form;
        sprDataForm.setVolumeList(volumeList);
        // finds the action mapped to sucess and forwards to that page
        return(mapping.findForward("loopback"));
...currently i've mapped the action to one of my buttons (I will change this later ). The volumeList does populate and the page does reload with the correct fields/values
displayed but when I try to submit the page again (with an empty ActionForward) I get the following error
java.lang.IllegalArgumentException: No bean specified
     org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:837)
     org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:934)
     org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
     org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
     org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805)
     org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
     org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
     org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:767)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
     sun.reflect.GeneratedMethodAccessor540.invoke(Unknown Source)
     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     java.lang.reflect.Method.invoke(Method.java:324)
     org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
     java.security.AccessController.doPrivileged(Native Method)
     javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
     org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
     org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
I'm wondering If i'm just missing somethign obvious or If my approach is fundamentally flawed

I'm new to struts (and JSP for that matter) and I'm having some difficulty setting up particular actionForm and actionForward.
What I want to do is based off a value selected from a drop down present the user with different sets of "volumes" to enter.
I'm placing a collection of volumeBeans in my actionForm as a bean property.
like so
     private ArrayList volumeList;
     * Indexed getter for property volume.
     * @param index Index of the property.
     * @return Value of the property at <CODE>index</CODE>.
    public Collection getVolumeList() {         
        return volumeList;
    public void setVolumeList(Collection list){
        volumeList = (ArrayList)list;
    public volumeBean getVolume(int index){
     return (volumeBean)volumeList.get(index);   
    public void setVolume(int index,volumeBean vol){
        volumeList.set(index, vol);
...I iterate through the collection using a struts iterate tag
like so
     <logic:iterate id="vol" name="sprDataForm" property="volumeList" indexId="ctr" >
     <tr>
         <%-- Writing out vol.volumeName --%>
         <td><bean:write name="sprDataForm" property='<%="volume["+ ctr + "].volumeName"%>'/></td>
         <%-- want to get/store volumeQuantity in sprDataForm.volume[index].quantity --%>
         <td><html:text name="sprDataForm" property='<%="volume["+ ctr + "].quantity"%>'/></td>
         <%-- --%>
         <td><bean:write name="sprDataForm" property='<%="volume["+ ctr + "].unitOfMeasure"%>'/></td>
     </tr>         
    </logic:iterate>
...Now this works fine if I hardcode the values of the volumeList into the actionForm constructor but what I want to be able to do is set the volumeList inside of an LookupDispatchAction actionForward in such a manner that when the page loads the first time the volumeList is empty but after triggering a specific action forward the list gets populated on other values in the form.
like so
public ActionForward pre(ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response)
            throws IOException, ServletException {
        ArrayList volumeList = new ArrayList(3);
        volumeBean a = new volumeBean("Volume A", "vol_ID_a", "tDesc", "Number of Boxes ");
        volumeBean b = new volumeBean("Volume b", "vol_ID_b", "tDesc", "Number of Envelopes");
        volumeList.add(a);
        volumeList.add(b);
        volumeList.trimToSize();    
        SprDataForm sprDataForm = (SprDataForm)form;
        sprDataForm.setVolumeList(volumeList);
        // finds the action mapped to sucess and forwards to that page
        return(mapping.findForward("loopback"));
...currently i've mapped the action to one of my buttons (I will change this later ). The volumeList does populate and the page does reload with the correct fields/values
displayed but when I try to submit the page again (with an empty ActionForward) I get the following error
java.lang.IllegalArgumentException: No bean specified
     org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUtils.java:837)
     org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:934)
     org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
     org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
     org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805)
     org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
     org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
     org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:767)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
     sun.reflect.GeneratedMethodAccessor540.invoke(Unknown Source)
     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     java.lang.reflect.Method.invoke(Method.java:324)
     org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
     java.security.AccessController.doPrivileged(Native Method)
     javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
     org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
     org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
I'm wondering If i'm just missing somethign obvious or If my approach is fundamentally flawed

Similar Messages

  • How to convert internal table with dynamic fields to XML

    Dear all,
    I met a problem like the following:
    The aim is to transform the following parameter to XML
    IT_FIELD stores the dynamic filed name of the internal table,with these fields, the dynamic internal can be created by cl_abap_tabledescr=>create(it_field)
    IT_VALUE stores the value of the internal table dynamically created with dynamic fields.
    For example
    IT_FIELD =>
    line1: FIELD1
    line2: FIELD2
    line3: FIELD3,
    three lines in this internal table.
    dynamically created internal table structure FIELD1 FIELD2 FIELD3
    And IT_VALUE=>
    1          2          3   (First line)
    11        22        33
    two lines of data.
    Do you have any idea about how to transform the IT_VALUE to XML here? And also the transformed XML to the IT_VALUE.( we may need remember IT_FIELD here for later XML to IT_VALUE.)
    Hope I describe the problem clearly.
    Any inputs will be appreciated.
    Edited by: Max Tang on Jan 12, 2009 3:46 PM
    Edited by: Max Tang on Jan 12, 2009 4:14 PM

    Hi,
    you need to implement a bit of coding for that.
    With the 'do varying' statement abap provides a loop over those fields. Within this loop you can build up a new internal table with one entry for each period and amount.
    kind regards
    Siggi
    PS: I am not very familiar with CO, but I guess there will be a standard extractor for that.

  • Dynamic Internal Table with Dynamic Fields

    Hi all,
    My scenario is fairly simple----
    --> End user clicks a button on screen and he gets the list of HR tables.
    --> Then selects a table and list of all the fields for that table gets displayed.
    --> He/she selects the fields they want data to be retrieved for.
    So, the requirement is, the dynamic internal table should get created with the fields selected.
    The select statement should only retrieve fields which were selected by the end user
    and from the table selected by the end user.
    I  believe the fields selected by end user can be passed by a variable of  type string.
    something like this---
    select (fields)
    from (p_table)        " Table selected by end user
    into  dynamic internal table.   " should contain columns selected by end user"
    Appreciate your inputs and guidance.
    Warm regards,
    Hari Kiran

    TYPE-POOLS :ABAP.
    Parameters P_TAB      TYPE        DDOBJNAME.
    DATA  : GO_LINE_TYPE  TYPE REF TO CL_ABAP_STRUCTDESCR,
            GO_TABLE_DESC TYPE REF TO CL_ABAP_TABLEDESCR,
            GS_COMPONENTS TYPE        ABAP_COMPONENTDESCR,
            GT_COMPONENTS TYPE        ABAP_COMPONENT_TAB,
            GR_TAB        TYPE REF TO DATA,
            GT_FIELDS  TYPE TABLE OF DFIES WITH HEADER LINE.
    FIELD-SYMBOLS: <GT_TABLE> TYPE TABLE,
                   <GS_TABLE> TYPE ANY,
                   <GV_VALUE> TYPE ANY.
    CALL FUNCTION 'DDIF_FIELDINFO_GET'
      EXPORTING
        TABNAME              = P_TAB
    *   FIELDNAME            = ' '
    *   LANGU                = SY-LANGU
    *   LFIELDNAME           = ' '
    *   ALL_TYPES            = ' '
    *   GROUP_NAMES          = ' '
    *   UCLEN                =
    * IMPORTING
    *   X030L_WA             =
    *   DDOBJTYPE            =
    *   DFIES_WA             =
    *   LINES_DESCR          =
    TABLES
        DFIES_TAB            =  GT_FIELDS
    *   FIXED_VALUES         =
    EXCEPTIONS
       NOT_FOUND            = 1
       INTERNAL_ERROR       = 2
       OTHERS               = 3.
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT GT_FIELDS.
      CLEAR GS_COMPONENTS.
      GS_COMPONENTS-NAME  = GT_FIELDS-FIELDNAME.
      GS_COMPONENTS-TYPE ?= CL_ABAP_STRUCTDESCR=>DESCRIBE_BY_NAME( GT_FIELDS-ROLLNAME ).
      APPEND GS_COMPONENTS TO GT_COMPONENTS.
    ENDLOOP.
    GO_LINE_TYPE  = CL_ABAP_STRUCTDESCR=>CREATE( GT_COMPONENTS ).
    GO_TABLE_DESC = CL_ABAP_TABLEDESCR=>CREATE( GO_LINE_TYPE ).
    CREATE DATA:  GR_TAB TYPE HANDLE GO_TABLE_DESC.
    ASSIGN:  GR_TAB->* TO <GT_TABLE>.
    SELECT * FROM (P_TAB) APPENDING CORRESPONDING FIELDS OF TABLE <GT_TABLE>.
    LOOP AT <GT_TABLE> ASSIGNING <GS_TABLE>.
      NEW-LINE.
      DO.
        ASSIGN COMPONENT SY-INDEX OF STRUCTURE <GS_TABLE> TO <GV_VALUE>.
        IF SY-SUBRC NE '0'.
          EXIT.
        ENDIF.
        WRITE : <GV_VALUE>.
      ENDDO.
    ENDLOOP.

  • Send form with dynamic fields to guided procedure

    Hi all,
    i am just wondering if GP is able to map fields from the interactive form that is dynamic.
    for example, the request invoice form sometimes may contain more than one records. however, with my limited knowledge on GP, i believed mapping can only be done from ONE input parameter to ONE output parameter?
    pls kindly advise..

    Hi Ashutosh,
    Yeah i have context attribute of type byte which has the image source but the problem is when i am trying to pass (as given in the above metioned blog) the image source from Web Dynpro to Guided procedure (which has Web Dynrpo DC as CO), i was not able to find any image in Guided procedure. So is there any way to make it possible?
    I cant hav attribute as String since i use an Upload UI element to upload the pdf from local machine. Only if i have the context attribute as byte the image is visible in the form once the Pdf if upload from local machine
    i follow this blog for my Web Dynpro DC as CO in Guided procedure
    The specified item was not found.
    Thanks
    Gopal.

  • Does JSF support component with dynamic fields?

    Webapps forms usually map a input text field to a java bean property. This mapping is one to one. I would like to know if the JSF can handle the situation where a form is dynamically generated with variable number of fields (eg. check boxes) and having all the values post back to the server without having a java bean mapping (because the fields is not known) and still be able to collect the values on the server.
    Any help is appreciated.

    ckx,
    The components don't require a model reference (i.e. assocaition with a JavaBean). You can access all of the components on the posting page on the server, so you could definitely get all of the values that way. You can build up the tree dynamically as well.
    So the short answer is yes :-).
    <<KM>>

  • Help with Dynamic field replacement

    Hi,
    This is my problem. I have a table with two columns - PRINT , NAME.
    The data in the two columns are : ("My name is <?NAME?>", "Micheal")
    In BI Pub, I wrothe the dataset as " select PRINT, NAME from TABLE "
    In templete builder, what should I do to get the final output as *" My name is Micheal"*
    But I am getting "My name is <?NAME?>" I need to replace "<?NAME?>" with "Micheal". i.e dynamic Merge field replacement with in a field.
    Hope I made it clear.....Help would be appreciated. I am a newbie here !!
    Edited by: user2899051 on May 12, 2009 7:49 AM

    You cannot parse the string as element :)
    so , its not possible, you are trying to build the template from DB Table.
    <?NAME?> , this syntax will be parsed by tempalte.
    If you put it in String in XML. like [ MY Name is "<?NAME?>"] , it will considered as String. and not as a data element to be parsed.
    Its not possible.
    Instead of doing this,
    <ROW>
    <PRINT>Letter from</PRINT>
    <TOBEPRINTED>1</TOBEPRINTED>
    <NAME>Canaopy</NAME>
    <ADDRESS> NY</ADDRESS>
    </ROW>
    - <ROW>
    <PRINT>Send letter to </PRINT>
    <TOBEPRINTED>2</TOBEPRINTED>
    <NAME>Mann</NAME>
    <ADDRESS> CA</ADDRESS>
    </ROW>
    </ROWSET>
    If you can get the TOBEPRINTED column,
    which indicates
    what to be printed.
    1- name
    2- Address
    we can write a if statement in template to display based on the value.
    But again the position will be a problem, multiple replacement will be a problem
    its like, creating the logic of display template in XML.

  • Weblink with dynamic field value, plus wildcard

    I am trying to use the weblink functionality to access a SharePoint site where images are saved. Contained within the image name is a field value in the CRM, but the name may have other characters in it as well. Plus, there might be more than one image that matches the request.
    Rather than re-naming the hundreds of images on the site to work with standard weblink passing the field value, I'd like to be able to add a wildcard to the weblink so that it can pick all images containing that value. I've tried using the /*%%%FIELDNAME%%%, but that hasn't worked.
    Any ideas?

    This can not be done with a Weblink to your sharepoint server alone because it's conceptually flawed. Weblink points to One_ specific web address or file.
    Here is a test. In your IE, you could go to Files --> Open --> Navigate to the folder, which contain the images --> Put *.jpg (or whatever the format you are using) --> Click Open. Nothing is going to happen. The reason, behind it, is you didn’t specify one and only one address or file.
    Another test. Try to type in the full path of the folder, which holds the image files, in your IE address field. It should take you to the folder. If you attach *.jpg behind the address, you would get an error.
    The only way to do this is to have a search engine in a web page, Google image search as an good example. This is probably more work than renaming the files or updating your records.
    Regards,
    Shilei

  • Custom ItemRenderer with dynamic field associations?

    Hi All,
    I'm trying to create a custom itemrender control that isn't tied to a specific type of data input. I'm creating a thumbnail itemrenderer to be used with the Sparks List control:
    <?xml version="1.0" encoding="utf-8"?>
    <s:ItemRenderer
    xmlns:fx="
    http://ns.adobe.com/mxml/2009" xmlns:s="
    library://ns.adobe.com/flex/spark" xmlns:mx="
    library://ns.adobe.com/flex/mx" autoDrawBackground="
    true"
    >
    <s:layout>
    <s:BasicLayout/>
    </s:layout>
    <mx:Image left="
    5" right="
    5" bottom="
    25" top="
    5" id="
    img_thumbnail"source="
    {data.image}"
    />
    <s:Label
    left="
    5" right="
    5" bottom="
    5" verticalAlign="
    middle" textAlign="
    center" id="
    lbl_label" fontWeight="
    bold" fontSize="
    10"text="
    {data.label}"
    /></s:ItemRenderer>
    However, as you can see, the image source and label text properties are tied to specific fields in the data collection (image and label). I would like to provide a way to figure out what the label and icon fields are set to in the parent control, and set them accordingly in the itemrenderer. This should allow me to use the same itemrenderer with different objects, as long as they have a text and image property.
    Any ideas? Thanks

    After doing some research, I found my answer:
    1) The data object is the current item which the List component is populated with. You can access any properties of the object using it. (Not what I'm looking for here.)
    2) You can access the label property set by the labelField or labelFunction properties of the list control in the item renderer simply using this.label. This is exactly what I was looking for.

  • User inputted letters with dynamic fields in Report Builder

    I'm proactively trying to get certain aspects off our hands in IT and more specifically, the way letters are generated through ColdFusion.  Right now we are using activeX controls (with some vbscript and asp pages) through IE to do Word mail merges for letter's for our students.  We would like the user to be able to change these letters by themselves through our web application and have them saved in our database so they can be stored as a future template.
    Now I'm new to Report Builder and have a few examples to show my colleagues, but I'm having troubles being able to dynamically insert the student's name (for example) into the report.
    So basically I have an empty template with a huge dynamic box for the text which reads #param.MessageBody# that comes from a textarea within the cfm page.  That works, but taking it one step further, I want to replace all instances of "%%StudentName%%" within that MessageBody with the actual student's name.
    Since I cannot loop over the report and do my usual ReplaceNoCase(lMessageBody, "%%StudentName%%", Trim(ReportQueryLetters.StudentName), "ALL")>, how can I put this into a built-in function into the report?
    I figured the function needs to be in <cffunction name="BeforeExport"> and while a simple display of the message works perfectly, I cannot get my replace line to work.  I am passing the query to Report Builder instead of having it built-in, is that my problem?!  I would prefer if it was external to save my stored procedures if I can.  Is there any way to call the query to get that line to work?!
    The code inside the cffunction (in report Builder):
    <cfargument name="lTextArea">
    <cfset lTextArea = #form.frmTextArea#>
    <cfset lTextArea = ReplaceNoCase(lTextArea, "%%StudentName%%", Trim(ReportQueryLetters.StudentName), "ALL")>
    <cfreturn lTextArea>
    The error:
    Element STUDENTNAME is undefined in REPORTQUERYLETTERS.           

    Sorry for the late reply, just got back from vacation.
    I don't think you use ReportQueryLetters for the query.  it should be
    query.StudentName
    Also, you can have an intermediate step on the page that receives the
    MessageBody and change the MessageBody before passing it as a parameter to the
    report.

  • Sum for Dynamic Fields in a Dynamic Table with Field Symbol

    Hi All,
    I currently have an report which I am looking to update with some totals.  The information is currently output in an ALV which is fed data from a dynamic table defined with a field symbol.  The modification that needs to be applied is a summation per currency code where each of the fields to be summed is a dynamically named field at runtime.  I am now just looking to see if anyone has any recommendations on how to obtain these totals it would be appreciated.  I have no problem doing the leg work in piecing the solution together but am just stuck on which approach I should be investigating here.  I have looked into several options but do to the fact that the totals are for dynamic fields in a dynamic table and it is a field symbol I am having some difficulties thinking of the easiest approach to obtain these totals.
    Below is a simple sample of what the report currently looks like and what we are looking to add.
    ====================================================================================
    As-Is Report:
    DETAILED DATA ALV
    Company Code  |  Plant  |  2006 Total  |  2007 Total  |  2008 Total |  CURRENCY
    0001          |   ABCD  |    1,500     |    1,200     |    1,700    |    USD
    0001          |   BCDE   |    2,300     |    4,100     |    3,600    |    GBP
    0003          |   DBCA  |    3,200     |    1,600     |    6,200    |    USD
    Addition 1:
    TOTALS PER CURRENCY
    Currency                |  2006 Total  |  2007 Total  |  2008 Total |
    USD              |    4,700     |    2,800     |    7,900    |
    GBP                       |    2,300     |    4,100     |    3,600    |
    Addition 2:
    CONVERSIONS TO USD
                                          |  2006 Curr   |  2006 USD    |  2008 Curr   |  2006 USD   |
    USD                       |  4,700 USD   |  4,700 USD   |  7,900 USD  |  7,900 USD  |
    GBP   (1.5GBP/1 USD)    |  2,300 GBP   |  1,150 USD   |  2,300 GBP  |  1,800 USD  |
    ====================================================================================
    Any recommendations will be appreciated.

    Hi,
    We cannot use the key word SUM in the loop at assigning statement.
    The way i see is
    When  you are creating the first dynamic internal table , create one more with  the structure below:
    Currency | 2006 Total | 2007 Total | 2008 Total |
    Then while populating the data into first itab,also move the contents to the second itab using collect statement.

  • Set value in tabular form field with dynamic action

    Hi Guys,
    I have a dummy field in a tabular form which I am trying to use to populate another field in the tabular form when it is changed.
    In the tabular form I have an ITEM_ID field. Each item_id has an ITEM_NAME which is the dummy field as it is not a field in the database table.
    When the user enters an item name, I would like something like a dynamic action to fire, populating the ITEM_ID.
    e.g User enters part no ABC into the dummy field. When they tab out, I want the value to the item_id field on the tabular form row to be populated based on a SQL query in a similar fashion to how it can be done with dynamic actions on text items on a form.
    I am using APEX v4.0.0
    Thanks in advance
    Chris

    Hello Chris,
    Why can't you use Select List Item on tabular form, which will display all item_names and return item_ids?
    If the list is huge and you need users to type & search, then you can use Pop-up LOV item.
    Regards,
    Hari

  • Filling dynamic table with dynamic structure en fields!

    Hello All,
    I have written the following code. Which is okay according the syntax check. But when I run the abap code it will give a syntax error. I want to insert data from database table into internal table. Because the tables that have to read are so many I decided to make a dynamic statement which can be used for all tables. Except it won't work as I wish.
    (LT_FIELDS) content is the dynamic fields which are defined earlier in the code and will change each loop.
    (TAB_X) content is the dynamic internal table which is defined earlier in the code and will change each loop.
    = structure of PA0002.
    (TAB_N) = T_PA0002.
    The code:
              SELECT (LT_FIELDS) FROM (TAB_X) INTO CORRESPONDING FIELDS OF .
              ENDSELECT.
    Can someone give me some advice how to solve this issue?
    During the run at the line "INSERT (TAB_N) FROM . " SAP creates an error like below.
                                                                                    K. tekst                                                                               
    Ein in einem SQL-Befehl genannter Tabellenname ist unbekannt.                                                                               
    Wat is er gebeurd?                                                                               
    Error in ABAP application program.                                                                               
    The current ABAP program "ZPF_R_MUTATIEOVERZICHT_MAIA" had to be terminated                 
         because one of the                                                                         
        statements could not be executed.                                                                               
    This is probably due to an error in the ABAP program.                                                                               
    Foutenanalyse                                                                               
    Es ist eine Ausnahme aufgetreten, die weiter unten näher erläutert wird.                    
        Die Ausnahme, der die Klasse 'CX_SY_DYNAMIC_OSQL_SEMANTICS' zugeordnet ist,                 
        wurde nicht abgefangen und führte deshalb zu einem Laufzeitfehler.                          
        Der Grund für die Ausnahme ist:                                                                               
    In einem SELECT-, UPDATE- oder DELETE-Befehl wurde ein ungültiger                           
        Tabellenname "T_PA0002" angegeben.                                                          
        Aus einem der folgenden Gründe tritt der Fehler erst zur Laufzeit auf:                      
        - der Tabellenname wurde dynamisch angegeben, oder                                          
        - die SELECT-Klausel, WHERE-Klausel, GROUP-BY-Klausel, HAVING-Klausel                       
          oder ORDER-BY-Klausel wurde dynamisch angegeben.

    I Just want to insert data into internal table T_PA0002 from database table PA0002.
    The internal table and database table can change during the runtime of the program. But Its always filling the internal table with data from database table.
    I made it this way because the data I need to extract from data base tables can change depending on the procedures in table T9VS2.
    So I can't know the structure or the table which has to be selected each procedure. Or I have to make a big program with a lot of if or Case statements in it. I want to avoid that! Dynamic table is much quicker to write and understand when it works.
    It wil reduce a lot of code!  I hope someone can give me a hint to solve the problem.

  • Read Data from the dynamic Field Symbol with key ?

    Dear All,
    I've  2 dynamic internal tables in the form of field symbols.
    Now,I want to loop the item field symbol, read the header field symbol content and then move the corresponding into a final field symbol.
    How to read the field symbol with key ?
    When I'm trying to give the key clause in the paranthesis it's giving a syntax error.
    Any clues ?
    FYI .....
    * Get the Dynamic Field and Value for the Date/Year and convert it into Year value
      LOOP AT <fs_t_son> ASSIGNING <wa_son>.
        ASSIGN COMPONENT gwa_znrows_def-fieldname OF STRUCTURE <wa_son> TO <fs_year>.
        IF sy-subrc = 0.
          CLEAR gv_string.
          MOVE <fs_year> TO gv_string.
          CLEAR gv_year.
          gv_year = gv_string.
          <fs_year> = gv_year.
        ELSE.
    * When the Date/year Field is not in the Table then -->
    * Get the Dynamic Field and Value
          ASSIGN COMPONENT gwa_znrows_def-kfldname OF STRUCTURE <wa_rson> TO <fs_value>.
    * Populate field for Dynamic Where condition
          CLEAR gv_value.
          CONCATENATE '''' <fs_value> '''' INTO gv_value.
          CONCATENATE gwa_znrows_def-kfldname '=' gv_value INTO gt_where SEPARATED BY space.
          APPEND gt_where.
          CLEAR gt_where.
          READ TABLE <fs_t_rson> ASSIGNING <wa_rson> ( gt_where ).  "Key clause
        ENDIF.  " if sy-subrc = 0.  "Assign
      ENDLOOP.
    Thanks & regards,
    Deepu.K

    TYPES: BEGIN OF line,
             col1 TYPE c,
             col2 TYPE c,
           END OF line.
    DATA: wa TYPE line,
          itab TYPE HASHED TABLE OF line WITH UNIQUE KEY col1,
          key(4) TYPE c VALUE 'COL1'.
    FIELD-SYMBOLS <fs> TYPE ANY TABLE.
    ASSIGN itab TO <fs>.
    READ TABLE <fs> WITH TABLE KEY (key) = 'X' INTO wa.
    The internal table itab is assigned to the generic field symbol <fs>, after which it is possible to address the table key of the field symbol dynamically. However, the static address
    READ TABLE <fs> WITH TABLE KEY col1 = 'X' INTO wa.
    is not possible syntactically, since the field symbol does not adopt the key of table itab until runtime. In the program, the type specification ANY TABLE only indicates that <fs> is a table. If the type had been ANY (or no type had been specified at all), even the specific internal table statement READ TABLE <fs>  would not have been possible from a syntax point of view.

  • Trouble with dynamically filling fields

    I have a large form that contains over 50 pages. The first page is a flowable user input form.
    There are several fields which are common with other fields in the various underlying hidden pages. When a user selects an account type from a dropdown list, the appropriate account opening checklist appears as page 2.
    The user then selects various checkboxes which then makes the appropriate additional pages visible. Thes additional pages contain fields that should autopopulate based on the data entered in page 1 input form.
    The fields that are globally bound are fine. The problem is fields where I need to script to autopopulate. For example, there is a ACH authorization distribution section with 2 checkboxes (one for Checking one for Savings) and one Account number field. The page for ACH data, shows the ABA and Bank Name fine since those are globally bound, but the account number is 2 separate fields that I need to script in order to fill in but it is not working correctly.
    I think it is the event I have used but I'm not sure which event is best to place the script in. I started in the initialize event of that page but that doesnt work. If I click the checking/savings checkbox again after the ach page is visible, the field populates.
    How do I get the field to be prefilled as soon as it becomes visible?
    I am very new to scripting and LC. Any suggestions would be greatly appreciated!

    If you are new to scripting I might suggest using the Action Builder. It is a set of prebuilt actions that do not require scripting. If you are using Windows go to the toolbar at the top, go to Tools and select Action Builder. From there you set a condition and a result. From the condition select what field is going to hold the value you want to be copied and select "is not empty" from the first drop down box. Then in the result section select "set value of field" and then select the field that you want the data copied to. In the result section you will then select from the drop down box what you want the value to be and you select "to the value of field" and select your 1st field. This will mirror 2 fields or even multiple fields from 1 box without global binding. What is nice about the Action Builder is if you go to the Script box at the top you can see Livecycle will populate the actual code on the correct show event. This way you can start to see how the code works and build from there.

  • Get input for 100 dynamic fields in a single screen

    Hi all
    I got one requirement wherein i need to accept input for around 100 dynamic fields in a single screen. screen can scroll down if possible.
    Can anyone tell me whether it is possible. if yes please let me have the sample code.
    Thanks
    Ravindra Suvarna

    Ravi,
    Probably a TAB STRIP might help you.
    Seggregate your 100 fields logically, say 5 groups.
    Have a TAB STRIP CONTROL, with 5 tab strips and place 20 fields in each of the tabs. Each tab strip will have a sub screen.
    Regards,
    Ravi
    Note : Please mark the helpful answers.

Maybe you are looking for