Field Symbols in BADI

Hi Experts,
we had a change parameter in BADI Method which is TYPE ANY.
Now i want to change one valune in this parameter.
Actually this contains a row of data of some structure.
I need to change a particular field of that structure.
how to do this...
thanks,
chandra.
Edited by: Chandra Sekhar on Jun 15, 2009 12:17 PM

Hi,
From the BADI details i find that you are referrinn to the parameter SCREEN_STRUCTURE.
Declare a field-symbols of type any.
Assign SCREEN_STRUCTURE to <fs>.
To access the particular field of SCREEN_STRUCTURE you should know either the fieldname or the field position.
Then use ASSIGN COMPONENT (fieldname or field postion) OF STRUCTURE <FS> TO <FS1>.
Here <FS1> is one more field-symbol of type any.
Hope you get teh concept.
Regards,
Ankur Parab

Similar Messages

  • Problem trying to create FIELD SYMBOLS in BADI.

    Hi guys!
    I'm trying to create a Field Symbol in method CHECK of BADI me_process_req_cust (well, I'm working on a Z implementation).
    The problem is that I'm trying to create a FIELD SYMBOL and when I check the syntaxsis, I receive the next error:
    Clase ZCL_IM_MM_PURREQ_UPDATE,Método IF_EX_ME_PROCESS_REQ_CUST~CHECK
    Names may only consist of the characters "A-Z", "0-9" and "_". In
    addition, they may not begin with a number.
    This is the code:
            FIELD-SYMBOLS: <sy-mereq> TYPE mereq3328-afnam.
    Any idea????
    Thanks in advance!
    Bet

    Hi Silveria,
    The problem lies in
    FIELD-SYMBOLS: <sy-mereq> TYPE mereq3328-afnam.
    instead of that it should be something like this
    FIELD-SYMBOLS: <sy_mereq> TYPE mereq3328-afnam.
    With your code you will be getting a syntax error saying sy-mereq is not defined,as it will be looking for the mereq in the system fields.
    Regards
    Abhinab Mishra

  • BADI Implementation field symbol error in code...

    Hi,
    My requirement is to provide barcode for a particular equipment in trasaction IE06. I've implemented badi for that too.
    But the problem is when pressing the print barcode button its gives barcode for all equipments rather than giving for particular one.
    I think issue is in the code ..here in code field symbol is used for processing the selected equipment buut its not working..
    the code is as follows..
    METHOD if_ex_badi_eam_list_fcode~execute_function_code.
      BREAK-POINT.
      CONSTANTS: lc_formname TYPE fpname VALUE 'Z_BARCODE_PRINT_FORM',
                 lc_cat TYPE char2 VALUE 'EQ'.
      CONSTANTS: lc_formname1 TYPE fpname VALUE 'Z_BARCODE_PRINT_FUNCTIONAL_LOC',
               lc_cat1 TYPE char2 VALUE 'FL'.
      DATA: lv_fname TYPE funcname,
            lv_equip TYPE string,
            lv_outparamas TYPE sfpoutputparams,
            lw_objects TYPE rihequi_list,
            LW_OBJECTS1 TYPE  RIHIFLO_LIST.
    *  DATA: ls_objects type REF TO ANY." TABLE."RIHEQUI_LIST.
      FIELD-SYMBOLS <ls_objects> TYPE ANY.
      IF sy-tcode EQ 'IE06'.
    *    lc_formname = 'Z_BARCODE_PRINT_FORM'.
        CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
          EXPORTING
            i_name     = lc_formname
          IMPORTING
            e_funcname = lv_fname.
        CALL FUNCTION 'FP_JOB_OPEN'
          CHANGING
            ie_outputparams = lv_outparamas
          EXCEPTIONS
            cancel          = 1
            usage_error     = 2
            system_error    = 3
            internal_error  = 4
            OTHERS          = 5.
        IF sy-subrc <> 0.
          MESSAGE 'An error occured in processing the background job' TYPE 'E'.
          EXIT.
        ENDIF.
        LOOP AT it_selected_objects INTO lw_objects.
          lv_equip = lw_objects-equnr.
          CALL FUNCTION lv_fname
            EXPORTING
    *   /1BCDWB/DOCPARAMS        =
              item_no                  = lv_equip
              item_cat                 = lc_cat
    * IMPORTING
    *   /1BCDWB/FORMOUTPUT       =
    * EXCEPTIONS
    *   USAGE_ERROR              = 1
    *   SYSTEM_ERROR             = 2
    *   INTERNAL_ERROR           = 3
    *   OTHERS                   = 4
          IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    *      ENDIF.
          CLEAR: lv_equip,lw_objects.
          UNASSIGN <ls_objects>.
        ENDLOOP.
        CALL FUNCTION 'FP_JOB_CLOSE'
    * IMPORTING
    *   E_RESULT             =
    * EXCEPTIONS
    *   USAGE_ERROR          = 1
    *   SYSTEM_ERROR         = 2
    *   INTERNAL_ERROR       = 3
    *   OTHERS               = 4
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    Please Help....

    Hi Akshay,
    1. It is not a standard program, it is a custom one.
    2. Try to fix the bug such that field symbol gets assigned.
    3. Place the necessary checks before trying to read the field-symbol, i.e. IF <FIELD> IS ASSIGNED. ... ENDIF.
    Cheers,
    Aabhas

  • Assign field symbols in infotype 0021 BADI implementation (HRPAD00INFTY )

    Hi there,
    In PA30 infotype 0021, i have to change the value of T_VIEW_REPID by implementing BADI HRPAD00INFTY [Program MP002100->screen 2000->MODULE BEFORE_OUTPUT->PERFORM badi_before_output(sapfp50m)]. I'm trying to use field symbols (as below) to change the value of T_VIEW_REPID and getting SY-SUBRC = 4 after the Assign (LV_WA) To <FS_REPID>. Can somebody please help.
    method IF_EX_HRPAD00INFTY~BEFORE_OUTPUT.
      Data: LV_WA(20) Type C Value '(MPPDAT02)VIEW_REPID'.
      Types: T_VIEW_REPID Type T582V-REPID.
      Field-Symbols: <FS_REPID> Type T_VIEW_REPID.
      Assign (LV_WA) To <FS_REPID>.
    endmethod.
    Thanks.

    Try like this
    method IF_EX_HRPAD00INFTY~BEFORE_OUTPUT.
      Data: LV_WA(20) Type C Value '(MP002100)VIEW_REPID'.
    Types: T_VIEW_REPID Type T582V-REPID.
      Field-Symbols: <FS_REPID> Type T_VIEW_REPID.
      Assign (LV_WA) To <FS_REPID>.
    endmethod.

  • BPC NW: Field symbol not assigned in BADi as Endroutine

    HI Experts,
    I have a problem when working with BADis as Endroutines in a TransformationFile.
    Guided by the "How To... Use Start and End Routine" I followed the different steps and for the Start Routine everything works fine. My problem is when trying to call the TransformationFile with the Endroutine I get a  GETWA_NOT_ASSIGNED dump telling me that: Field symbol has not yet been assigned.
    I'm using quite the same code as given in the How To. I introduced some checks, but  I did not get any positive results. Can anybody help, please? The How To is made for master data, I assume the error comes from this side, but I can't assure it.
    The code in the Badi is:
    field-symbols:
           type any.
    data: lt_columns type table of string.
    data: lt_column_data type table of string.
    data: lt_message type uj0_t_message.
    data: lt_error_reason type uj0_t_message,
          lv_tabix like sy-tabix.
    data:
          lo_dataref      type ref to data,
          lv_cuenta_asig  type zmap_cuentas-cuenta_asignado.
    Assign importing data reference to field symbol
    assign ir_data->* to  IS ASSIGNED.
    Create work area for importing data
    create data lo_dataref like line of .
    Create new internal table for exporting data
    check .
    Get CUENTA value from custom table or other datasource
    loop at .
    The error occurs when assigning the first pointer.
    By the way, I'm working on BPC 7.5 SP07 for NW.
    Hope someone can help. Thanks very much in advance,
    Àlex

    Hi Kaylan,
    thank you very much for your quick answer.
    Sorry, I think I haven't made quite clear my point.
    I want to use the Endroutine BADi in a Transformation File for Transaction Data, therefor there is no InfoObject directly involved. I use the Transformation File in the Package "Import Transaction Data". The How To I mentioned, and the only one I found that is more or less near to my problem describes how to use Endroutines and BADis for the Import of Master Data.
    Looking at the different tests I have done, as our system team is not giving us a debug user, the dump happens at the assignment of the first field symbol: assign ir_data->* to . Therefor I assume that  ir_data contains no data and this causes the dump.
    My main question is, can I use the code of the mentioned How To for the package "Import Transaction Data" at all? Or do I have to use different tables or table names for this package? How and where do I get them?
    You have an idea? Would be very helpful! Thanks in advance!
    Cheers
    Àlex

  • Field Symbols Assign Type Conflict

    Hi,
        I am working on a BAdi Implementation and have the following code.
    <b>method IF_EX_DPR_ATTRIBUTES~SET_DEFAULTS_UPON_CREATION .
      FIELD-SYMBOLS:
        <ls_attributes> TYPE dpr_ts_project_ext.
      ASSIGN cs_attributes TO <ls_attributes>  .
      CASE flt_val.
        WHEN cl_dpr_co=>sc_ot_project.
          <ls_attributes>-extended_attributes-ZZSOL_PRJ_ID = 'C0001'.
      ENDCASE.
    ENDMETHOD.</b>
    This is the sample implementation code provided by SAP. However, when I implement the above code, the system dumps at the statement
    <i>  ASSIGN cs_attributes TO <ls_attributes> .</i>
    and cs_attributes is of type any.
    I tried the same code by adding "CASTING" at the end of above line. But, it still gives the dump. Below, is the dump message.
    Note
    The following error text was processed in the system BS3 : Error in ASSIGN in the program ZCL_IM_DPR_ATTRIBUTES=========CP .
    The error occurred on the application server acequad_BS3_30 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Form: IF_EX_DPR_ATTRIBUTES~SET_DEFAULTS_UPON_CREATION of program ZCL_IM_DPR_ATTRIBUTES=========CP
    Form: IF_EX_DPR_ATTRIBUTES~SET_DEFAULTS_UPON_CREATION of program CL_EX_DPR_ATTRIBUTES==========CP
    Form: ATTRIBUTES_DEFLTS_UPON_ACTION of program CL_DPR_BADI_SERVICES==========CP
    Form: ATTRIBUTES_DEFAULTS_UPON_CREA of program CL_DPR_BADI_SERVICES==========CP
    Form: SET_DEFAULTS_UPON_CREATION of program CL_DPR_PROJECT================CP
    Form: SET_DEFAULTS_UPON_CREATION of program CL_DPR_PROJECT_O==============CP
    Form: CONSTRUCTOR of program CL_DPR_PROJECT_O==============CP
    Form: IF_DPR_APPL_OBJECT_FACTORY~CREATE_PROJECT of program CL_DPR_APPL_OBJECT_FACTORY====CP
    Form: CREATE of program CL_DPR_BSP_APPLICATION========CP
    Form: DO_HANDLE_EVENT of program CL_DPR_BSP_C_TOOLS============CP
    Any ideas on how to use field symbols in the above context??
    Thanks,
    Rajesh

    Hi Rajesh,
    The reason it is dumping is because the actually type of the variable passed in CS_ATTRIBUTES is not fixed this is why they have specified it's type as type any.
    The sample code in this regard is not correct, you should fist check the value of FLT_VAL to determine what type of variable CS_ATTRIBUTES actually is.
    In the BADI documentation there is a list of values for field FLT_VALUE and the corresponding data type of CS_ATTRIBUTES for that value (According to the documentation the data type for FLT_VAL sc_ot_project is DPR_TS_PROJECT_INT).
    method IF_EX_DPR_ATTRIBUTES~SET_DEFAULTS_UPON_CREATION .
    FIELD-SYMBOLS:
    <ls_attributes> TYPE dpr_ts_project_int.
    <i><b>* ASSIGN cs_attributes TO <ls_attributes> .</b></i>
    CASE flt_val.
    WHEN cl_dpr_co=>sc_ot_project.
      <i><b>ASSIGN cs_attributes TO <ls_attributes> .</b></i>
      <ls_attributes>-extended_attributes-ZZSOL_PRJ_ID
                = 'C0001'.
    ENDCASE.
    ENDMETHOD.
    In this example you will ultimately end up with multiple field symbols for representing the CS_ATTRIBUTES parameter, one field symbol for each filter value you intend handling.
    From
      De Wildt

  • Field symbol - advisable

    Hi There was a requirement wherein I need to change the special stock indicator value in the components tab of IW31/IW32 based on the material entered. All the user exits / BADI's had the special stock indicator as the importing parameter and none had it as a changing parameter. I tried to call an error message when wrong value is entered but the screen on the background freezed after the error message appeared. So I used field symbols as assign (SAPLCOMK)RESBD  to <FS1> and changed the source value of special stock indicator if the condition is satisfied.
    Please let me know if it is advisable to change the field contents in desperate cases or if there is any other option to change the special stock indicator.
    Regards,
    Prabaharan.G

    To be on the safe side we used other available exits and managed it but the solution as to whether field symbol can be used or not is still wierd.

  • Problem  FIELD-SYMBOL with HASHED TABLE

    Hello gurus,
    I have a problem with the following code. It is called in method MB_DOCUMENT_BEFORE_UPDATE of badi MB_DOCUMENT_BADI. I need to read the serial numbers of all items. I tried to do it with a field symbol. The information I need is stored in the hased table (SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL->PT_GOSERIAL_KERNEL. The systems returns sy-subrc = 4 after the assign. Can anyone help me? Thanks!
    TYPES: BEGIN OF ty_s_goserial,
              selected TYPE xfeld,
              serialno TYPE    gernr,
            END OF ty_s_goserial,
            ty_t_goserial  TYPE STANDARD TABLE OF ty_s_goserial WITH
                                                     NON-UNIQUE DEFAULT KEY.
      TYPES: BEGIN OF ty_s_goserial_kernel,
                global_counter TYPE migo_global_counter,
                t_goserial TYPE ty_t_goserial,
            END OF ty_s_goserial_kernel.
    types: tyt_goserial TYPE HASHED   TABLE OF ty_s_goserial_kernel
                                     WITH UNIQUE KEY global_counter.
        fs_l_serialno = '(SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL->PT_GOSERIAL_KERNEL'.
        FIELD-SYMBOLS: <fs_serialno> type tyt_goserial.
        ASSIGN (fs_l_serialno) TO <fs_serialno>.
        IF sy-subrc = 4.
          WRITE: / 'Ouch...'.
        ENDIF.

    Hi,
    Try adding body operator..at the end as it is an internal table..
    (SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL->PT_GOSERIAL_KERNEL[]'.
    Thanks
    Naren

  • Fields-symbols

    Hi
    How can i use the fields-symbols in Abap Object (class)?: The program <b>SAPLMIGO</b> have a table <b>oref_detail->t_goserial</b>. I would get this table in my program (not object) by using field-symbol
    What can i do?
    it's urgent
    thanks a lot

    Hello
    Here are the fact:
    (1) oref_detail is of TYPE REF TO lcl_migo_detail (local class)
    * Detail
      oref_detail            TYPE REF TO lcl_migo_detail, (lines 244-245 in LMIGOTOP)
    (2) Here is the definition of the local class (LMIGODC1):
    *   INCLUDE LMIGODC1                                                   *
    *   Detail carrier (data manager)
    CLASS lcl_migo_detail DEFINITION
          INHERITING FROM lcl_migo_screenobject.
      PUBLIC SECTION.
        INTERFACES:
          lif_migo_frame.
        DATA:
    *   Line in the model which is currently displayed
          current_line  TYPE sytabix READ-ONLY,
    *   table for working with serial numbers internally
          t_goserial TYPE lcl_migo_kernel=>ty_t_goserial,
                                           " need to be changed when friend
                                           " concept is available
    *   table for working with freight vendors internally
        t_gofreight TYPE TABLE OF gofreight." need to be changed when friend
        " concept is availible
        METHODS:
          constructor,
          pbo REDEFINITION,
          pbo_godynpro_fill,
          pai REDEFINITION,
          pai_get,
          pai_transfer_fields_fill,
          line_find.                         "ON REQUEST
      PRIVATE SECTION.
        DATA:
          p_global_counter TYPE goitem-global_counter, "old gobal_counter
                                           "(before sort/Not OK)
          p_last_new_line_mode TYPE char1,
          poref_settings TYPE REF TO cl_mmim_userdefaults,
          ps_old_goitem TYPE goitem.    "goitem before PAI-field transport
        METHODS:
            transfer_item_copy.
    ENDCLASS.                    "lcl_migo_detail  DEFINITIO
    (3) t_goserial has the following definition (include LMIGOKE1):
    *     Serial number with SELECTED-flag
         BEGIN OF ty_s_goserial,
           selected TYPE xfeld,
           serialno TYPE    gernr,
         END OF ty_s_goserial,
         ty_t_goserial  TYPE STANDARD TABLE OF ty_s_goserial WITH
                                                  NON-UNIQUE DEFAULT KEY,
    What does it mean that you want to "access" this internal table? Do you need this itab within a userexit or BAdI?
    Regards
      Uwe

  • In webdynpro ,Passing field symbols as values to class methods

    Hi
    Please tell me the ways of accessing database in webdynpro abap(not directly). I am calling Class method for accessing database. As currently I am directly accessing database in my webdynpro application. I have created a class and method for the same.
    In my method I want to use select statement which will return table with values to webdynpro application. So for select statement(Calling Method) I need to use my field symbol values as where in clause .
    Could anyone please help with example code?
    Thanks,
    Ujjwal

    data: in_line type ref to data.
    CREATE DATA in_line LIKE LINE OF <dyn_tab>.
      ASSIGN in_line->* TO <dyn_wa>.
    You can create a data reference and assign it to a field symbol and change the values. direclty passing field symbols is not possible.
    Abhi

  • How to revert back a SAP NOTE? Dump- Field symbol has not yet been assigned

    Hi Experts,
    We r getting dump(cause: Field symbol has not yet been assigned) in production for ABUMN tx, so, when debugged, it came to know that, the Field symbol is coming from REUSE_ALV_LIST_DISPLAY!!
    So, for some reason the system message text is not getting output in ALV-->Dump!!
    So, found a NOTE causing this problem!!
    So, pls. let me know that, How to revert back this/any SAP NOTE? pls. in detail steps wise!!
    thanq
    Edited by: Srinivas on Jan 24, 2008 4:32 PM

    Hi
    In SNOTE tcode,  select the Note that you implemented and click on 'RESET SAP Note Implementation'
    shylesh

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

  • Field symbols and READ TABLE with system code 4

    Hi,
    I have a hashed table and I am using field symbols to point to it to retrieve the field content. I then use it in the READ TABLE statement in the following way:
    Loop at x_data assign <fs>.
    ASSIGN COMPONENT 'xxx' OF STRUCTURE <fs> TO <c1>.
    ASSIGN COMPONENT 'xxx' OF STRUCTURE <fs> TO <c2>.
    READ TABLE ZZZZ assign <fs> with table key a1 = <c1>
                                               a2 = <c2>.
    If sy-subrc = 0.
    endif.
    I ran the debugger and I keep getting a 4. I am not able to get the value from a1 and a2 to see what it is and why it is causing a 4 sy-subrc. I know the value from the hashed table and the values c1 and c2 are the same, so the sy-subrc should be 0.
    How would I read a hashed table using field symbols? I know that usig a standard table, I have to sort the table on the key fields() before I actually can do the READ TABLE using the binary search.
    Please advise. Thanks
    RT

    Hai Rob
    Go  through the following Code
    Field-Symbols are place holders for existing fields.
    A Field-Symbol does not physically reserve space for a field but points to a field, which is not known until run time of the program.
    Field-Symbols are like Pointers in Programming language ‘ C ‘.
    Syntax check is not effective.
    Syntax :
    Data : v1(4) value ‘abcd’.
    Field-symbols <fs>.
    Assign v1 to <fs>.
    Write:/ <fs>.
    DATA: BEGIN OF LINE,
    COL1 TYPE I,
    COL2 TYPE I,
    END OF LINE.
    DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY COL1.
    FIELD-SYMBOLS <FS> LIKE LINE OF ITAB.
    DO 4 TIMES.
    LINE-COL1 = SY-INDEX.
    LINE-COL2 = SY-INDEX ** 2.
    APPEND LINE TO ITAB.
    ENDDO.
    READ TABLE ITAB WITH TABLE KEY COL1 = 2 ASSIGNING <FS>.
    <FS>-COL2 = 100.
    READ TABLE ITAB WITH TABLE KEY COL1 = 3 ASSIGNING <FS>.
    DELETE ITAB INDEX 3.
    IF <FS> IS ASSIGNED.
    WRITE '<FS> is assigned!'.
    ENDIF.
    LOOP AT ITAB ASSIGNING <FS>.
    WRITE: / <FS>-COL1, <FS>-COL2.
    ENDLOOP.
    The output is:
    1 1
    2 100
    4 16
    Thanks & regards
    Sreenivasulu P

  • 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

  • "Read table" and field symbols

    Hello all,
    I have a (hopefully simple) question. Let's suppose I want to do the following:
    loop at itab1 assigning <fs1>.
      read table itab2 assigning <fs2> with table key <fs1>-field1.
      if sy-subrc eq 0.
        move <fs2>-field1 to ls_out-field1.
      endif.
      read table itab3 assigning <fs3> with table key <fs1>-field2.
      if sy-subrc eq 0.
        move <fs3>-field1 to ls_out-field2.
      endif.
    endloop.
    It's also possible to do the following instead:
    loop at itab1 assigning <fs1>.
      unassign: <fs2>,
                <fs3>.
      read table itab2 assigning <fs2> with table key <fs1>-field1.
      read table itab3 assigning <fs3> with table key <fs1>-field2.
      if <fs2> is assigned.
        move <fs2>-field1 to ls_out-field1.
      endif.
      if <fs3> is assigned.
        move <fs3>-field1 to ls_out-field2.
      endif.
    endloop.
    My question is: is it "better" to check sy-subrc after each read, and then do a move statement within that if statement, or is it better to check whether the field symbol is assigned each time I want to fill in a field and read everything at the same time?
    I'm only really concerned about the case where you don't want to drop out of the loop after the read (so if the read fails you just don't fill any data in). I'm also discounting potential human error (otherwise the sy-subrc method wins hands-down).

    Just to close this one (albeit somewhat belatedly). I asked Harry Dietz (the ABAP Performance blogging fella) what he would suggest, and he says sy-subrc all the way. Checking that an integer is zero is considerably faster than checking for the assignment, or otherwise, of a field symbol. Furthermore, whilst the field symbol method has the potential to be faster than the sy-subrc method given some compiler optimizations, unfortunately these optimizations don't exist in the ABAP compiler - they're there in the Java compiler though! Shame really. Apparently the ABAP compiler is a pretty simple beast.
    Anyway - thanks Harry for clearing this one up!

Maybe you are looking for

  • Problem with SLD and Creation of JCo

    Hello everyone! I have a problem with the SLD and the Creation of JCo on the Portal, in trying to create the JCo always tells me that the name used there in the SLD, being that the facility is new. Who performs the installation, set in the SLD the EC

  • Error while starting integrated WLS.

    Hi, I am using JDEV 11.1.2.1.0 Please find the log of WLS startup :- *** Using HTTP port 7101 *** *** Using SSL port 7102 *** D:\jdeveloper\jdeveloper\jdev\system11.1.2.1.38.60.81\DefaultDomain\bin\startWebLogic.cmd [waiting for the server to complet

  • Oracle.DataAccess.dll on Windows 7 64 bit

    Hi, I am migrating a .Net 3.5 windows class library from WinXP 32 bit to Win7 64 bit. I use Oracle 11g 64 bit client to connect to database. my code works in Debug build but not in Release build. here is the error message: "An attempt was made to loa

  • Ipod Nano 3G and Bose Sounddock Problems - Please help if you can?

    Hi all, Hope you can help me out, I have just purchased a Nano 3G and its all fine when working with head phones. Tried it in my Bose Sounddock and it has several issues: 1) will not charge at all 2) will not let me change songs when docked 3) when r

  • UserExit in HR-ABAP.

    Hi to ALL, my requirement is, PL are carry forward to next year and These PL are encashment . Exits are EXIT_SAPLHRLV_004 -->for Encashment,               EXIT_SAPLHRLV_0045-->for PL carry forward Any body can send code for this.... It is v.v.urgent.