Field-symbols as parameters to the method of a class

Hi All,
I am having an doubt regarding the field-symbols.Can we pass the field-symbols as a parameter to the method of a class.If yes can anyone tell me how to do this. Before posting I have searched regarding it in google but I did not find any better solution.Though I have seen some examples regarding the passing of field symbols as a parameter those scenarios does not match with my report as my report varies dynamically based on selection criteria.
Below is the snippet of my code regarding the passing of field-symbols as a parameter.
methods:  final_data importing <fs_h_line>TYPE any
                                             <fs_h> TYPE STANDARD TABLE
                               exporting <fs_f_line> TYPE any
                                             <fs_f> TYPE STANDARD TABLE, 
CALL METHOD l_obj->final_data exporting <fs_h_line> = <fs_header_line>
                                                              <fs_h>      = <fs_header>
                                               importing <fs_f_line> = <fs_final_line>
                                                             <fs_f>      = <fs_final>.
With the above code I am getting an error.Check whether it is correct or not.If not suggest the solution to resolve the issue.
Regards,
Chakradhar.

Hi
Maybe if you change this code below to field-symbol, it can work:
DATA: tl_header_csv TYPE STANDARD TABLE OF yol_header_arquivo,
      tl_csv_aux    TYPE textline_t                          .
DATA: wl_header_csv LIKE LINE OF tl_header_csv.
converter_csv_al11_itab( EXPORTING im_t_csv = tl_csv_aux
                         IMPORTING ex_w_sap = wl_header_csv
                         CHANGING  ex_t_sap = tl_header_csv ).
METHOD converter_csv_al11_itab.
  IM_T_CSV  Importing  Type  TEXTLINE_T
  EX_W_SAP  Exporting  Type  ANY
  EX_T_SAP  Changing   Type  STANDARD TABLE

Similar Messages

  • Passing input parameters to the method call in ADF task flow.

    Hi,
    I have the following use case:
    There is a task flow with 2 jspx pages. In the first page I have 2 input search parameters and search button. the search button calls the webservice data control execute (GET_ACCOUNTOperation) method .
    Displaying the search results in the same page is not a problem , but my requirement is that the search results are to be displayed in the second page in tabular form.
    To achieve this, I dragged the execute method as the method call in the task flow and specified the input parameters for the method call (right click and add parameters) . I am getting the following exception :
    javax.el.MethodNotFoundException: Method not found: GET_ACCOUNTOperation.execute(java.lang.String, java.lang.String)
         at com.sun.el.util.ReflectionUtil.getMethod(Unknown Source)
         at com.sun.el.parser.AstValue.getMethodInfo(Unknown Source)
         at com.sun.el.MethodExpressionImpl.getMethodInfo(Unknown Source)
         at oracle.adf.controller.internal.util.ELInterfaceImpl.getReturnType(ELInterfaceImpl.java:214)
         at oracle.adfinternal.controller.activity.MethodCallActivityLogic.execute(MethodCallActivityLogic.java:135)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.executeActivity(ControlFlowEngine.java:1035)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:921)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:820)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.routeFromActivity(ControlFlowEngine.java:552)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.performControlFlow(ControlFlowEngine.java:148)
         at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleAdfcNavigation(NavigationHandlerImpl.java:109)
         at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:78)
         at org.apache.myfaces.trinidadinternal.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:43)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:130)
         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:889)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:379)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:194)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
    even though the execute method is there and the service is up and running. I am not sure whether its the correct way of doing it. Please shed some light on how to solve this use case
    Some additional info:
    Under the data controls pallete, the GET_ACCOUNTOperation method has a parameters section , which has "part" (java.lang.Object) as
    the input parameter.
    Regards,
    Rampal

    Hi,
    thanks for the quick turn-around. Jdev version that i am using is Studio Edition Version 11.1.1.6.0. And i am using SOAP. Isnt there a way without using a backing bean? I am planning to use it as a portlet. Would'nt creating a backing bean cause a problem in that case?? Also i am confused here . The method that i am dragging is GET_ACCOUNTOperation(Object). I tried passing the hashmap . It gave the following exception :
    javax.el.MethodNotFoundException: Method not found: GET_ACCOUNTOperation.execute(java.util.HashMap)
    Rampal

  • Download code of all the methods in a class to desktop

    Hi,
    I want to download code of all the methods in a class to desktop.
    Its like user will enter Class name on selection screen, then program should download the code of all the methods inside that class on to desktop as a text file.
    How to do it.
    Points will be rewarded!!
    Regards

    You can use FM SEO_CLASS_GET_METHOD_INCLUDES
    to determine the names of all methods implemented in this class with the according names of the includes.
    Than you can loop through the table returned by this FM and get the coding of all methods using READ REPORT statement, whereas you must pass the name of the include of the according method, when executing READ REPORT...
    Reward points, in case reply meets your expectation...
    --MIKE

  • How to pass field symbol as parameter to a method

    Hi,
    I have a field symbol of type table,also i have a method with parameter (say vbeln), i need to pass the range value in <fs> as the parametrs to the method.,
    How can I acheive this,
    A code snippet eill help me a lot.,
    Thank you.
    Arjun.G

    Hi,
    Example code :
    field-symbols : <fs> type table.
    CALL METHOD cl_gui_frontend_services=>gui_upload
      CHANGING
        data_tab                = <fs>
    *  EXCEPTIONS
    *    file_open_error         = 1
    *    file_read_error         = 2
    *    no_batch                = 3
    *    gui_refuse_filetransfer = 4
    *    invalid_type            = 5
    *    no_authority            = 6
    *    unknown_error           = 7
    *    bad_data_format         = 8
    *    header_not_allowed      = 9
    *    separator_not_allowed   = 10
    *    header_too_long         = 11
    *    unknown_dp_error        = 12
    *    access_denied           = 13
    *    dp_out_of_memory        = 14
    *    disk_full               = 15
    *    dp_timeout              = 16
    *    not_supported_by_gui    = 17
    *    error_no_gui            = 18
    *    others                  = 19
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Remember : parameter should be of type standard table.
    Regards,
    Mohaiyuddin

  • Is it possible to pass a field symbol as parameter from any method of view?

    Hi
    Is it possible to pass a field symbol as an importing parameter to teh globally declared attribute??

    While it is true that you can pass field symbols, they must be fully typed at the time you pass them  and they will be passed by value, not by reference. If you want to pass generically typed variables use a data reference (TYPE REF TO) instead.

  • How to create an nfs share using the method "CreateShare" of class "MSFT_NfsServerTasks"

    I need to use the "CreateShare" of the wmi class "MSFT_NfsServerTasks" to create a nfs share.
    I am new to wmi. could somebody please guide me to achieve this. thanks in advance.

    let to me rephrase my question. I need to call the MSFT_NfsServerTasks::createmethod to create the nfs share.
    And the syntax for this method is
    uint32 CreateShare(
    [in] string Name,
    [in] string Path,
    [in] string NetworkName,
    [in] string Authentication[],
    [in] boolean UnmappedUserAccess,
    [in] boolean AnonymousAccess,
    [in] sint32 AnonymousUid,
    [in] sint32 AnonymousGid,
    [in] string LanguageEncoding,
    [in] boolean AllowRootAccess,
    [in] string Permission,
    [in] MSFT_NfsSharePermission ClientPermission[],
    [out] MSFT_NfsShare Share
    And to run this method I will be using "IWbemServices::ExecMethod". This method takes the Input parameter object(IWbemClassObject). I managed to add string the parameters in the input parameterobject as,
    IWbemClassObject* pInInst = NULL;:/*some code*/
    VARIANT var;
    var.vt = VT_BSTR;
    var.bstrVal= SysAllocString(L"C:\\share1");
    BSTR ArgPath = SysAllocString(L"Path");
    hRes = pInInst->Put(ArgName, 0, &var, 0);
    But how could I use it for other parameters e.g. string[], MSFT_NfsSharePermission ClientPermission[]etc.

  • How do i call the method in a class using servlet

    i am doing a project which need to use servlet to call a few methods in a class and display those method on the broswer. i tried to write the servlet myself but there are still some errors .. can anyone help:
    The servlet i wrote :
    package qm.minipas;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class test extends HttpServlet {
    Database database;
    /** Initializes the servlet.
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    database = FlatfileDatabase.getInstance();
    /** Destroys the servlet.
    public void destroy() {
    /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
    * @param request servlet request
    * @param response servlet response
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    response.setContentType("text/html");
    java.io.PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Servlet</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("this is my class wossname"+FlatfileDatabase.getInstance()); // this is calling the toString() method in the instance of myJavaClass
    out.println("this is my method"+FlatfileDatabase.getAll());
    out.println("</body>");
    out.println("</html>");
    out.close();
    /** Handles the HTTP <code>GET</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    processRequest(request, response);
    /** Handles the HTTP <code>POST</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    processRequest(request, response);
    /** Returns a short description of the servlet.
    public String getServletInfo() {
    return "Short description";
    my methods which i need to call are shown below:
    public Collection getAll() {
    return Collections.unmodifiableCollection(patientRecords);
    public Collection getInpatients() {
    Collection selection=new ArrayList();
    synchronized(patientRecords) {
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    if(next.isInpatient())
    selection.add(next);
    return Collections.unmodifiableCollection(selection);
    public Collection getByAdmissionDate(Date dateOfAdmission) {
    List selection=new ArrayList();
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    if(dateOfAdmission.equals(next.getDateOfAdmission()))
    selection.add(next);
    return Collections.unmodifiableCollection(selection);
    public Collection getByAdmissionDates(Date from,Date to)
    throws IllegalArgumentException {
    if(to.before(from))
    throw new IllegalArgumentException("End date must not be before start date");
    List selection=new ArrayList();
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    Date nextAD=next.getDateOfAdmission();
    if((nextAD.after(from)||nextAD.equals(from))
    &&(nextAD.before(to)||nextAD.equals(to)))
    selection.add(next);
    return Collections.unmodifiableCollection(selection);
    public Collection getByDischargeDates(Date from,Date to)
    throws IllegalArgumentException {
    if(to.before(from))
    throw new IllegalArgumentException("End date must not be before start date");
    List selection=new ArrayList();
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    Date nextAD=next.getDateOfDischarge();
    if(nextAD==null)
    continue;
    if((nextAD.after(from)||nextAD.equals(from))
    &&(nextAD.before(to)||nextAD.equals(to)))
    selection.add(next);
    return Collections.unmodifiableCollection(selection);
    public Collection getByConsultant(String consultant) {
    List selection=new ArrayList();
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    if(consultant.equalsIgnoreCase(next.getConsultant()))
    selection.add(next);
    return Collections.unmodifiableCollection(selection);
    public Collection getByDischargeDate(Date dateOfDischarge) {
    List selection=new ArrayList();
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    if(dateOfDischarge.equals(next.getDateOfDischarge()))
    selection.add(next);
    return Collections.unmodifiableCollection(selection);
    public Collection getBySurname(String surname) {
    List selection=new ArrayList();
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    if(surname.equalsIgnoreCase(next.getSurname()))
    selection.add(next);
    return Collections.unmodifiableCollection(selection);
    public Collection getByWard(String ward) {
    List selection=new ArrayList();
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    if(ward.equalsIgnoreCase(next.getWard()))
    selection.add(next);
    return Collections.unmodifiableCollection(selection);

    please provide a detail description of your errors.

  • How to acess a value of variable(calling prg) inside the methods of a class

    Hi SapAll.
    i wrote a program where i need to acess a value of a variable inside the class method.
    for eg:
    CALL METHOD gcl_utl_app_log->display_log
        EXPORTING
          it_edidc = lt_edidc
          it_msg   = lt_msg.
    while debugging under the method 'DISPLAY_LOG' when i want to acess a value of a variable (calling program) i cont get that value but i can acess the value of the variable just before the CALL METHOD statement.
    so can any body help me in finding the solution for this.
    regards.
    Varma

    Hi jhings.
    i have delcared the variable in the main program like below
    main program
    PERFORM populate_z1edrmdseqnr01.
    FORM populate_z1edrmdseqnr01 .
    other code
    CALL FUNCTION 'NUMBER_GET_NEXT'
        EXPORTING
          nr_range_nr             = gv_number_nr
          object                  = lv_obj
        IMPORTING
          number                  = gv_nextno
    move gv_nextno to gv_seqno.
      EXPORT gv_seqno  to memory ID 'MEM1'.
    PERFORM FORM application_log.
    FORM application_log.
      CALL METHOD gcl_utl_app_log->display_log
        EXPORTING
          it_edidc = lt_edidc
          it_msg   = lt_msg.
    ENDFORM
    METHOD display_log.
    IMPORT gv_seqno from MEMORY ID 'MEM1'.
    *********when i save and check the above code iam getting the error as 'FiledGV_SEQNO is unknown,it is neither in one of specified tables not defined by 'DATA ' statement.**********
    regards.
    Varma

  • How to execute the method of a class loaded

    Hi,
    I have to execute the method of com.common.helper.EANCRatingHelper" + version
    version may be 1,2, etc
    if version = 1 the class is com.common.helper.EANCRatingHelper1;
    Iam able to load the class using following code.But iam unable to execute the method of the above class
    Can anybody help me how to execute the method of the class loaded.
    Following is the code
    String version = getHelperClassVersion(requestDate);
    String helperClass = "com.redroller.common.carriers.eanc.helper.EANCRatingHelper" + version;
    Class eancRatingHelper = Class.forName(helperClass);
    eancRatingHelper.newInstance();
    eancRatingHelper.saveRating(); This is not executing throwing an error no method.
    Thanks

    eancRatingHelper.newInstance();Ok, that creates an instance, but you just threw it away. You need to save the return of that.
    Object helper = eancRatingHelper.newInstance();
    eancRatingHelper.saveRating(); This is not executing throwing an error no method.Of course. eancRatingHelper is a Class object, not an instance of your EANCRatingHelper object. The "helper" object I created above is (though it is only of type "Object" right now) -- you have to cast it to the desired class, and then call the method on that.
    Hopefully EANCRatingHelper1 and 2 share a common interface, or you're up the creek.

  • The method clearCaches() in class Utility

    to anyone who read this topic,
    I want to clean caches using method clearCaches() in class com.sun.corba.se.impl.util.Utility, but I find there are some discriptions in method definition, it is "Clear the stub/tie caches. Intended for use by
    test code".
    Do this mean it is only for test code usage? very appreciate if anyone could tell me if I can use this method in my code? Does it bring some other impacts if I use it?
    Very thanks,
    Chris
    Software engineer
    Notel

    Hi.
    That's right. according to paramter locator, you will gain interfaces interfaces(Bouquet, Network, ProgramEvent, ProgramEventDescription, ServiceComponent, ServiceDescription, ServiceDetails, SIElement, TransportStream) implements SIRetrievable.
    I will notice you that "SIRequest" returned is for "going" or "canceling". if you get something, it will get parameter "SIRequestor" interface.
    I hope to help you.
    YongHwan

  • Two questions about the methods in InputStream class.

    1, close() method
    the API says when the method is invoked, the input stream and its associateive channels are closed to release system resources.
    What does it mean by "associative channels"?
    2, read(byte[] b) method
    the API says it reads b bytes of data and returns b.length as an Integer, however, I dont think what can this method do, because unlike normal read(), which returns the actual byte of data read, but returns the no of byte read, which I cant find a way to mainpulate with the data read.
    Any help??
    please help
    thanks

    while(true){
    int lim = in.read(bufferArray);
    if(lim == -1)break;
    buffer.limit(lim);
    buffer.flip();
    channel.write(buffer);
    buffer.clear();
    while (true)
    int lim = in.read(buffer);//No such method in InputStream
    if (lim < 0) break;
    buffer.flip();
    channel.write(buffer);
    buffer.compact();
    My guess is that you didn�t read my original post properly. The variable in is an InputStream and it doesn�t have a read method that takes a ByteBuffer as an argument.
    In my code I am using a byte array, which is backed by the buffer, I don�t believe that when writing to this byte array , the InputStream will try to update the internal accounting system of the buffer, that�s why I have done this manually by setting the limit of the buffer (the number of bytes actually read are set as the limit).
    Correct me if I am a wrong thanks for your feedback .

  • My iPod Touch 4th Generation 8gb won't turn on and is frozen on the loading symbol/wheel, I tried the method where you hold the home and lock button lots of times and it hasn't worked! What do I do?

    My question won't all fit in but it says 'My iPod Touch 4th Generation 8gb won't turn on and is frozen on the loading symbol/wheel. What do I do?'
    I've had this problem from about two weeks and I forgot about it, but today I wanted to play on it and remembered that it's not working, I've tried connecting it to iTunes via my laptop but I'm not to sure how to update it because I thought that might fix it, but no luck. I've tried the trick where you hold the lock and home button but nothing happened apart from it just went back to the apple logo and then to the frozen loading symbol/wheel. I need help!

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try on another computer
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • Declaring Field Symbols in Public Section of class

    Dear All,
    I am working with class and hav declared some field symbols in one of the method.
    Now I want to move these declaration in Public section of the class so that this field symbol declaration can be used by other methods of the class but I am not able to do the same.
    Can anyone help me in finding as what I am doing wrong here.
    Regards,
    Lalit Kabra

    What you are trying to do is define an attribute. I doubt you can use field symbol as a class attribute. Consider using a data object instead.
    Data : dref type ref to data.
    This can later be deferenced in the individual methods.
    Hope this helps.
    Here's an example for the same:
    REPORT  z_class_001                             .
    *       CLASS lcl_class1 DEFINITION
    CLASS lcl_class1 DEFINITION.
      PUBLIC SECTION.
        DATA dref TYPE REF TO data.
        METHODS : constructor IMPORTING i_type TYPE char20,
                  meth1 IMPORTING value TYPE i.
    ENDCLASS.                    "lcl_class1 DEFINITION
    *       CLASS lcl_class1 IMPLEMENTATION
    CLASS lcl_class1 IMPLEMENTATION.
      METHOD constructor.
        CREATE DATA dref TYPE (i_type).
      ENDMETHOD.                    "constructor
      METHOD meth1.
        FIELD-SYMBOLS <fs> TYPE ANY.
        ASSIGN dref->* TO <fs>.
        WRITE: 'Value is ' ,value.
        ASSIGN value TO <fs>.
        WRITE: 'Field symbol is ', <fs>.
      ENDMETHOD.                                                "meth1
    ENDCLASS.                    "lcl_class1 IMPLEMENTATION
    START-OF-SELECTION.
      DATA ref_class TYPE REF TO lcl_class1.
      CREATE OBJECT ref_class EXPORTING i_type = 'I'.
      CALL METHOD ref_class->meth1
        EXPORTING
          value = 3.
    BR,
    Advait
    Edited by: Advait Gode on Sep 16, 2009 9:44 AM

  • The difference between FIELD-SYMBOL and normal DATA TYPE

    Dear experts,
    Please see the example below, both are output the same result.
    DATA: EXTERNAL_RECORD(4000),
          POSITION TYPE I,
          LENGTH TYPE N,
          ENTRY TYPE STRING.
    EXTERNAL_RECORD = '0005Smith0007Edwards0005Young'.
    DO.
      LENGTH = EXTERNAL_RECORD+POSITION(4).
      IF LENGTH = 0.
        EXIT.
      ENDIF.
      ADD 4 TO POSITION.
      MOVE EXTERNAL_RECORD+POSITION(LENGTH) TO ENTRY.
      WRITE ENTRY.
      ADD LENGTH TO POSITION.
      IF POSITION >= 4000.
        EXIT.
      ENDIF.
    ENDDO.
    --OR It can be written as--
    DATA: EXTERNAL_RECORD(4000),
          POSITION TYPE I,
          LENGTH TYPE N.
    FIELD-SYMBOLS <ENTRY>.
    EXTERNAL_RECORD = '0005Smith0007Edwards0005Young'.
    DO.
      LENGTH = EXTERNAL_RECORD+POSITION(4).
      IF LENGTH = 0.
        EXIT.
      ENDIF.
      ADD 4 TO POSITION.
      ASSIGN EXTERNAL_RECORD+POSITION(LENGTH) TO <ENTRY>.
      WRITE <ENTRY>.
      ADD LENGTH TO POSITION.
      IF POSITION >= 4000.
        EXIT.
      ENDIF.
    ENDDO.
    Is there any special circumstances we need to use FIELD-SYMBOL?
    Why is FIELD-SYMBOL is introduce in the first place?
    Kindly advice with example.
    Thanks in advance for those who can help me on this.

    HI,
    You can use field symbols to make the program more dynamic. In this example the name of a table control is substituted by a field symbol. Thus you cal call the form with any internal table, using the name of the table control as a parameter.
    Example
    form insert_row
    using p_tc_name.
    field-symbols <tc> type cxtab_control. "Table control
    assign (p_tc_name) to <tc>.
    insert 100 lines in table control
    <tc>-lines = 100.
    Field symbols allow you to:
    **     Assign an alias to a data object(for example, a shortened
            name for data objects structured through several hierarchies
            - <fs>-f instead of rec1-rec2-rec3-f)
    **     Set the offset and length for a string variably at runtime
    **     Set a pointer to a data object that you determine at runtime (dynamic ASSIGN)
    **     Adopt or change the type of a field dynamically at runtime
    **     Access components of a structure
    **     (from Release 4.5A) Point to lines of an internal table
            (process internal tables without a separate work area)
    Field symbols in ABAP are similar to pointers in other programming
    languages. However, pointers (as used in PASCAL or C) differ from ABAP
    field symbols in their reference syntax.
    The statement ASSIGN f to <fs> assigns the field f to field
    symbol <fs>. The field symbol <fs> then "points" to the
    contents of field f at runtime. This means that all changes to the
    contents of f are visible in <fs> and vice versa. You declare
    the field symbol <fs> using the statement FIELD-SYMBOLS: <fs>.
    Reference syntax
    Programming languages such as PASCAL and C use a dereferencing symbol
    to indicate the difference between a reference and the object to which
    it refers; so PASCAL would use p^ for a pointer instead of p, C would
    use *p instead of p. ABAP does not have any such dereferencing symbol.
    **     In PASCAL or C, if you assign a pointer p1 to a pointer p2,
    you force p1 to point to the object to which p2 refers (reference semantics).
    **     In ABAP, if you assign a field symbol <fs1> to a field
    symbol <fs2>, <fs1> takes the value of the data object to
    which <fs2> refers (value semantics).
    **     Field symbols in ABAP are always dereferenced, that is,
    they always access the referenced data object. If you want to
    change the reference yourself in ABAP, you can use the ASSIGN statement
    to assign field symbol <fs1> to field symbol <fs2>.
    Using field symbols
    You declare field symbols using the FIELD-SYMBOLS statement.
    They may be declared either with or without a specific type.
    At runtime you assign a field to the field symbol using the ASSIGN
    statement. All of the operations on the field symbol act on the field
    assigned to it.
    When you assign a field to an untyped field symbol, the field symbol
    adopts the type of the field. If, on the other hand, you want to assign
    a field to a typed field symbol, the type of the field and that of the
    field symbol must be compatible.
    A field symbol can point to any data object and from Release 4.5A,
    they can also point to lines of internal tables.
    The brackets (<>) are part of the syntax.
    Use the expression <fs> IS ASSIGNED to find out whether the field
    symbol <fs> is assigned to a field.
    The statement UNASSIGN <fs> sets the field symbol <fs> so
    that it points to nothing. The logical expression <fs>
    IS ASSIGNED is then false. The corresponding negative expression
    is IF NOT <fs> IS ASSIGNED.
    An unassigned field symbol <fs> behaves as a constant with
    type C(1) and initial value SPACE.
    MOVE <fs>
    TO dest     Transfers the initial value SPACE to the variable dest
    MOVE 'A' to <fs>     
    Not possible, since <fs> is a constant
    (runtime error).
    To lift a type restriction, use the CASTING addition in the
    ASSIGN statement. The data object is then interpreted as though
    it had the data type of the field symbol. You can also do this
    with untyped field symbols using the CASTING TYPE <type> addition.
    The danger with pointers is that they may point to invalid areas.
    This danger is not so acute in ABAP, because the language does not
    use address arithmetic (for example, in other languages, pointer p
    might point to address 1024. After the statement p = p + 10, it would
    point to the address 1034). However, the danger does still exist, and
    memory protection violations lead to runtime errors.
    A pointer in ABAP may not point beyond a segment boundary. ABAP does
    not have one large address space, but rather a set of segments.
    Each of the following has its own segment:
    *     All global data
    *     All local data
    *     Each table work area (TABLES)
    *     Each COMMON PART
    You should only let field symbols move within an elementary field or
    structure where ABAP allows you to assign both within the global data
    and beyond a field boundary.
    Rgds
    Umakanth

  • 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.

Maybe you are looking for

  • Error message when submitting podcast

    I have been trying to submit a new podcast to the directory in itunes. I tested the feed by subscribing to my podcast using the advanced menu as suggested in the FAQ on submitting a video podcast. The test was successful and I downloaded the most rec

  • Acrobat 6.0 Professional - Document Compare

    Hi All, I'm opening two PDF files in Acrobat 6.0 professional programatically from VB.NET program and I'm comparing those two documents using MenuitemExecute(DIGSIG:CompareDocuments ) command and generating the side by side comparison file programati

  • Document could not be opened

    I am getting an error message "Document could not be opened" on the Numbers app - What is the best way to recover the document? Will the folks in the Genius Bar in the local Apple shop be able to help?

  • Instant ink

    I  AM having  trouble  with  printing  since  i  started  instant ink    90%  of  the  time  i  print  it  takes  from 2 to  5  pages  to  print  one  thing   first  page  print  a inch  of  the whole  second   afew  more and  on last  page i  get  a

  • Add third physical system to logical system

    Hi ,   We are using GRC AC 5.3 SP12 ( Back end ECC6 HR ) , we have connected our GRC DEV system to DEV 100 and DEV 200 clients , now i have connected QAS 100 client to the same system ( GRC DEV) , we have already created a logical system ERP( with Bo