Assigning value to Field - Symbol ( which is type of internal table field )

Hi All,
  I am facing problem to assign the value to a field symbol. My requirement is creating a dynamic internal table and populate values into that internal table, so that i can display the values .
  I am having a structure with fields like status , Plant1 name , Plant2 name.....Plant n .
  So i declared an internal table it_tab with this structure.
  I am having one more table which having number of records for Plant1 ,Plant 2 ,....Plant n based on some condition.
  I need to count the number of records for Plant1 and i need to put in the internal table it_tab.
  For this i created field-symbol .
Here, t_deployment table will have the plants 1,2,3...and
     t_devobject will have some records for these plants.
LOOP AT T_DEPLOYMENT. 
clear w_count.
LOOP AT T_DEVOBJECT WHERE ZDEPLOYMENT = T_DEPLOYMENT-DOMVALUE_L AND
                          ZADSTATUS = '10'.
w_count = w_count + 1.
ENDLOOP.
concatenate 'it_tab-' t_deployment-domvalue_l into var_bet_name.
assign var_bet_name to <bet_var_name>.
now my internal table field i.e. it_tab-plant1 came into <bet_var_name> . But i want to assign a value for it.
at last what i need is it_tab-plant1 = w_count.
whaterver the w_count has value that needs to assign to it_tab-plant1. But i don't want to assign directly it it_tab-plant1. I want to assign dynamically. Because tommorrow some more plants added to t_deployments , i don't want to make changes to my program. It should take care....w/o changing the program.
I tried the following statement.
(<bet_var_name>) = w_count. But its not working.
Please let me know how i can get this.
Thanks in Advance.
Pavan.

Hi pavan,
As ur requirement is creating a dynamic internal table,
try the following way,
remember the fieldcat should be of type LVC not SLIS.
BUILD LT_LVCFIELDCAT in a way that, the value from the internal table becomes the fieldname
ex:-
loop at it_models INTO WA_MODELS.
    LS_LVCFIELDCAT-FIELDNAME = WA_models-MODEL.
    LS_LVCFIELDCAT-SELTEXT = WA_models-MODEL.
append ls_lvcfieldcat to lt_lvcfieldcat.
endloop.
DATA: DREF TYPE REF TO DATA,WA_REF TYPE REF TO DATA.
FIELD-SYMBOLS: <TEMP_TAB> TYPE TABLE, <TEMP_WA> TYPE ANY.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
    EXPORTING
      IT_FIELDCATALOG = LT_LVCFIELDCAT
    IMPORTING
      EP_TABLE        = DREF.
  ASSIGN dref->*  TO <TEMP_TAB>.
now basing on the fieldcatalog <temp_tab> is build.
NOW FILL <TEMP_TAB>.
WHILE FILLING, ASSIGN COMPONENT IDX/NAME.....
this statement will be very usefull.
i hope this will be help full.
pls reward the points if it helps u.
regards
Hyma

Similar Messages

  • Difference between Field symbols and work area for Internal tables

    Hi,
    In ECC versions we all know that we need to declare the internal tables without headerline, and for handling the internal tables we need to use exclusive work areas.
    Currently i have an issue that we have been asked to use field symbols instead of work areas...can any one help me how to use the field symbols and also let me know how it will improve the performance of the program..
    Thanks and Regards,
    Kathir

    Hi
    DATA: WA TYPE ITAB.
    LOOP AT ITAB INTO WA.
    IF WA-FIELD = .....
    ENDIF.
    ENDLOOP.[(code]
    FIELD-SYMBOLS <WA> TYPE ANY.
    LOOP AT ITAB ASSIGNING <WA>.
    ENDLOOP.
    Now the problem is you can't know the name of the fields of the table at runtime, so you can't write:
    IF <WA>-FIELD = .....
    ENDIF.
    Anyway you can create a field-symbols strcturated like the table:
    [code]FIELD-SYMBOLS <WA> TYPE ITAB.
    LOOP AT ITAB ASSIGNING <WA>.
      IF <WA>-FIELD = .....
      ENDIF.
    ENDLOOP.
    I don't know which are the differences for the performance between to use a field-symbol and to use a structure as work-area.
    The differnce between the field-symbols and work-area is the field-symbol is assigned directly to the record, so u don't need to do a MODIFY statament to change something:
    LOOP AT ITAB INTO WA.
      WA-FIELD =
      MODIFY ITAB FROM WA.
    ENDLOOP.
    LOOP AT ITAB ASSIGNING <WA>.
      <WA>-FIELD =
    ENDLOOP.
    These two pieces of abap code do the same action, so probably the field-symbol improve the performance because it do an access directly to the record without to use an external structure as workarea.
    Max

  • Field symbol for order type

    Hi all.
    i have a condition on which i need to use the field symbol in which depending on the condition,my subscreen should be displayed.
    i have SAPLMEGUI as a main standard program and MEPO_TOPLINE-BSART is a field which is attached to this std program.
    Also,if this BSARt becomes UB(order type in purchase orders) then only it should go to subscreen.i tried doing it like below,but not getting solution.
    please help.
    data: GV_OKCODE_FIELD type char35 VALUE '(SAPLMEGUI)MEPO_TOPLINE-BSART'
    FIELD-SYMBOLS <MEPO_TOPLINE-BSART> TYPE ANY.
    ASSIGN GV_OKCODE_FIELD TO <MEPO_TOPLINE-BSART>.
    IF <MEPO_TOPLINE-BSART> = 'UB'.
    endif.

    Hello,
    You can try something like this:
    FIELD-SYMBOLS: <FS> TYPE BSART.
    ASSIGN COMPONENT BSART OF STRUCTURE MEPO_TOPLINE TO <FS>.
    IF <FS> = 'UB'.
    " Your Code
    ENDIF.
    BR,
    Suhas

  • Coloring of Particular Cells in a dynamic internal table(field symbols)

    Hi,
         I have a requirement to introduce color into some particular cells in a dynamic internal table(Field symbol) based on some conditions.I know that color can be introduced at cell level in the case of static internal table.But, can anybody tell me whether it is possible to introduce color to particular cells in the dynamic internal table(Field Symbol) .Please suggest me on this issue.
    Thanks in advance,
    Rajesh

    Hi,
    This is the sample coding for the colour cell report.
    Kindly go through it. It will helps u.
    REPORT YMS_COLOURTEST .
    DATA: BEGIN OF TP OCCURS 10, ID, NR(8), TEXT(255), END OF TP.
    DATA: LENGTH TYPE I VALUE 8, " Length of list
    TESTSTRING(15) TYPE C VALUE '012345678901234',
    WIDTH TYPE I. " Width of list
    DATA: TXT_REPORT LIKE DOKHL-OBJECT.
    START-OF-SELECTION.
    PERFORM HEADING.
    PERFORM OUTPUT_BODY.
    FORM HEADING.
    FORMAT INTENSIFIED OFF. " Remove any INTENSIFIED
    ULINE AT (WIDTH). " Upper frame border
    FORMAT COLOR COL_HEADING INTENSIFIED." Title color
    WRITE: / SY-VLINE. " Left border
    WRITE: 'No |Colour |intensified |intensified off|',
    'inverse' NO-GAP.
    WRITE: AT WIDTH SY-VLINE. " Right border
    ULINE AT (WIDTH). " Line below titles
    FORMAT COLOR OFF.
    ENDFORM.
    FORM OUTPUT_BODY.
    DO LENGTH TIMES.
    PERFORM WRITE_LINE USING SY-INDEX.
    ENDDO.
    ENDFORM.
    FORM WRITE_LINE USING COUNT TYPE I.
    DATA: HELP(14) TYPE C,
    COUNT1 TYPE I.
    COUNT1 = SY-INDEX - 1.
    WRITE: / SY-VLINE NO-GAP.
    WRITE: (4) COUNT1 COLOR COL_KEY INTENSIFIED NO-GAP.
    WRITE: SY-VLINE NO-GAP.
    CASE COUNT1.
    WHEN '0'.
    HELP = 'COL_BACKGROUND'.
    WHEN '1'.
    HELP = 'COL_HEADING'.
    WHEN '2'.
    HELP = 'COL_NORMAL'.
    WHEN '3'.
    HELP = 'COL_TOTAL'.
    WHEN '4'.
    HELP = 'COL_KEY'.
    WHEN '5'.
    HELP = 'COL_POSITIVE'.
    WHEN '6'.
    HELP = 'COL_NEGATIVE'.
    WHEN '7'.
    HELP = 'COL_GROUP'.
    ENDCASE.
    WRITE: HELP COLOR COL_KEY INTENSIFIED NO-GAP.
    WRITE: SY-VLINE NO-GAP.
    WRITE: TESTSTRING COLOR = COUNT1 INTENSIFIED NO-GAP.
    WRITE: SY-VLINE NO-GAP.
    WRITE: TESTSTRING COLOR = COUNT1 INTENSIFIED OFF NO-GAP.
    WRITE: SY-VLINE NO-GAP.
    WRITE: TESTSTRING COLOR = COUNT1 INVERSE NO-GAP.
    WRITE AT WIDTH SY-VLINE NO-GAP.
    ENDFORM.
    Thanks,
    Shankar

  • Modify the Field Type of standard Table fields in a Query

    Hello. I have a question.
    Is there a way to "modify" the field type for standard table fields that are included in a Query?
    I made a simple query out of a join of tables, but several fields have a lot of decimals, and I would like to present them in the query without any decimals, just as a regular "N" field.
    I tried the possibility of creating extra local fields where all I do is transfer the value to the new "N" field, but I have many fields like this, so if there's a better way; I'd prefer that.
    Maybe somewhere in the InfoSet there's a way to modify the type of the standard table fields?
    Thank you.

    Hi,
    This document may help you out.
    [http://help.sap.com/saphelp_erp60_sp/helpdata/en/d2/cb4468455611d189710000e8322d00/frameset.htm|http://help.sap.com/saphelp_erp60_sp/helpdata/en/d2/cb4468455611d189710000e8322d00/frameset.htm]
    Cheers,

  • How to populate dynamic internal table fields with data??

    Hi Folks,
    How to assign a particular internal table field to a dynamically assigned internal table?
    I have an excel sheet, and i upload the excel sheet data into an internal IT_EXLOAD table using FM ALSM_EXCEL_TO_INTERNAL_TABLE
    Now i created a dynamic internal table which has the same column as in my DB table.
    I have to fill the dynamically created Internal table with the IT_EXLOAD data dynamically.
    Suppose in future if i add some field in DB table and for that field if i add some column in excel sheet there is no need to change in the program.
    Looking for reply...
    Best Regards,
    Sayak

    hi,
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                filename                = p_path
                i_begin_col             = '1'
                i_begin_row             = '2'
                i_end_col               = '2'
                i_end_row               = '1000'
           TABLES
                intern                  = intern
           EXCEPTIONS
                inconsistent_parameters = 1
                upload_ole              = 2
                OTHERS                  = 3.
    *declare intern_tmp as internal table tb_data in wich you want the data
    *and declare a field symbol <fs_123>
    LOOP AT intern.
        ASSIGN COMPONENT intern-col OF STRUCTURE
        intern_tmp TO <fs_123>.
        IF NOT <fs_123> IS ASSIGNED.
          CLEAR intern.
          CLEAR intern_tmp.
          CONTINUE.
        ENDIF.
        <fs_123> = intern-value.
        AT END OF row.
          CLEAR tb_data.
          MOVE-CORRESPONDING: intern_tmp TO tb_data.
          APPEND tb_data.
          CLEAR intern_tmp.
        ENDAT.
        CLEAR intern.
      ENDLOOP.
    **paste this code and you can see the data in ur tables dynamically.
    Thanks
    Nitin Sachdeva

  • Value not moved to work are of the internal table

    HI
    I have one internal table declared with occurs 2500.
    i am selecting the values from a z table into this internal table.
    now i want to move the values in the table to another internal table for download.here except one field all the other fields are moving to the new internal table.When i debugged i could see the value in the internal table but its not getting moved to work area of that internal table (or the header line).
    I could not see the value when i use itab[]-field in debugger mode instead when i use itab[1]-field i could see that field value.
    please do suggest.

    There is no need to move your data from one internal table to another with fixed structure. All you need to do is take each row's components skipping the column you don't want to download and concatenate this to some string. Then append to string table and download it. Sample:
    "let's say your column is on 3rd place in the table
    data l_row_string type string.
    data lt_string_tab type table of string.
    Loop at itab assigning <wa>.
      do.
        check sy-index ne 3. "skip this column
        assign component sy-index of structure <wa> to <comp>.
        if sy-subrc = 0.
          CONCATENATE l_row_string <comp> INTO l_row_string SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
        else.
          "no more component in row
          append l_row_string to lt_string_tab.
          clear l_row_string.
          exit.     
        endif.
    enddo.
    endloop.
    Now all you need is to downlaod your lt_string_tab as your text file (extension TXT).
    Regards
    Marcin

  • An internal table field has been defined too small

    Hi,
    We are getting a dump when trying to get the Financial Statements.
    The error in the dump is u201CAn internal table field has been defined too smallu201D.
    The field with the problem is u201CYou should define the field "HSL03" larger in program "SAPLFAGL_GLT0".The maximum size allowed for fields of type P is 16 (31 digits).
    Itu2019s caused by a list of documents where the exchange rate must to be u201D/699,94001u201D  but it was entered without the forward slash and it caused very big numbers
    The biggest number in one document is 99,401,074,527.31  USD
    The sum of all them is 13,008,701,915,208.50
    Any ideas to fix this?
    Thanks in advance
    Jorge

    have you reversed those documents with fb08  and post it with the correct exchange rate???
    have you searched in SMP for similar problems - I think you've to correct the DB-values- but only in agreement with your audit firm / revision
    A.
    Edited by: Andreas Mann on Apr 6, 2010 3:13 PM
    Edited by: Andreas Mann on Apr 6, 2010 3:16 PM

  • Regarding passing blank characters to internal table field

    Hi All,
    I have small issue.
    Actual issue is
    I am having one internal table field as <b>oper_table-arbid</b> in the program i will actually pass first 4 characters of that field into another internal table <b>i_download_operation-arbid.</b>
    Then if <b>oper_table-arbid</b> is blank i need to pass
    4 blank characters into <b>i_download_operation-arbid.</b>
    Can anybody tell me how can i do it.
    Code is like this
    IF oper_table-arbid NE space.
    MOVE oper_table-arbid+0(4) TO i_download_operation-arbid.
    ELSE.
    I need to pass 4 blank char's to i_download_operation-arbid
    ENDIF.
    oper_table-arbid is of 8 char length & i_download_operation-arbid is of 4 char length.
    Can any body tell me what i need to do here.
    Thanks in advance.
    Thanks & Regards,
    Rayeez.

    hi ,
    shaik.
    data: var(8) type c value 'abcdefgh'.
          write var.
    data: bar(8) type c value 'ijkl',
          p1(8)  .
          move bar to p1.
          write:/ p1 right-justified.
    just execute the program and see the o/p.
    if u r trying to pass character then default position is left-justfied .
    so u need to explicitly say right-justified so it will take positions 5,6,7,8.
    so here u need append blank spaces .
    after seeing the o/p u will hav a clear picture .
    vijay.

  • How to specify for a internal table field so that number of digits = 9

    In if condition how can i specify that
    if country = 'US'
    then the account number should be equal to 9 digits only.
    <removed_by_moderator>
    Edited by: Julius Bussche on Aug 6, 2008 1:41 PM

    You can set the internal table field to the biggest length possible, according to your requirements, and then work on something like the following. If the condition is met and you have to shorten the account number... try something similar to this:
    DATA e TYPE string VALUE 'Test string'.
    * I'm using 2 as an example here.
    SHIFT e BY 2 PLACES RIGHT CIRCULAR.
    SHIFT e BY 2 PLACES LEFT.
    WRITE :/, e.
    Avraham

  • How to check  if all values from a dataset  has come to  an internal table

    How to check  if all values from a dataset  has come to  an internal table ?

    Hi,
    After OPEN DATASET statement check if sy-subrc = 0 if its success then proceed with split statement and save the dataset values into a internal table and while debugging the internal table you will find that whether all values get into internal table.
    Checking sy-subrc after OPEN DATASET statement is must to fill up the values in the internal table.
    For e.g.
    OPEN DATASET p_inpfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc NE 0.
        WRITE :/ 'No such input file' .
        EXIT.
      ELSE.
    READ DATASET p_inpfile INTO loc_string.
          IF sy-subrc NE 0.
            EXIT.
          ELSE.
            CLEAR loc2.
    *Spliting fields in the file-
            REPLACE ALL OCCURRENCES OF '#' IN wa_string WITH ' '.
           SPLIT wa_string AT const INTO loc2-pernr
                                           loc2-werks
                                           loc2-persk 
                                           loc2-vdsk1.
    Hope you get some idea.
    Thanks,
    Sakthi C

  • Regarding Internal Table Field Validation [Modification]

    Hi All,
    I have a small issue with formatting of a field.
    The Field is POTX1 - it would get the value as 'New MT-EPPE0097-COMP02',
    Means i have one internal table field as i_error-POTX1 in that some times we get value as 'New MT-EPPE0097-COMP02'.
    Whenever i get 'New' literal in that internal table field i have to remove that literal from that internal table field. And Left Justify the remaining part of the field.
    Ex:  'New MT-EPPE0097-COMP02'
         should become 'MT-EPPE0097-COMP02'.
    For this first i have to find wether 'New' Literal exists in the Internal table field or not then i have to remove it.
    Can anybody tell me how can i solve this issue.
    Thanks in advance.
    Thanks & Regards,
    Rayeezuddin.

    Hi,
    Take a look :
    loop at i_error.
      if i_error-potx1(3) = 'New'
        w_potx1 = i_error-potx1.
        i_error-potx1 = w_potx1+3(37).
        MODIFY i_error.
      endif.
    ENDLOOP.
    Regards,
    Erwan.
    Message was edited by: Erwan LE BRUN

  • Types of internal tables with regard to EFFICIENCY

    Will any one tell me syntax to define each type of internal table  (standard, sorted , hashed , database) . how to compare their efficincy ( access time which is more effficent) is there any documantation or programme of such type exist then please tell  . i want to declare each type of above table and also to compare them w.r.t to efficeny thanks  want urgent reply

    Hi,
    There are 3 types of Internal tables.
    Standard Internal Tables:
    Standard tables have a linear index. You can access them using either the index or the key. If you use the key, the response time is in linear relationship to the number of table entries. The key of a standard table is always non-unique, and you may not include any specification for the uniqueness in the table definition.
    This table type is particularly appropriate if you want to address individual table entries using the index. This is the quickest way to access table entries. To fill a standard table, append lines using the (APPEND) statement. You should read, modify and delete lines by referring to the index (INDEX option with the relevant ABAP command). The response time for accessing a standard table is in linear relation to the number of table entries. If you need to use key access, standard tables are appropriate if you can fill and process the table in separate steps. For example, you can fill a standard table by appending records and then sort it. If you then use key access with the binary search option (BINARY), the response time is in logarithmic relation to the number of table entries.
    Sorted Internal Tables:
    Sorted tables are always saved correctly sorted by key. They also have a linear key, and, like standard tables, you can access them using either the table index or the key. When you use the key, the response time is in logarithmic relationship to the number of table entries, since the system uses a binary search. The key of a sorted table can be either unique, or non-unique, and you must specify either UNIQUE or NON-UNIQUE in the table definition. Standard tables and sorted tables both belong to the generic group index tables.
    This table type is particularly suitable if you want the table to be sorted while you are still adding entries to it. You fill the table using the (INSERT) statement, according to the sort sequence defined in the table key. Table entries that do not fit are recognised before they are inserted. The response time for access using the key is in logarithmic relation to the number of table entries, since the system automatically uses a binary search. Sorted tables are appropriate for partially sequential processing in a LOOP, as long as the WHERE condition contains the beginning of the table key.
    Hashed Internal Tables:
    Hashes tables have no internal linear index. You can only access hashed tables by specifying the key. The response time is constant, regardless of the number of table entries, since the search uses a hash algorithm. The key of a hashed table must be unique, and you must specify UNIQUE in the table definition.
    This table type is particularly suitable if you want mainly to use key access for table entries. You cannot access hashed tables using the index. When you use key access, the response time remains constant, regardless of the number of table entries. As with database tables, the key of a hashed table is always unique. Hashed tables are therefore a useful way of constructing and
    using internal tables that are similar to database tables.
    http://help.sap.com/saphelp_470/helpdata/EN/fc/eb35de358411d1829f0000e829fbfe/frameset.htm
    Regards,
    Kiran Sure

  • Difference between line type and internal table?

    Hi..
    I wanted to know, what is the difference between Line type and Internal Table?

    Hi,
        Before the 4.7 release in SAP if we want to define an internal table we have to write the defination using the occurs statement and we need to define all the fields using INCLUDE STRUCTURE or indidually all the fields ine by one.
    From 4.7 release of R/3 SAP introduced the Line type concept and it's part of the ABAP OOPS concept. for internal table defination we don't need to use the occur statements. Instead INCLUDE structure  we need to create a Line type for that structure in Se11 and then we can define the internal table like :
    DATA : ITAB TYPE TABLE OF <LINE_TYPE>.
    Only thing is this table will be  a table without header. So for internal table processing we need to define a work area structure of type line of line type  . EX:
    DATA: WA_ITAB TYPE LINE OF <LINE_TYPE>.
    Hope this helps.
    Thanks,
    Greetson

  • Accessing Dynamic Internal table fields

    Hello All,
    I have one internal table ep_tabx having 138 columns whose data is getting displayed
    by using function module reuse_alv_grid_display.
    Now my query is, i have created one custom button on the appl toolbar to download ep_tabx data.
    IF the user changes the the layout of the output at runtime and then presses that custom button
    then i have created one dynamic internal table using call method cl_alv_table_create=>create_dynamic_table suppose <dyn_table> whose struc will be that of
    dynamic fieldcatalog returned by using FM REUSE_ALV_GRID_LAYOUT_INFO_GET.
    And then I have put a loop on the int table ep_tabx and move corresponding to the int table
    <dyn_table>. But when i download the <dyn_table> data through GUI_DOWNLOAD the
    date fields data is not getting downloaded correctly. I have 4 date fields in my ep_tabx.
    In the alv grid output the date is getting displayed like 08/30/2004(ie mon/date/yr) but in download
    file it comes like 20040830(ie yr/mon/date and that too without /).How to access the dynamic
    internal tables fields separately so asto convert them in the pgm before the download.
    Kindly Help.
    Thanks in advance.
    Mansi

    Hi,
    Search in SDN you would get loads of info on accessing dynamic itab's .
    in order to convert your date format use WRITE stmt to convert the value in your itab before passing it to download FM.
    Regards,
    Raghavendra

Maybe you are looking for

  • How to enable syntax highlighting for jspf files on Dreamweaver CS5.5 on Mac

    I ran into an issue where I couldn't get the color coding (color coding style) for java server pages fragments (.jspf) files to show syntax highliting. I followed the adobe instructions on Changing and adding file extensions recognized by Dreamweaver

  • Ituneshelper was not installed correctly, please reinstall itunes Error 7

    Have uninstalled and reinstalled itunes and related  programs (ad infinitum) per advice offered in this forum. So far a complete waste of time. Running Windows 7, 64 bit,  Home Premium. Have repaired windows installation as well, to no effect. Consid

  • Can/May I append some classes to rt.jar

    I want to append one package to rt.jar provided by sun. I am able to do it with jdk1.4 and jdk1.5. But I cant do it in case of jdk1.6 or its updates. How can i do it? Is it legal to do it? Many Thanks,

  • New Features in 11.2.2.2

    Is there a list of New Featuers / Bug Fixes between 11.2.0 and 11.2.2, Went through the documentation (Release Notes) and mainly it talks about difference between 10.8 and 11.2.

  • Product category comes blank IN BID INVITATION process of SRM

    Hi Gurus,    We are using the SRM Ssystem to process BID invitation.In this it uses the R3MMEXTRACT to get the product catalog information.The Information is fetched from R/3 using the RFC BBP_CATEGORY_GET_GUID. The data which is fetched from R/3 is