Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Field symbols

Former Member
0 Kudos

Hi All,

Can we loop at field symbols.

Please provide sample code for same.

Thanks,

5 REPLIES 5

Former Member
0 Kudos

Hello,

I think this will sove your problem

<b>ASSIGN LOCAL COPY OF INITIAL LINE OF itab TO <fs>.</b>

Effect

You can only use this variant in a subroutine. The system creates a local work area for the internal table itab and sets it to its initial value. The work area is then assigned to the field symbol <fs>.

Note

The field symbol <fs> must be defined locally in the subroutine.

Example

Example to pass any internal table to a subroutine and process it using a local work area:

FORM TEST USING TAB TYPE TABLE.

FIELD-SYMBOLS <WA> TYPE ANY.

ASSIGN LOCAL COPY OF INITIAL LINE OF TAB TO <WA>.

<b> LOOP AT TAB INTO <WA>.

...

ENDLOOP.</b>

ENDFORM.

Reward if helpful

Regards,

LIJO

Former Member
0 Kudos

hi,

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.

reward points if it helps.

rgds

JozsefSzikszai
Active Contributor
0 Kudos

hi Anju,

you have to something like this:

FIELD-SYMBOLS : <gf_table> TYPE TABLE.

FIELD-SYMBOLS : <gf_line> TYPE ANY.

FIELD-SYMBOLS : <gf_field> TYPE ANY.

LOOP AT <gf_table> INTO <gf_line>.

ASSIGN COMPONENT 'ABC' OF STRUCTURE <gf_line> TO <gf_field>.

  • Now you can do anything with <gf_field>, assign values, delete, etc.

ENDLOOP.

hope this helps

ec

Former Member
0 Kudos

Hi

Kindly execute this code.Might give you an idea.

***INCLUDE ZTEST.
 
*& Form  DISPLAY_OBJECT_TYPES
form display_object_types.
 
  data : wal_object_types type type_object_types,
         wal_layout type lvc_s_layo.
  data: obj_transport type ref to zcl_transport.
  field-symbols : <l_fcat> type lvc_s_fcat.
  if t_object_types is initial.
 
    create object obj_transport.
    call method obj_transport->list_object_types
      importing
        t_object_types = t_object_types
        .
 
  endif.
 
  check w_con_objtypes is initial.
 
  perform create_fieldcatalog using 'ZCTRLOBJTYP'
                              changing t_fcat_objtypes.
 
  delete t_fcat_objtypes where fieldname = 'OBJECT'.
  loop at t_fcat_objtypes assigning <l_fcat>.
    case <l_fcat>-fieldname.
      when 'TEXT'.
        <l_fcat>-scrtext_l = 'Object Name'(t30).
        <l_fcat>-scrtext_m = 'Object Name'(t30).
        <l_fcat>-scrtext_s = 'Obj Name'(s30).
        <l_fcat>-reptext = 'Object Name'(t30).
        <l_fcat>-coltext = 'Object Name'(t30).
      when 'SELECTED'.
        <l_fcat>-edit = 'X'.
        <l_fcat>-checkbox = 'X'.
        <l_fcat>-scrtext_l = 'Selected'(t29).
        <l_fcat>-scrtext_m = 'Selected'(t29).
        <l_fcat>-scrtext_s = 'Sel'.
        <l_fcat>-reptext = 'Selected'(t29).
        <l_fcat>-coltext = 'Selected'(t29).
    endcase.
  endloop.
  perform create_docking_container
                      using cl_gui_docking_container=>dock_at_right 235
                      changing w_con_objtypes .
  perform create_grid using w_con_objtypes
                      changing w_grid_objtypes.
  wal_layout-no_toolbar = 'X'.
  wal_layout-cwidth_opt = 'X'.
  perform display_data using wal_layout t_object_types
                             t_fcat_objtypes w_grid_objtypes.
  w_disp_flag = 'A'.
endform.                    " DISPLAY_OBJECT_TYPES
 
*---------------------------------------------------------------------*
*       FORM editor_call                                              *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form editor_call using p_mode.
  data : obj1_editor type ref to zcl_general,
          w_cancel(1) type c.
  data: wa_str(230) type c.
  data: fbuffer type ref to data.
  create data: fbuffer type type_buffer.
  field-symbols: <f_buffer> type type_buffer.
  assign: fbuffer->* to <f_buffer>.
 
  create object obj1_editor.
  if wl_bus_temp  = space.
  perform load_text.
  else.
  <f_buffer>-tdline = wl_bus_temp.
  append <f_buffer> to t_buffer.
  endif.
  call method obj1_editor->popup_text_editor
              exporting
                  i_mode           = p_mode
                  i_start_column   = 10
                  i_start_row      = 5
                  i_end_column     = 24
                  i_end_row        = 14
              importing
                  e_cancel       = w_cancel
              changing
                  ch_text    =  t_buffer.
  if sy-ucomm = 'OK'.
    t_buf1 = t_buffer.
    loop at t_buffer assigning <f_buffer>.
*    w_busreason = t_buffer-tdline.
     concatenate wa_str
                 <f_buffer>-tdline
                 into wa_str
                 separated by space.
      endloop.
*      w_busreason = WA_STR.
       wl_bus_temp = wa_str.
  endif.
 
endform.
 
*---------------------------------------------------------------------*
*       FORM EDITOR_CALL_1                                            *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form editor_call_1 using p_mode.
  data : obj1_editor type ref to zcl_general,
          w_cancel type char01.
  data: wa_str(230) type c.
  data: fbuffer type ref to data.
  create data: fbuffer type type_buffer.
  field-symbols: <f_buffer> type type_buffer.
  assign: fbuffer->* to <f_buffer>.
 
  create object obj1_editor.
  if wl_desc_temp  = space.
  perform load_text.
  else.
  <f_buffer>-tdline = wl_desc_temp.
  append <f_buffer> to t_buffer.
  endif.
 
clear wa_str.
  create object obj1_editor.
  perform load_text.
  call method obj1_editor->popup_text_editor
              exporting
                  i_mode           = p_mode
                  i_start_column   = 10
                  i_start_row      = 5
                  i_end_column     = 24
                  i_end_row        = 14
              importing
                  e_cancel       = w_cancel
              changing
                  ch_text    =  t_buffer.
  if sy-ucomm = 'OK'.
    t_buf2 = t_buffer.
        loop at t_buffer assigning <f_buffer>.
*    w_busreason = t_buffer-tdline.
     concatenate wa_str
                 <f_buffer>-tdline
                 into wa_str
                 separated by space.
      endloop.
*      w_busreason = WA_STR.
       wl_desc_temp = wa_str.
  endif.
 
*  ENDIF.
endform.
 
*---------------------------------------------------------------------*
*       FORM HELP_F01                                                 *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form help_f01.
 
  refresh list.
  field-symbols: <l_zctrlgroups> type zctrlgroups.
  new-page no-title no-heading.
  name = 'W_PROJTEAM'.
 
  loop at t_zctrlgroups assigning <l_zctrlgroups>.
    concatenate  <l_zctrlgroups>-zteam
                 <l_zctrlgroups>-zdesc
                 into w_buff
                 separated by ' - '.
    append w_buff to list.
  endloop.
  perform add_to_list using name list.
endform.
 
*---------------------------------------------------------------------*
*       FORM HELP_F01                                                 *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form help_f03.
  refresh list.
  field-symbols: <l_zctrprior> type zctrlprior.
  new-page no-title no-heading.
  name = 'W_PRIORITY'.
 
  loop at t_zctrprior assigning <l_zctrprior>.
    concatenate  <l_zctrprior>-zpriority
                 <l_zctrprior>-zprior_desc
                 into w_buff
                 separated by space.
    append w_buff to list.
  endloop.
 
  perform add_to_list using name list.
endform.
 
*---------------------------------------------------------------------*
*       FORM HELP_F04                                                 *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form help_f04.
  refresh list.
  field-symbols: <l_zctrlrelease> type zctrlrelease.
  new-page no-title no-heading.
*  SET PF-STATUS 'ZPICKLIST'.
  name = 'W_RELCODE'.
 
  loop at t_zctrlrelease assigning <l_zctrlrelease>.
    concatenate  <l_zctrlrelease>-relcode
                 <l_zctrlrelease>-reldesc
                 into w_buff
                 separated by ' - '.
    condense w_buff.
    append w_buff to list.
  endloop.
  perform add_to_list using name list.
endform.
 
*&---------------------------------------------------------------------*
*&      Form  FETCH_AFFCTED_PARTIES
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form add_to_list using p_name type vrm_id
                       p_list  type vrm_values.
  call function 'VRM_SET_VALUES'
       exporting
            id     = p_name
            values = p_list.
endform.
 
*---------------------------------------------------------------------*
*       FORM FETCH_AFFCTED_PARTIES                                    *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form fetch_affcted_parties.
  data: w_exit(1) type c,
       i_selfield type slis_selfield.
 
  field-symbols :" <L_FCAT> TYPE LVC_S_FCAT,
                  <l_affectedgroups_buff> type type_zctrlgroups_buff.
refresh itab9[].
  data: fitab1 type ref to data.
  create data : fitab1 type itab_type.
  field-symbols: <l_itabtype> type itab_type.
  assign: fitab1->* to <l_itabtype>.
 
  clear w_buff.
  select  zteam
          zname
          zdesc
          ernam
          erdat
          aenam
          aedat
         into corresponding fields of table  t_zctrlgroups_buff
         from zctrlgroups.
 
*move-corresponding t_affectedgroups to T_ZCTRLGROUPS_buff.
*append T_ZCTRLGROUPS_buff.
 
  call function 'REUSE_ALV_POPUP_TO_SELECT'
       exporting
            i_title              = 'Affected Stakeholders'(t28)
            i_selection          = 'X'
            i_zebra              = 'X'
            i_checkbox_fieldname = 'W_CHK'
            i_tabname            = 'T_ZCTRLGROUPS_buff'
            i_structure_name     = 'ZCTRLGROUPS'
*       IMPORTING
*            ES_SELFIELD          = I_SELFIELD
*            E_EXIT               = W_EXIT
       tables
            t_outtab             = t_zctrlgroups_buff.
  clear w_str.
  loop at t_zctrlgroups_buff assigning <l_affectedgroups_buff>
                    where w_chk = 'X'.
    condense w_str.
    if not w_str is initial.
      concatenate w_str
                  ','
                  into w_str.
    endif.
    <l_itabtype>-word = <l_affectedgroups_buff>-zteam.
    concatenate w_str
                <l_affectedgroups_buff>-zteam
                '-'
                '('
                <l_affectedgroups_buff>-zname
                ')'
                into w_str.
    condense w_str.
        append <l_itabtype> to itab9.
 
  endloop.
  w_affparties = w_str.
endform.
 
*---------------------------------------------------------------------*
*       FORM DISPLAY_DATE                                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form display_date changing   p_date like sy-datum.
  call function 'F4_DATE'
       exporting
            date_for_first_month     = p_date
            display                  = ' '
            factory_calendar_id      = ' '
            gregorian_calendar_flag  = ' '
            holiday_calendar_id      = ' '
            progname_for_first_month = ' '
       importing
            select_date              = p_date.
endform.
 
*&---------------------------------------------------------------------*
*&      Form  FETCH_TEAM
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form fetch_team.
  data: wal_zchnreqapr type zchnreqapr.
  select  single  team
           into corresponding fields of wal_zchnreqapr
           from zchnreqapr where
           chnrqst = w_transportno.
  if sy-subrc = 0.
    w_projteam = wal_zchnreqapr-team.
  endif.
 
endform.                    " FETCH_TEAM
 
*&---------------------------------------------------------------------*
*&      Form  FETCH_OTHER_FIELDS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form fetch_other_fields.
  data : wal_zchnreqhdr type zchnreqhdr,
         wl_objtype type char255,
         wl_count type i,
         wl_temp type i value 1.
  data: wl_tabix like sy-tabix.
 
  field-symbols : <l_objtype> type type_object_types.
  data :     w_objtype  type ref to data.
  create data:    w_objtype  type type_object_types.
  assign: w_objtype->* to <l_objtype>.
 
  data: pro_in_t type ref to process_output.
  create object: pro_in_t.
 
 
  select single
         priority
         requestor
         relcode
         condate
         impdate
         objtype
         busreason
         chngdesc
         affparties
         taskowner
         into corresponding fields of wal_zchnreqhdr
         from zchnreqhdr
         where chnrqst = w_transportno.
  if sy-subrc = 0.
    w_priority = wal_zchnreqhdr-priority.
    w_request  = wal_zchnreqhdr-requestor.
    w_relcode  = wal_zchnreqhdr-relcode.
    w_condate  = wal_zchnreqhdr-condate.
    w_impdate  = wal_zchnreqhdr-impdate.
    wl_objtype = wal_zchnreqhdr-objtype.
    w_busreason = wal_zchnreqhdr-busreason.
    w_changedesc = wal_zchnreqhdr-chngdesc.
    w_affparties =  wal_zchnreqhdr-affparties.
    w_taskowner = wal_zchnreqhdr-taskowner.
  endif.
 
  perform build_alv_header.
  wl_count = strlen( wl_objtype ).
 
  loop at t_object_types assigning <l_objtype>.
    wl_tabix = sy-tabix - 1.
    if wl_objtype+wl_tabix(1) = '1'.
      <l_objtype>-selected = 'X'.
    else.
      <l_objtype>-selected = ' '.
    endif.
    wl_temp = wl_temp + 1.
  endloop.
 
  perform display_obj_types.
 
endform.                    " FETCH_OTHER_FIELDS
 
 
*&---------------------------------------------------------------------*
*&      Form  DISPLAY_OBJECTS_TO_GRID
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form display_objects_to_grid.
 
  select objtype
         objname
         into corresponding fields of table t_object_list
         from zchnobjdet
         where  chnrqst = w_transportno.
  perform display_object_only.
endform.                    " DISPLAY_OBJECTS_TO_GRID
 
*---------------------------------------------------------------------*
*       FORM DISPLAY_OBJ_TYPES                                        *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form display_obj_types.
  data : "WAL_OBJECT_TYPES TYPE TYPE_OBJECT_TYPES,
         wal_layout type lvc_s_layo.
  perform create_docking_container
                      using cl_gui_docking_container=>dock_at_right 235
                      changing w_con_objtypes .
  perform create_grid using w_con_objtypes
                      changing w_grid_objtypes.
  wal_layout-no_toolbar = 'X'.
  wal_layout-cwidth_opt = 'X'.
  perform display_grid using wal_layout t_object_types
                             t_fcat_objtypes w_grid_objtypes.
 
endform.                    " DISPLAY_OBJECT_TYPES
 
*---------------------------------------------------------------------*
*       FORM BUILD_ALV_HEADER                                         *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form build_alv_header.
  data : wal_object_types type type_object_types.
  data: obj_transport type ref to zcl_transport.
  field-symbols : <l_fcat> type lvc_s_fcat.
 
    create object obj_transport.
    call method obj_transport->list_object_types
      importing
        t_object_types = t_object_types
        .
 
  check w_con_objtypes is initial.
  perform create_fieldcatalog using 'ZCTRLOBJTYP'
                              changing t_fcat_objtypes.
  delete t_fcat_objtypes where fieldname = 'OBJECT'.
  loop at t_fcat_objtypes assigning <l_fcat>.
    case <l_fcat>-fieldname.
      when 'TEXT'.
        <l_fcat>-scrtext_l = 'Object Name'(t61).
        <l_fcat>-scrtext_m = 'Object Name'(t61).
        <l_fcat>-scrtext_s = 'Obj Name'(t60).
        <l_fcat>-reptext = 'Object Name'(t61).
        <l_fcat>-coltext = 'Object Name'(t61).
 
      when 'SELECTED'.
        <l_fcat>-edit = 'X'.
        <l_fcat>-checkbox = 'X'.
        <l_fcat>-scrtext_l = 'Selected'(t59).
        <l_fcat>-scrtext_m = 'Selected'(t59).
        <l_fcat>-scrtext_s = 'Sel'.
        <l_fcat>-reptext = 'Selected'(t59).
        <l_fcat>-coltext = 'Selected'(t59).
    endcase.
  endloop.
endform.
 
*---------------------------------------------------------------------*
*       FORM DISPLAY_GRID                                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
form display_grid using    pwa_layout type lvc_s_layo
                           pt_object_types  type standard table
                           pt_fcat_objtypes type lvc_t_fcat
                           pw_grid_objtypes type ref to cl_gui_alv_grid.
 
  field-symbols : <l_fcat_obj> type lvc_s_fcat.
 
  loop at pt_fcat_objtypes assigning <l_fcat_obj>.
    if <l_fcat_obj>-fieldname = 'OBJTYPE'.
      <l_fcat_obj>-outputlen = 30.
    endif.
  endloop.
 
  call method pw_grid_objtypes->set_table_for_first_display
     exporting
       is_layout                     = pwa_layout
    changing
       it_outtab                     = pt_object_types
       it_fieldcatalog               = pt_fcat_objtypes
    exceptions
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 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.
 
endform.                    " DISPLAY_DATA
 
*&---------------------------------------------------------------------*
*&      Form  PROPER_ROUTING
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form proper_routing.
  data: wl_zchnrqst type zchnrqst.
 
  call function 'CONVERSION_EXIT_ALPHA_INPUT'
       exporting
            input  = w_transportno
       importing
            output = w_transportno.
 
  select single chnrqst into wl_zchnrqst
  from zchnreqhdr
  where chnrqst = w_transportno.
  if sy-subrc = 0.
    wl_control = 'ZR3'.
    export wl_control from wl_control to memory id 'test9'.
    export w_transportno from w_transportno to memory id 'TEST10'.
    submit zsapcap_transport.
  else.
    message i011(zcap1) with 'Request Number Does Not Exist'(t27).
    w_transportno = ''.
    exit.
  endif.
endform.                    " PROPER_ROUTING
 
*&---------------------------------------------------------------------*
*&      Form  CHANGE_PROPER_ROUTING
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form change_proper_routing.
  data: wl_zchnrqst type zchnrqst.
 
  call function 'CONVERSION_EXIT_ALPHA_INPUT'
       exporting
            input  = w_transportno
       importing
            output = w_transportno.
 
  select single chnrqst into wl_zchnrqst
  from zchnreqhdr
  where chnrqst = w_transportno.
  if sy-subrc = 0.
  select single chnrqst into wl_zchnrqst
  from zchnreqhdr
  where chnrqst = w_transportno and
        status <> space.
   if sy-subrc = 0.
   message i011(zcap1) with
    'Request Can not be Changed Since Approval is done'.
    wl_control = 'ZR4'.
    export wl_control from wl_control to memory id 'test9'.
    export w_transportno from w_transportno to memory id 'TEST10'.
    submit zsapcap_transport.
 
 
   else.
 
    wl_control = 'ZR2'.
    export wl_control from wl_control to memory id 'test9'.
    export w_transportno from w_transportno to memory id 'TEST10'.
    submit zsapcap_transport.
   endif.
  else.
    message i011(zcap1) with 'Request Number Does Not Exist'(t58).
    w_transportno = ''.
    exit.
  endif.
endform.                    " PROPER_ROUTING
*&---------------------------------------------------------------------*
*&      Form  build_object_type_table
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
*form build_object_type_table.
*
*data: wal_object_types type type_object_types.
*
*    wal_object_types-object = 'CONF'.
*    wal_object_types-text = 'Configuration'(t46).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'SAPR'.
*    wal_object_types-text = 'SAP Repair'(t45).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'SECO'.
*    wal_object_types-text = 'Security Objects'(t44).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'REPW'.
*    wal_object_types-text = 'Report Writer'(t43).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'PROG'.
*    wal_object_types-text = 'Programs'(t42).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'FUNC'.
*    wal_object_types-text = 'Function Modules'(s41).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'TRAN'.
*    wal_object_types-text = 'Transaction'(m41).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'CLAS'.
*    wal_object_types-text = 'Class'(t40).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'METH'.
*    wal_object_types-text = 'Method'(t31).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'USRE'.
*    wal_object_types-text = 'User Exit'(t39).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'VARI'.
*    wal_object_types-text = 'Variants'(t38).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'SSFO'.
*    wal_object_types-text = 'SMART Forms'(t37).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'FORM'.
*    wal_object_types-text = 'SAP Script'(t36).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'ALEI'.
*    wal_object_types-text = 'ALE/IDOC'.
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'STRU'.
*    wal_object_types-text = 'Structure'(t35).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'DELE'.
*    wal_object_types-text = 'Data Element'(t34).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'DOMA'.
*    wal_object_types-text = 'Domain'(t33).
*    append wal_object_types to t_object_types.
*
*    wal_object_types-object = 'DYNP'.
*    wal_object_types-text = 'Screens'(t32).
*    append wal_object_types to t_object_types.
*
*
*
*endform.                    " build_object_type_table

Reward all helpfull answers

Regards

Pavan

former_member588853
Active Contributor
0 Kudos

Hi,

see below the best example of using field symbols

suppose we have an internal table ITAB.

ITAB is of type ty_itab whcih has the below fields

MATNR WERKS LGORT QUANTITY.

1000 nl09 10001 20000

1001 nl09 10002 0

1001 nl09 1003 13000

Now you need to update the quantity for material 1001.

so define a field-symbol/

field-symbols <fs> type ty_itab.

Loop at itab assigning <fs> where matnr = '1001'.

<fs>-quantity = 30000.

endloop.

Your internal table will be

MATNR WERKS LGORT QUANTITY.

1000 nl09 10001 20000

1001 nl09 10002 30000

1001 nl09 1003 13000

*We have an advantage , there is no need to use Modify statement here.

Ie changing the value in workarea and modifying it is not necessary.

Field-symbols are like pointers they directly pick up the value and change it in internal table.

rewards if understood

regards,

nazeer