Skip to Content
author's profile photo Former Member
Former Member

how to assign field- symbol to few fieds of internal table

hi

iam using an itab having many fields out which i have to use some fields incase stmt to assingn the data to those fields ..but those field can be upto 100 or thousand.i want to use field-symbol ...how can i .

here is the saple code.

my itab.

has bal1 ......bal1000.

iam using in case

CASE count1.

WHEN 1.

i_vat-baval1 = i_tcode-kwert

WHEN 2.

vat-baval2 = i_tcode-kwert

..... i canot write to long code.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 09, 2005 at 11:44 AM

    Hi,

    You can use some thing like the following..

    DATA: lv_fieldname(30) VALUE 'BAVAL'.

    FIELD-SYMBOLS: <fs_value> TYPE ANY.

    lv_fieldname+5 = count1. "Your variable.

    ASSIGN COMPONENT lv_fieldname OF STRUCTURE i_vat

    TO <fs_value>.

    IF sy-subrc EQ 0.

    <fs_value> = i_tcode-kwert.

    ENDIF.

    Hope this helps..

    <b>Sorry, I had given Field name wrong.. Now it is corrected</b>

    Sri

    Message was edited by: Srikanth Pinnamaneni

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 09, 2005 at 11:50 AM

    hi,

    use this code...

    data : it_dyn_table type ref to data ,

    it_fieldcatalog type lvc_t_fcat.

    field-symbols : <it_dyn> type standard table.

    • set data into it_fieldcatalog

    ...

    • Create a dynamic internal table.

    call method cl_alv_table_create=>create_dynamic_table

    exporting it_fieldcatalog = it_fieldcatalog

    importing ep_table = it_dyn_table.

    assign it_dyn_table->* to <it_dyn>.

    regs,

    sakthi

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      try something like this>>>>

      FIELD-SYMBOLS <lga_var_name> TYPE ANY.

      FIELD-SYMBOLS <bet_var_name> TYPE ANY.

      FIELD-SYMBOLS <lga_val> TYPE ANY.

      FIELD-SYMBOLS <bet_val> TYPE ANY.

      CALL FUNCTION 'HR_READ_INFOTYPE'

      EXPORTING

      pernr = '1687'

      infty = '0008'

      begda = '20041014'

      endda = '99991231'

      TABLES

      infty_tab = i0008

      ***********************check to be performed*******

      LOOP AT i0008.

      var_n_cnt = 1.

      WHILE var_n_cnt <= 20.

      IF var_n_cnt < 10.

      var_c_cnt = var_n_cnt.

      CONCATENATE '0' var_c_cnt INTO var_c_cnt.

      ELSE.

      var_c_cnt = var_n_cnt.

      ENDIF.

      CONCATENATE 'I0008-LGA' var_c_cnt INTO var_lga_name.

      ASSIGN var_lga_name TO <lga_var_name>.

      ASSIGN (<lga_var_name>) TO <lga_val>.

      CONCATENATE 'I0008-BET' var_c_cnt INTO var_bet_name.

      ASSIGN var_bet_name TO <bet_var_name>.

      ASSIGN (<bet_var_name>) TO <bet_val>.

      IF <lga_val> = '1000'.

      sum = sum + <bet_val>.

      endif.

      var_n_cnt = var_n_cnt + 1.

      endwhile.

      ENDLOOP.

      write:/ sum.

      reward points if it satisfies!!

      Regards

      Gunjan

  • Posted on Dec 09, 2005 at 11:42 AM

    hi,

    use command:

    assign component

    sample:

    DO.

    ASSIGN COMPONENT sy-index OF STRUCTURE itab TO <f>.

    IF sy-subrc = 0.

    WRITE <f>.

    ELSE.

    EXIT.

    ENDIF.

    ENDDO.

    Andreas

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 09, 2005 at 11:44 AM

    .

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 09, 2005 at 11:46 AM

    hi,

    or look :

    dynamic-move-statement

    Andreas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 09, 2005 at 11:49 AM

    hi

    <TABLE2>: internal table EXTRACT header line.

    <VIM_EXTRACT_KEY>: unique key of the current entry in the internal table EXTRACT. It is either:

    view key fields, or

    the entity table key of a table or table with text table.

    The following field symbols are only filled if the maintenance dialog is based on a table with a text table, and the tables are linked by the foreign key relationship TEXT.

    <EXTRACT_ENTI>: work area of internal table EXTRACT for the entity table fields, without the text table fields.

    <EXTRACT_TEXT>: work area of internal table EXTRACT for the fields of the text table read.

    regards

    Arun

    Message was edited by: arun a v

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.