Field Symbols - STRING to CHAR

Hi Friends,
I have a STRING data type declared and Iam trying to pass this data to system function 'C_RSTS_WRITE' for some requirement as below. But it gives me SY-SUBRC as 16. But it works for CHAR datatype which I dont want to use as I have some other reason.
CALL 'C_RSTS_WRITE'
ID 'HANDLE' FIELD hlp_handle
ID 'BUFF' FIELD buffer
ID 'RC' FIELD _rc
ID 'ERRMSG' FIELD errmsg. "#EC CICCALL
My Question is:
Can we achieve this using Field-Symbols using CASTING.
In other way can I declare the Field Symbol as CHAR datatype (with no fixed length) which I use in system function and I will pass the STRING data to that field-symbol.
Please confirm.
Thanks,
Smitha.

Hi Smitha,
Can u share, how u solved the problem. I have to do the same thing.
If possible, please email me the code -  silbizkit at gmail.com
Thanks

Similar Messages

  • Field Symbols-Ascii to Char

    Hi,
    My requirement is to cocatenate the characters A-Z to F0001, I am using the below code that actually converts the Ascii value to a char( found through the net), but it is giving error.
    Can anybody solve my problem
    data : asci type i value 65.
    data : x1 type x,
           x2 type string.
    field-symbols : <fc> type c.
    while counter <> num.
    move asci to x1.
    assign x1 to <fc> casting. <<<<<<<<< error in this line
    write <fc> to x2.
    if asci le 91.
    asci = asci + 1.
    else.
    asci = 65.
    endif.
    CONCATENATE val1 x2 INTO val.
    it_itab-var1 = val.
    APPEND it_itab.
    CLEAR it_itab.
    counter = counter + 1.
    endwhile.
    Error :
    The length of "X1" in bytes must be a multiple of the size of a Unicode
    character, regardless of the size of the Unicode character.
    and if I write assign asci to <fc> casting. this will append # rather than the char value.
    Need response ASAP.
    Thanks in advance.
    Pooja

    Pooja,
    By chance did u execute all of my code.
    here i'm appending ur string with the ascii
    CONCATENATE val1 x3 INTO val.
    I got the result as  F001A....F001Z.
    Pl. execute the entire code.
    I feel, i got ur question
    thanks
    Mahesh
    Edited by: Mahesh Reddy on Feb 25, 2009 1:16 PM

  • Legnth of field symbol field

    Hi all,
    I iterate over a work area assigning each field to a field symbol which is then concatenated to a string that is written to a dataset. When I encounter a quantity field the progam dumps...the quantity field is not compatible with the string. I then decided to write the field symbol to a char variable before the concatenate...problem here is I have to define the length of the char first...what I want to do is set the length of the char variable dynamically...depending on the lenght of the field symbol just read in....can i do that?
    regards,
    Mat

    I finally realized that I was using WRITE when I should have been saying MOVE!!!
    My solution entailed the following...suggestions on how I might improve are welcome:
    *======================================================================
    Loop over the record set and populate the data set
    *======================================================================
      READ TABLE gt_supply_demand INDEX 1 INTO wa_supply_demand.
      ASSIGN wa_supply_demand TO <F1>.
      DESCRIBE FIELD <F1> TYPE l_type COMPONENTS l_col_count.
      LOOP AT gt_supply_demand INTO wa_supply_demand.
          l_index = 1.
          DO l_col_count TIMES.
            ASSIGN COMPONENT l_index OF STRUCTURE <F1> TO <F2>.
            MOVE <F2> TO l_temp_field.
            CONCATENATE l_row l_temp_field INTO l_row SEPARATED BY CON_TAB.
            l_index = l_index + 1.
          ENDDO.
        TRANSFER l_row TO ds_file.
        CLEAR wa_supply_demand.
        CLEAR l_row.
      ENDLOOP.

  • Loop at  field-symbol  (any table) into string ?

    Hi Everyone,
    I need little help, I have a requirement to extract table content with columns names as the header.
    After doing some search I figured out the best way to this since table name will be only avaialbe at runtime through
    a selection field . my problem is to loop through field-symbol and convert a structure to string value so that I can
    write to the file.
    REPORT  zlab_tbl_export.
    DATA table_name(30) VALUE 'ZSMARTTS_HTML'.
    DATA v_file(100) VALUE 'c:\sap_export.txt'.
    DATA line(1000).
    DATA: o_data TYPE REF TO data.
    CREATE DATA o_data TYPE TABLE OF (table_name).
    FIELD-SYMBOLS: <table> TYPE ANY TABLE.
    ASSIGN o_data->* TO <table>.
    SELECT * UP TO 100 ROWS FROM (table_name) INTO TABLE <table>.
    OPEN DATASET v_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    >>>>>>> LOOP at <table> into line.   >>>>>>>>>>>>  " Here the code breaks and fail
      TRANSFER line to v_file. 
      WRITE :/ line.          
    ENDLOOP.
    CLOSE DATASET v_file.
    Exception Message
    |Error analysis                                                                                |
    |    You attempted to move one data object to another.                                             |
    |    This is not possible here because the conversion of a data object                             |
    |    of type "v" to type "C" is not supported.                                                     |
    |                                                                                |
    |      List of internal ABAP types:                                                                |
    |                                                                                |
    |      C    Text (Character)                                                                       |
    |      N    Numerical text                                                                         |
    |      D    Date (YYYYMMDD)                                                                        |
    |      T    Time (HHMMSS)                                                                          |
    |      X    Hexadecimal                                                                            |
    |      I    Integer                                                                                |
    |      P    Packed number                                                                          |
    |      F    Floating point number                                                                  |
    |                                                                                |
    |      h    Internal table                                                                         |
    |      r    Object reference                                                                       |
    |      l    Data reference                                                                         |
    |      g    String of type C                                                                       |
    |      y    String of type X                                                                       |
    |      s    2-byte integer with plus/minus sign                                                    |
    |      b    1-byte integer without plus/minus sign                                                 |
    |      u    Structure (flat structure)                                                             |
    |      v    Structure (deep structure)                                                             |

    Hi Everyone, I need little help, I have a requirement to extract table content with columns names as the header. After doing some search I figured out the best way to this since table name will be only avaialbe at runtime through a selection field . my problem is to loop through field-symbol and convert a structure to string value so that I can write to the file.
    thie is the code
    REPORT  zlab_tbl_export.
    DATA table_name(30) VALUE 'ZSMARTTS_HTML'.
    DATA v_file(100) VALUE 'c:\sap_export.txt'.
    DATA line(1000).
    DATA: o_data TYPE REF TO data.
    CREATE DATA o_data TYPE TABLE OF (table_name).
    FIELD-SYMBOLS: <table> TYPE ANY TABLE.
    ASSIGN o_data->* TO <table>.
    SELECT * UP TO 100 ROWS FROM (table_name) INTO TABLE <table>.
    OPEN DATASET v_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    LOOP at <table> into line.   " Fail here
      TRANSFER line to v_file. 
      WRITE :/ line.           
    ENDLOOP.
    CLOSE DATASET v_file.
    and this is the exception:
    Error analysis                                                                               
    You attempted to move one data object to another.                                            
        This is not possible here because the conversion of a data object                            
        of type v to type C is not supported.                                                    
    Edited by: Misbah on Jan 7, 2010 11:50 PM

  • Field Symbols, Field String, and Field Group.

    Hi,
    Can you differentiate between filed symbols, field strings and field groups,
    With regards,
    Bharath Mohan B

    Hi,
    Field Symbols
    Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
    Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
    Field symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address (reference) and that can be used without the contents operator, are reference variables in ABAP Objects.
    All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE statement between two field symbols moves the contents of the field assigned to the first field symbol to the field assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before.
    You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
    Field symbols provide greater flexibility when you address data objects:
    If you want to process sections of fields, you can specify the offset and length of the field dynamically.
    You can assign one field symbol to another, which allows you to address parts of fields.
    Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
    You can also force a field symbol to take different technical attributes from those of the field assigned to it.
    The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
    While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
    For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
    check the below links u will get the answers for your questions
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
    http://searchsap.techtarget.com/tip/1,289483,sid21_gci920484,00.html
    Syntax Diagram
    FIELD-SYMBOLS
    Basic form
    FIELD-SYMBOLS <fs>.
    Extras:
    1. ... TYPE type
    2. ... TYPE REF TO cif
    3. ... TYPE REF TO DATA
    4. ... TYPE LINE OF type
    5. ... LIKE s
    6. ... LIKE LINE OF s
    7. ... TYPE tabkind
    8. ... STRUCTURE s DEFAULT wa
    The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Untyped Field Symbols ad Cannot Use Field Symbols as Components of Classes.
    Effect
    This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN. All operations performed with the field symbol then directly affect the field assigned to it.
    You can only use one of the additions.
    Example
    Output aircraft type from the table SFLIGHT using a field symbol:
    FIELD-SYMBOLS <PT> TYPE ANY.
    DATA SFLIGHT_WA TYPE SFLIGHT.
    ASSIGN SFLIGHT_WA-PLANETYPE TO <PT>.
    WRITE <PT>.
    Addition 1
    ... TYPE type
    Addition 2
    ... TYPE REF TO cif
    Addition 3
    ... TYPE REF TO DATA
    Addition 4
    ... TYPE LINE OF type
    Addition 5
    ... LIKE s
    Addition 6
    ... LIKE LINE OF s
    Addition 7
    ... TYPE tabkind
    Effect
    You can define the type of the field symbol using additions 2 to 7 (just as you can for FORM parameters (compare Defining the Type of Subroutine Parameters). When you use the ASSIGN statement, the system carries out the same type checks as for USING parameters of FORMs.
    This addition is not allowed in an ABAP Objects context. See Cannot Use Obsolete Casting for FIELD SYMBOLS.
    In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Defining Types Using STRUCTURE.
    Effect
    Assigns any (internal) field string or structure to the field symbol from the ABAP Dictionary (s). All fields of the structure can be addressed by name: <fs>-fieldname. The structured field symbol points initially to the work area wa specified after DEFAULT.
    The work area wa must be at least as long as the structure s. If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
    Example
    Address components of the flight bookings table SBOOK using a field symbol:
    DATA SBOOK_WA LIKE SBOOK.
    FIELD-SYMBOLS <SB> STRUCTURE SBOOK
    DEFAULT SBOOK_WA.
    WRITE: <SB>-BOOKID, <SB>-FLDATE.
    Related
    ASSIGN, DATA
    Additional help
    Declaring Field Symbols
    FIELD GROUPS
    are used to hold/handle large amount of data when the internal table are not useful
    we use EXTRACT statement, HEADER structure in them
    see the example
    REPORT demo_extract.
    NODES: spfli, sflight.
    FIELD-GROUPS: header, flight_info, flight_date.
    START-OF-SELECTION.
      INSERT: spfli-carrid spfli-connid sflight-fldate
                INTO header,
              spfli-cityfrom spfli-cityto
                INTO flight_info.
    GET spfli.
      EXTRACT flight_info.
    GET sflight.
      EXTRACT flight_date.
    END-OF-SELECTION.
      SORT STABLE.
      LOOP.
        AT FIRST.
          WRITE / 'Flight list'.
          ULINE.
        ENDAT.
        AT flight_info WITH flight_date.
          WRITE: / spfli-carrid , spfli-connid, sflight-fldate,
                   spfli-cityfrom, spfli-cityto.
        ENDAT.
        AT flight_date.
          WRITE: / spfli-carrid , spfli-connid, sflight-fldate.
        ENDAT.
        AT LAST.
          ULINE.
          WRITE: cnt(spfli-carrid), 'Airlines'.
          ULINE.
        ENDAT.
      ENDLOOP.
    FIELD STRING is nothing but a string with  one row of records.
    Reward points if useful
    regards
    Anji

  • Issue while moving from string to field symbol -- waiting for help

    Hi Abap Experts,
    At present I got stucked here at client place. Please help me . Thanks in advance.
    I have a structure in field symbol. I also have data in the string (rec ty )
    I need to move it to corresponding fields in the field symbol. While moving, it is giving a dump.
    data:linetype type string,
    struc type ref to DATA.
    field-symbols: <fs> type any.
    linetype = i_strucname.
    " Get internal table and attach the field-symbol
    CREATE DATA struc type standard table OF (linetype).
    ASSIGN struc->* TO <fs>.
    <fs> = string. (dump is occuring here)

    Hi,
    My code:
    data:linetype type string,
    struc type ref to DATA.
    field-symbols: <fs> type any ,
    <f1> type any .
    linetype = i_strucname (Z structure)
    " Get internal table and attach the field-symbol
    CREATE DATA struc type standard table OF (linetype).
    ASSIGN struc->* TO <fs>.
    I need to populate the Z structure at runtime with the appropriate field values from the string.
    for example:
    input: abc \ \xyz
    structure: first ffield length 10,   " MY Z STRUCTURE
                   second field length 5
                    third field length 10.
    output: abc        xyz         
    I get the structures dynamically.

  • Field symbols - casting error

    Hi,
       I created a table dynamically and assigned it to field symbol. Now i want to write the contents of the internal table to a flat file in app server. Here is what i am doing.
    parameters: p_table(30) type c default 'PA0008',
                p_file LIKE RLGRAP-FILENAME default '/usr/sap/tmp/test.txt'.         " Path to save files to
    FIELD-SYMBOLS: <w_table> type standard table,
                   <w_wa>   TYPE any,
                   <w_field> type any.
    DATA: w_dyn_wa type ref to data,
          w_dyn_table type ref to data.
    CREATE DATA w_dyn_wa TYPE (p_table). "Suitable work area
    ASSIGN w_dyn_wa->* TO <w_wa>.
    create data w_dyn_table type standard table of (p_table).
    assign w_dyn_table->* to <w_table>.
    data w_dyn_data(5000) type c.
    SELECT * FROM (p_table) INTO table <w_table> where endda >= sy-datum.
    Data: w_temp type string.
    OPEN DATASET p_file FOR OUTPUT IN TEXT MODE encoding default.
    IF SY-SUBRC = 0.
      loop at <w_table> into <w_wa>.
      w_temp = ''.
        do.
          assign component sy-index of structure <w_wa> to <w_field>.
          if sy-subrc <> 0.
            exit.
          endif.
          concatenate w_temp <w_field> into w_temp respecting blanks.
          if sy-index = 1.
            transfer '' to p_file.
          endif.
         transfer <w_field> to p_file no end of line.
        enddo.
       transfer w_temp to p_file no end of line.
       write:/ w_temp.
      endloop.
    endif.
    close dataset p_file.
    when i run the program with PA0008 i am getting a casting error "Object not char like". How do i get rid of this error?. I tried moving the contents of field symbol to a string and appending it. It worked, but i lost the exact formatting of data in the file. In other words, it got rid of extra blanks. I need exact structure of internal table in the file.
    Thanks,
    Sandeep
    Thanks,
    Sandeep

    Hi
    Have u tried to use MOVE statament instead of CONCATENATE?
    do.
    assign component sy-index of structure <w_wa> to <w_field>.
    if sy-subrc <> 0.
    exit.
    endif.
    DESCRIBE FIELD <W_FIELD> LENGTH V_LEN.
    MOVE <W_FIELD> TO w_temp+V_OFFSET(V_LEN).
    V_OFFSERT = V_OFFSET + V_LEN.
    Max

  • How to find as ascii value for a string or char in unicode system?

    Hello,
    How to find an ascii value for a string or char in unicode system?
    Thanks in Advance

    hi ,
    report demtest.
    data : c.
    field-symbols : <n> type x.
    data : rn type i.
    c = 'A'.
    assign c to <n> casting.
    move <n> to rn.
    write rn.
    This will convert 'A' to 65.
    Tom Demuyt
    How to convert ascii value to character.
    If I give input as 65 (ascill value) I want display 'A'.
    Below logic is for convert from character to ascii value , now I want to know how to convert ascii value to character.
    Naveen
    report demtest.
    *going from A to 65
    data : c value 'A'.
    field-symbols : <n> type x.
    data : rn type i.
    assign c to <n> casting.
    move <n> to rn.
    write rn.
    *going from 66 to B
    data : i type i value 66.
    data : x type x.
    field-symbols : <fc> type c.
    move i to x.
    assign x to <fc> casting type c.
    move <fc> to c.
    write c.
    regards,
    venkat.

  • Modify DB by single field using Field Symbol

    Hi,
      please help me ,actually i have not use the field symbol in any object. i have one requirement ,i have to modify the DB by field STATUS using Field symbol ,
    I am sending u my code so please help me how can i modify DB using field symbol..
              gw_msg3_status1   = k_status1 .
              LOOP AT gi_msg3 INTO gs_msg3.
                gs_msg3-status  = gw_msg3_status1 .
                gs_msg3-issue   = lw_issuno.
           MODIFY gi_msg3 FROM gs_msg3 TRANSPORTING status.
                MODIFY gi_msg3 INDEX sy-tabix FROM gs_msg3 TRANSPORTING issue status.
              ENDLOOP.
    Thanks & Regards,
    Meenakshi

    perform dboperation_table using 'SET' 'BIRTHDT' '=' <fs>.
        perform dboperation_table using 'WHERE' 'PARTNER' '='  <fs>
        perform dboperation_update using 'BUT000'.
    form dboperation_table
    using p_type
          p_var1
          p_var2
          p_var3.
      data: t_l type cmst_str_data.
      data: d_cx_root            type ref to cx_root,
            d_text               type string.
      try.
          clear t_l.
          if p_var3 is not initial.
            t_l = p_var3.
            condense t_l.
            concatenate '''' t_l '''' into t_l.
          endif.
          concatenate p_var1 p_var2 t_l into t_l
          separated by space.
          case p_type.
            when 'SET'.   append t_l to g_s_t.
            when 'WHERE'. append t_l to g_w_t.
          endcase.
        catch cx_root into d_cx_root.
          d_text = d_cx_root->get_text( ).
          message a398(00) with  d_text.
      endtry.
    endform.                    "DBOPERATION_table
    form dboperation_update
    using  p_tabname type zdboperation-tabname.
      data: tabname type bus_table.
      data: d_cx_root            type ref to cx_root,
            d_text               type string.
      try.
          tabname-tabname = p_tabname.
          call function 'ZDBOPERATION_UPDATE'
            in update task
            exporting
              tabname     = tabname
            tables
              where_table = g_w_t
              set_table   = g_s_t.
        catch cx_root into d_cx_root.
          d_text = d_cx_root->get_text( ).
          message a398(00) with  d_text.
      endtry.
    endform.                    "DBOPERATION_update
    Hope it will help you.
    Regards,
    Madan.

  • How to use different field symbols to append data in a loop

    Hi experts!
    I have to loop over a itab and I want to save different  into one table.
    See my code below:
    DATA: l_hours        TYPE i,
          grfk_ok_code    TYPE sy-ucomm,
          grfk_values     TYPE TABLE OF GPRVAL WITH HEADER LINE,
          grfk_coltxt     TYPE TABLE OF GPRTXT WITH HEADER LINE,
          wa_ztab         TYPE zqm_chq_prueflos,
          l_index      TYPE n,
          l_field      TYPE string,
          l_line_check TYPE string
    FIELD-SYMBOLS:
          <fs_0102>   TYPE ANY,
          <fs_0304>   TYPE ANY,
          <fs_0506>   TYPE ANY,
          <fs_grenze> TYPE ANY
    REFRESH: grfk_values.
    CLEAR:   l_hours.
      LOOP AT ztab INTO wa_ztab.
      AT NEW qase_serialnr.
        CLEAR: l_line_check.
        IF wa_ztab-qase_serialnr CS '-01'
        OR wa_ztab-qase_serialnr CS '-02'.
            grfk_values-rowtxt = 'gelötet'.
            l_line_check = '0102'.
        ELSEIF wa_ztab-qase_serialnr CS '-03'
        OR     wa_ztab-qase_serialnr CS '-04'.
            grfk_values-rowtxt = 'geglüht'.
            l_line_check = '0304'.
        ELSEIF wa_ztab-qase_serialnr CS '-05'
        OR     wa_ztab-qase_serialnr CS '-06'.
            grfk_values-rowtxt = 'unbehandelt'.
            l_line_check = '0506'.
        ELSE.
          grfk_values-rowtxt = 'serialnr_wrong'.
        ENDIF.
      ENDAT.
    ***---------------------------------------------------->
      AT NEW qapp_usern1.
    *   X-axis: values are:0,50,100,...,400
        grfk_coltxt-coltxt = wa_ztab-qapp_usern1.
        SHIFT grfk_coltxt-coltxt LEFT DELETING LEADING '0'.
        APPEND grfk_coltxt.
        UNASSIGN <fs_grenze>.
        CLEAR: l_index, l_field.
        l_index = sy-tabix.
        CONCATENATE 'grfk_values-val' l_index INTO l_field.
        ASSIGN (l_field) TO <fs_grenze>.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        <fs_grenze> = 10.
        APPEND grfk_values.
      ENDAT.
      IF l_line_check = '0102'.
          UNASSIGN <fs_0102>.
          CLEAR: l_index, l_field.
          l_index = sy-tabix.
          CONCATENATE 'grfk_values-val' l_index INTO l_field.
          ASSIGN (l_field) TO <fs_0102>.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          <fs_0102> = wa_ztab-cf_dgp.
      ELSEIF l_line_check = '0304'.
          UNASSIGN <fs_0304>.
          CLEAR: l_index, l_field.
          l_index = sy-tabix.
          CONCATENATE 'grfk_values-val' l_index INTO l_field.
          ASSIGN (l_field) TO <fs_0304>.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          <fs_0304> = wa_ztab-cf_dgp.
      ELSEIF l_line_check = '0506'.
          UNASSIGN <fs_0506>.
          CLEAR: l_index, l_field.
          l_index = sy-tabix.
          CONCATENATE 'grfk_values-val' l_index INTO l_field.
          ASSIGN (l_field) TO <fs_0506>.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          <fs_0506> = wa_ztab-cf_dgp.
      ENDIF.
    ENDLOOP.
    My goal should be to fill the graphic with 4 Lines:
    1 is boarderline.
    2-3 are the lines with the looped values in "ztab"
    Do I have to use references to write the values in  into different rows of internal table "grfk_values"????
    With this code I want to fill the itab which I need for the GFW_PRES_SHOW function.
    The table I have to commit has the following structure:
    -rowtxt
    -val1
    -val2
    -val31
    EDIT:
    My current output are 2 lines the first has value 0 for each point and the second shows the correct values... The boarder which always should have value 10 is completly not shown.

    hopen this will help
    report zrich_0001 .
    data: begin of itab1 occurs 0,
          fld1(10) type c,
          fld2(10) type c,
          fld3(10) type c,
          end of itab1.
    data: begin of itab2 occurs 0,
        flda(10) type c,
        fldb(10) type c,
        fldc(10) type c,
        end of itab2.
    field-symbols: <fs_table> type table,
                   <fs_wa>,
                   <fs>.
    data: mod_field(10) type c.
    itab1-fld1 = '1'. itab1-fld2 = '2'. itab1-fld3 = '3'. append itab1.
    itab1-fld1 = '4'. itab1-fld2 = '5'. itab1-fld3 = '6'. append itab1.
    itab2-flda = 'A'. itab2-fldb = 'B'. itab2-fldc = 'C'. append itab2.
    itab2-flda = 'D'. itab2-fldb = 'E'. itab2-fldc = 'F'. append itab2.
    assign itab1[] to <fs_table>.
    assign itab1 to <fs_wa>.
    mod_field = 'FLD2'.
    perform modify_table.
    perform write_table.
    assign itab2[] to <fs_table>.
    assign itab2 to <fs_wa>.
    mod_field = 'FLDC'.
    perform modify_table.
    perform write_table.
          FORM modify_table                                             *
    form modify_table.
      loop at <fs_table> into <fs_wa>.
        assign component mod_field of structure <fs_wa> to <fs>.
        <fs> = 'Modified'.
        modify <fs_table> from <fs_wa>.
      endloop.
    endform.
          FORM write_table                                             *
    form write_table.
      loop at <fs_table> into <fs_wa>.
        do.
          assign component sy-index of structure <fs_wa> to <fs>.
          if sy-subrc <> 0.
            exit.
          endif.
          if sy-index = 1.
            write:/ <fs>.
          else.
            write: <fs>.
          endif.
        enddo.
      endloop.
    endform.
    regards
    navjot
    reward points if helpfull

  • RUn time error while  saving po    Field symbol has not yet been assigned.

    Hi Experts,
    I am getting abap dump while saving PO in ME21N  plz seee the below dump  plzzzzzzzzzzzzzzzzzzzzz help me
    Runtime Errors         GETWA_NOT_ASSIGNED
    Date and Time          19.06.2009 11:24:46
    Short dump has not been completely stored (too big)
    Short text
         Field symbol has not yet been assigned.
    What happened?
         Error in the ABAP Application Program
         The current ABAP program "SAPLKKBL" had to be terminated because it has
         come across a statement that unfortunately cannot be executed.
    What can you do?
         Note down which actions and inputs caused the error.
         To process the problem further, contact you SAP system
         administrator.
         Using Transaction ST22 for ABAP Dump Analysis, you can look
         at and manage termination messages, and you can also
         keep them for a long time.
    Error analysis
         You attempted to access an unassigned field symbol
         (data segment 106).
         This error may occur if
         - You address a typed field symbol before it has been set with
           ASSIGN
         - You address a field symbol that pointed to the line of an
           internal table that was deleted
        - You address a field symbol that was previously reset using
          UNASSIGN or that pointed to a local field that no
          longer exists
        - You address a global function interface, although the
          respective function module is not active - that is, is
          not in the list of active calls. The list of active calls
          can be taken from this short dump.
    How to correct the error
        If the error occures in a non-modified SAP program, you may be able to
        find an interim solution in an SAP Note.
        If you have access to SAP Notes, carry out a search with the following
        keywords:
        "GETWA_NOT_ASSIGNED" " "
        "SAPLKKBL" or "LKKBLF99"
        "GEN_FIELD_OUT2"
        If you cannot solve the problem yourself and want to send an error
        notification to SAP, include the following information:
        1. The description of the current problem (short dump)
           To save the description, choose "System->List->Save->Local File
        (Unconverted)".
        2. Corresponding system log
           Display the system log by calling transaction SM21.
           Restrict the time interval to 10 minutes before and five minutes
        after the short dump. Then choose "System->List->Save->Local File
    (Unconverted)".
    3. If the problem occurs in a problem of your own or a modified SAP
    program: The source code of the program
       In the editor, choose "Utilities->More
    Utilities->Upload/Download->Download".
    4. Details about the conditions under which the error occurred or which
    actions and input led to the error.
    em environment
    SAP-Release 700
    Application server... "gplqty"
    Network address...... "128.12.0.19"
    Operating system..... "Windows NT"
    Release.............. "5.2"
    Hardware type........ "8x AMD64 Level"
    Character length.... 16 Bits
    Pointer length....... 64 Bits
    Work process number.. 0
    Shortdump setting.... "full"
    Database server... "GPLQTY"
    Database type..... "MSSQL"
    Database name..... "GPQ"
    Database user ID.. "gpq"
    Char.set.... "C"
    SAP kernel....... 700
    created (date)... "Aug 4 2008 02:33:25"
      create on........ "NT 5.2 3790 Service Pack 1 x86 MS VC++ 14.00"
      Database version. "SQL_Server_8.00 "
      Patch level. 172
      Patch text.. " "
      Database............. "MSSQL 7.00.699 or higher, MSSQL 8.00.194"
      SAP database version. 700
      Operating system..... "Windows NT 5.0, Windows NT 5.1, Windows NT 5.2, Windows
       NT 6.0"
      Memory consumption
      Roll.... 16192
      EM...... 16759360
      Heap.... 0
      Page.... 237568
      MM Used. 12036016
      MM Free. 530432
    er and Transaction
      Client.............. 410
      User................ "SAP_SUPPORT"
      Language key........ "E"
      Transaction......... "ME21N "
      Transactions ID..... "9E955CDE97CBF1648B4C001A64C7B85A"
      Program............. "SAPLKKBL"
      Screen.............. "SAPLKKBL 0500"
      Screen line......... 3
    Information on where terminated
        Termination occurred in the ABAP program "SAPLKKBL" - in "GEN_FIELD_OUT2".
        The main program was "RM_MEPO_GUI ".
        In the source code you have the termination point in line 2908
        of the (Include) program "LKKBLF99".
    Source Code Extract
    Line  SourceCde
    2878       else.
    2879         assign <fs11> to <field>.
    2880         gs_fc = gs_sfc11.
    2881       endif.
    2882     when 012.
    2883       if gs_out_flags-slave ne 'X'.
    2884         assign <fm12> to <field>.
    2885         gs_fc = gs_mfc12.
    2886       else.
    2887         assign <fs12> to <field>.
    2888         gs_fc = gs_sfc12.
    2889       endif.
    2890     when 013.
    2891       if gs_out_flags-slave ne 'X'.
    2892         assign <fm13> to <field>.
    2893         gs_fc = gs_mfc13.
    2894       else.
    2895         assign <fs13> to <field>.
    2896         gs_fc = gs_sfc13.
    2897       endif.
    2898     when 014.
    2899       if gs_out_flags-slave ne 'X'.

    Hi,
    this error occurs when you try to address a field-symbol before it has been assigned to a field or
    the assignment has failed.
    Use following code to remove this dump
    Assign <mara-matnr> to <fs>.
    if sy-subrc <> 0.
      Error Message.
    Endif.
    Hope it helps,
    Raj

  • Storing a field of length 500 char in a database table

    I want to create a ztable in which I need  to store the data of length more than 256 , so please let me know , how can we create the field of length 500 chars..
    I have tried using STRING and LCHR , but it's not working.
    Thank You,
    Ankur Goyal

    Hi,
    Try creating the field like this
    1. Create a new data element with required description.
    2. While creating data element select 'Built-in type' radio button under Data Type tab. Specify Data type as STRING and press enter. You need not specify Length (or you can provide 500 here, I suggest not to specify field length as it leads to short dump if you enter text more than 500 chars in it).
    Note: Once you press enter you can see an information message 'No length restriction'.
    3. Save and activate the data element.
    4. Use the data element for your text field in your custom table.
    Important:
    The text field with size >255 chars should not be a key field, neither you should select 'Initial values' option while defining field.
    I have tried this and it worked.
    Hope this helps.
    Thanks,
    Venkat

  • 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

  • How to get the current type of a generic Field Symbol

    Hi Experts,
    I have a Field Symbol:
    FIELD-SYMBOLS: <lf_any> TYPE ANY.
    I loop around an internal table with a generic structure and assign their fields to my fieldsymbol:
    LOOP AT it_data ASSIGNING <lf_any>.
    After executing this statement I am able to see the current Absolute Type of the field Symbol in debugger.
    For example this could be TYPE ZX_1 in first loop, TYPE ZX_2 in second loop and so on...
    Question: How can I get this current type within my Loop?
    The Reason is I have to CREATE DATA xxx TYPE "current type of the field symbol".
    Thanks,
    Daniel

    Hello Daniel
    Do you have the RTTI classes available on your system? If so then try the following:
    *& Report  ZUS_SDN_RTTI_GET_TYPE
    REPORT  zus_sdn_rtti_get_type.
    DATA: gt_knb1   TYPE STANDARD TABLE OF knb1,
          gd_type   TYPE string.
    DATA: go_typedescr    TYPE REF TO cl_abap_typedescr,
          go_strucdescr   TYPE REF TO cl_abap_structdescr.
    FIELD-SYMBOLS: <gs_struc> TYPE ANY.
    START-OF-SELECTION.
      APPEND INITIAL LINE TO gt_knb1.
      LOOP AT gt_knb1 ASSIGNING <gs_struc>.
        go_typedescr = cl_abap_typedescr=>describe_by_data( <gs_struc> ).
        go_strucdescr ?= go_typedescr.
        gd_type = go_typedescr->get_relative_name( ).
        WRITE: / 'Type=', gd_type.
        gd_type = go_strucdescr->get_relative_name( ).
        WRITE: / 'Type=', gd_type.
      ENDLOOP.
    END-OF-SELECTION.
    Regards
      Uwe

  • How to populate values of field symbols?

    HI,
    I need to pass values into a field-symbol (defined as a dynamic Work Area) and append the values later on into another field-symbol (defined as a dynamic Table) by inserting the work area to the table. The insert statement in the screen shot below is syntetically correct but when I uncomment
    *      <gw_itab>-tplnr = 'TPLNR'.
    *      <gw_itab>-pmsog = 'PMSOG'.
    *      <gw_itab>-k_pro = 'K_PRO'.
    I get a syntax error. During debugging if I pass the values of the work area, they are properly appended into the table.
    Could somebody show me the code on how to atain this programatically?
    Thanks for your help
    Carl

    From the short dump:
    "<GT_ITAB> has line type "v" and the length 24, but the work area has line type "g" and the length 8".
    The code you included in your first screenshot is not the code that it dumped on... Looking at the shortdump here's what you have.
    lv_fieldname = '<GW_ITAB>-TPLNR'.
    assign (lv_fieldname) to <gw_itab>.
    <gw_itab> = 'TPLNR'.
    insert <gw_itab> into table <gt_itab>.
    This code doesn't make any sense...
    What you're saying is:
    <gw_itab> points to <gw_itab>-tplnr. So now it points to just a field of the structure, not the whole structure.... Then you say that field is set to 'TPLNR'. So you set the field of the original structure called TPLNR to be the string "TPLNR"...
    If that's really what you're trying to do then try changing it to:
    field-symbols: <field> type any.
    lv_fieldname = '<GW_ITAB>-TPLNR'.
    assign (lv_fieldname) to <field>.
    <field> = 'TPLNR'.
    insert <gw_itab> into table <gt_itab>.

Maybe you are looking for

  • Is there a way to create text that 'writes and scrolls' ?

    Little tricky to explain but we have all seen the sort of thing I mean.... Ive attached an image to try and make it a bit clearer. Its basically data thats spilling out across a computer display...the sort of thing we have seen in loads of movies. I

  • Asset Retirement: Transaction "Asset Sale without customer" (ABAON)

    Hi Experts, While posting Asset Retirement in ABAON, error occurs as "SYST: You can not determine the period for rule 02 to 23.03.11". Here we are retiring 3 assets. One from one asset class & other 2 from another asset class. for the 1st Asset Class

  • Oracle 10g RAC clusterware : runcluvfy.sh comp sys giving java exception

    Hi forum, I am getting an exception java.util.NoSuchElementException while running the command /stage/crs/cluvfy/runcluvfy.sh comp sys -n m4000-pnoc7,m4000-pnoc8 -p crs -osdba crs -orainv oinstall Verifying system requirement Checking system requirem

  • Why is my phone stuck in assist mode

    I have been using my phone fine all day,  until i noticed that when i went to unlock my phone a 'Grey Box" was highlighting the time, when I went to swipe my screen a box appeared around that. I am now stuck, as once I finnally got into the unlocked

  • Iphone newbie, looking for apps to do calendars and invoicing

    Hello- I have had my iphone 4 for 2 days now and I'm pretty happy. One of the main things I would like to do is have my work calendar synched to some type of invoicing program. I am a freelancer working for several different companies and some have d