How to add new field into dynamic internal table

Hello Expert.
how to add new field into dynamic internal table.
PARAMETERS: P_TABLE(30).    "table name
DATA: I_TAB TYPE REF TO DATA.
FIELD-SYMBOLS: <TAB> TYPE standard TABLE.
*Create dynamic FS
create DATA I_TAB TYPE TABLE OF (p_table).
  ASSIGN I_TAB->* TO <TAB>.
SELECT * FROM (p_table) INTO TABLE <TAB>.
   here i want to add one more field into <TAB> at LAST position and my 
   Field name  =  field_stype     and
   Field type    =  'LVC_T_STYL'
could you please helpme out .

Hi,
Please find the code below.You can add the field acc to your requirement.
Creating Dynamic internal table
TYPE-POOLS: slis.
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,  u201C Dynamic internal table name
               <fs_dyntable>,                     u201C Field symbol to create work area
               <fs_fldval> type any.              u201C Field symbol to assign values 
PARAMETERS: p_cols(5) TYPE c.                     u201C Input number of columns
DATA:   t_newtable TYPE REF TO data,
        t_newline  TYPE REF TO data,
        t_fldcat   TYPE slis_t_fldcat_alv,
        t_fldcat   TYPE lvc_t_fcat,
        wa_it_fldcat TYPE lvc_s_fcat,
        wa_colno(2) TYPE n,
        wa_flname(5) TYPE c. 
Create fields .
  DO p_cols TIMES.
    CLEAR wa_it_fldcat.
    move sy-index to wa_colno.
    concatenate 'COL'
                wa_colno
           into wa_flname.
    wa_it_fldcat-fieldname = wa_flname.
    wa_it_fldcat-datatype = 'CHAR'.
    wa_it_fldcat-intlen = 10.
    APPEND wa_it_fldcat TO t_fldcat.
  ENDDO. 
Create dynamic internal table and assign to FS
  CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
      it_fieldcatalog = t_fldcat
    IMPORTING
      ep_table        = t_newtable. 
  ASSIGN t_newtable->* TO <t_dyntable>. 
Create dynamic work area and assign to FS
  CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
  ASSIGN t_newline->* TO <fs_dyntable>.
Populating Dynamic internal table 
  DATA: fieldname(20) TYPE c.
  DATA: fieldvalue(10) TYPE c.
  DATA: index(3) TYPE c. 
  DO p_cols TIMES. 
    index = sy-index.
    MOVE sy-index TO wa_colno.
    CONCATENATE 'COL'
                wa_colno
           INTO wa_flname. 
Set up fieldvalue
    CONCATENATE 'VALUE' index INTO
                fieldvalue.
    CONDENSE    fieldvalue NO-GAPS. 
    ASSIGN COMPONENT  wa_flname
        OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
    <fs_fldval> =  fieldvalue. 
  ENDDO. 
Append to the dynamic internal table
  APPEND <fs_dyntable> TO <t_dyntable>.
Displaying dynamic internal table using Grid. 
DATA: wa_cat LIKE LINE OF fs_fldcat. 
  DO p_cols TIMES.
    CLEAR wa_cat.
    MOVE sy-index TO wa_colno.
    CONCATENATE 'COL'
                wa_colno
           INTO wa_flname. 
    wa_cat-fieldname = wa_flname.
    wa_cat-seltext_s = wa_flname.
    wa_cat-outputlen = '10'.
    APPEND wa_cat TO fs_fldcat.
  ENDDO. 
Call ABAP List Viewer (ALV)
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      it_fieldcat = fs_fldcat
    TABLES
      t_outtab    = <t_dyntable>.

Similar Messages

  • How to ADD rows to a dynamic internal table??

    My question is simple.
    I have a dynamic internal table and I need to ADD rows to if.
    I read this thread How to modify a dynamic internal table from dynamic work area but they are modifying existing data.
    My internal table is EMPTY and I need to ADD new rows, so I can't use LOOP ASSIGNING.
    How can I do that?
    Any help is welcome!
    Thanks!
    Bettina

    Hi,
      try something similar.
    FIELD-SYMBOLS: <fs> type any.
    FIELD-SYMBOLS: <f1> type any.
    ASSIGN INITIAL LINE TO lo_data ASSIGNING <fs>. " or <f_tab> - not sure w/o editor :-)
    assigning component 1 of structure <fs> to <f1>.
    <f1> = 'aaa'.
    I write it from memory so there can be some syntax errors but focus to command APPEND INITIAL LINE ...
    Regards,
      Karol

  • 11.5.9/OAF 5.7 : how to add new fields in iProc "search results" page

    We need to add new fields into iProc "search results" page - "Personalize Self-Service Defn" is et, we can enter the personalization screens (from both the "master" link at top/right page level or from the link above the region) - anyway cannot find how to add new fields. Do we have to go to AK developer and/or XML files or is it feasable from OAF (as it is with 11510) ? TIA.

    It depends on what fields you want to add.
    1. If Oracle has included the fields, just render them via personalizations
    2. If they are brand new fields:
    a) you will need to extend the VO (I do not know the exact name).
    b) change the query to get your extra db columns if necesary
    c) add transient attributes to the VO and map them to b).
    d) Then you need to add the items via personalization and map them to the attributes you created in c)
    Check on metalink for the lates version of OAF Dev Guide and Personalization guide.
    Thanks
    Sandeep

  • How to add new fields in SAP-Query

    Hi,
    Can any body tell how to add new fields to the existing query.
    Thanks a lot,
    Bhaskar.

    hi,
    when we create internal tables like. in final table you can include the extra fields.
    data : begin of itab_mara,
             matnr like mara-matnr,
             erdat like mara-erdat,
             end of itab_mara.
    data : begin of itab_marc,
             matnr like marc-matnr,
             werks like marc-werks,
             end of itab_marc.
    data : begin of itab_final,
             matnr like mara-matnr,
             erdat like mara-erdat,
             werks like marc-werks,
             date like sy-datum,
             status(10) type c,  * new fields
             end of itab_final.
    <select statement>.
    Append all the fields to itab.
    loop at itab_final.
    write :/ itab_final.
    endloop.
    Reward with points if helpful.
    Message was edited by:
            Vinutha YV

  • How to add new fields in Reduced message ( in BD53 )

    Hi Experts,
    How to add new fields in Reduced message ( in BD53 ), when the required field iis available in Table or Structure and need to be added in BD53 so that we can ALE.
    Thanks,
    Ninad

    Hello,
    I think of something like:
    First, you create extension, with transaction WE30.
    Then, reduce your idoc, your extension should also be proposed.
    Do not forget to add this extension in outbound we82, and/or we57 in inbound, and WE20, and find BTE or exit to populate extension.
    regards.
    F.S.

  • PLz Help me its urgent, how to add new field in mm01 basic data screen

    Hi everyone,
         plz tell me how to add new field in mm01 basic data screen,i added that field in basic data screen but when i create a material the data for that field will not save in database table.
    Thanks,
    murali.

    Hi Murali,
    when created added a field on the screen by using user exit then after that you have add the field in main table where you will be getting these table in the userexit only, please make sure about this. And i am sure defenitly it will get updated in to the table.
    reward if useful.
    thanks
    abdulsamee.

  • How to add New field in SMART forms.

    How to add new field in the SMART FORMS. Please know me the step.
    Please help me soon.
    Moderator message: Welcome to SCN!
    Moderator message: please search for available information/documentation, do not use a priority higher than normal (no "soon", "ASAP", "earliest" etc.).
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
    Edited by: Thomas Zloch on Jun 17, 2011 12:31 PM

    How to add new field in the SMART FORMS. Please know me the step.
    Please help me soon.
    Moderator message: Welcome to SCN!
    Moderator message: please search for available information/documentation, do not use a priority higher than normal (no "soon", "ASAP", "earliest" etc.).
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
    Edited by: Thomas Zloch on Jun 17, 2011 12:31 PM

  • Query: How to add new fields in ABAP query?

    Hi All,
    Can any one tell me how to add new fields in the ABAP query output?
    We have to add the new fields using query design or we have
    to add those in the background program(automatically generated behind query) by selecting new fields in the code?

    What kind of report? Usually, you have to add the field in the table declaration and then also in the SQL query. After that, include the field in what kind of report you are using.

  • CRM  IC Winclient - How to add new fields in the BP Search of TRX CIC0

    Hello Experts,
    I want to know how to add new fields in the BP Search of TRX CIC0. In the HTML that we're using here I need to add the URL of the BP.
    Can you help me?
    Thanks in advance.
    Caíque Escaler

    Hi
    make append to tables in se11 - CCMBP1FIELDS, CCMBP2FIELDS
    in spro in Define customer-specific search control -> mark fields with X.
    and enhance html template CRM_CIC_SEARCH_DISPLAY. -> tcode smw0, look for package CRM_CIC_COMPONENTS for html CRM_CIC_SEARCH_DISPLAY. export it from SAP, edit, and import.
    you will need to enhance function module used for searching - you will find him in spro in Search Strategies.
    Regards
    Radek

  • How to add new fields to picklist of search criteria for opportunities

    Hi Friends,
    Could you please tell me how to add new fields to the picklist of search criteria of Opportunities in WEBCLIENT(CRM 2007).
    Regards,
    Vijay

    Dear Vijay,
    We are facing the same problem over here.
    Have you managed to find a solution? Please share
    BR,
    Rohit

  • How to add new fields to the system form (Ex.expenses to a/r invoice form)

    hi
    can any one tell me how to add new fields to the system form (Ex.expenses to a/r invoice form)
    i want to add expenses field to system a/r invoice form and connect data base also.
    i used the code of samples\11.system form manipulation(vb.net) but i'm not able to get it....so can any one help with code or concepts.
    reply soon plz..
    thankQ

    If I understood you correctly, you are just trying to add new fields to the invoice form and then use them in your form. you should first go and add the field to your tables, which you would do by going to Tool --> User Defined Fields --> Manage User Fields. There are different documents or categories given. For ex. for invoices, Sales Orders you would add your field under the Marketing Documents. If you want the field to be just one per invoice, add it to the Title, otherwise if you want a field per invoice or Sales Order line, add it to the Rows section. Once you have done that then you can just create a edit box or drop down to represent the field and set the datasource for that to your field. If you want example code to do that, let me know.

  • How to add new fields in asset master data

    Hello,
    i was wonder if anyone knows how to add new fields that arent defined in the asset master data.
    Thanks.
    Pedro

    Hi Pedro,
    SAP allows entering upto 8 fields on the asset master. These fields are called 'Evaluation group'. Out of 8, 4 are four character long and others are 8 character long.
    You can configure them @ the following 3 nodes in IMG:
    Financial Accounting>Asset Accounting>Master Data-->User Fields: Define 4-Character Evaluation Groups & Define 8-Character Evaluation Groups & Change Key Words in the Evaluation Groups.
    Regards,
    Vishal Thakur

  • How to add additional field into output table for RFIDYYWT(Generic Withholding Tax Reporting)

    Hi Experts,
    How to add additional field into output table VENDORS/WH TAX TYPES AND CODES in RFIDYYWT(Generic Withholding Tax Reporting).
    I have no idea how to start with, please give some advice.
    Thanks!
    Ice

    Dear Ice,
    Use Append structure, see given link:
    https://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eb61446011d189700000e8322d00/content.htm
    Regards,
    Abbas.

  • Add column in the dynamic internal table

    Hi Experts,
    I have a dynamic internal table. I need add new column in the internal table and I don´t Know.
    My code:
    DATA:  it_generic TYPE REF TO Data,
    wa_generic TYPE REF TO data.
    FIELD-SYMBOLS: <table> TYPE ANY TABLE,
    <wa>    TYPE ANY,
    <field> TYPE ANY.
    CREATE DATA it_generic  TYPE STANDARD TABLE OF (wa_datoscarga-ZTBLCAR).
    CREATE DATA wa_generic  TYPE (wa_datoscarga-ZTBLCAR).
    ASSIGN it_generic->* TO <table>.
    CHECK <table> IS ASSIGNED.
    ASSIGN wa_generic->* TO <wa>.
    CHECK <wa> IS ASSIGNED.
    SELECT *
    INTO  CORRESPONDING FIELDS OF TABLE <table>
    FROM (wa_datoscarga-ZTBLCAR)
    WHERE  bukrs   EQ p_bukrs      AND
    z_petic EQ z_peticion   AND
    ZIDFASE eq 'E'.
    After this I need add one column selection at the first position of the columns.
    Thanks

    Hi,
    Please refer to the below link for the code snippet on how to create a dynamic internal table -
    [Create a dynamic internal table.|http://www.divulgesap.com/blog.php?p=MjE=]
    Cheers,
    Ravi

  • How to do parallel processing with dynamic internal table

    Hi All,
    I need to implement parallel processing that involves dynamically created internal tables. I tried doing so using RFC function modules (using starting new task and other such methods) but didn't get success this requires RFC enabled function modules and at the same time RFC enabled function modules do not allow generic data type (STANDARD TABLE) which is needed for passing dynamic internal tables. My exact requirement is as follows:
    1. I've large chunk of data in two internal tables, one of them is formed dynamically and hence it's structure is not known at the time of coding.
    2. This data has to be processed together to generate another internal table, whose structure is pre-defined. But this data processing is taking very long time as the number of records are close to a million.
    3. I need to divide the dynamic internal table into (say) 1000 records each and pass to a function module and submit it to run in another task. Many such tasks will be executed in parallel.
    4. The function module running in parallel can insert the processed data into a database table and the main program can access it from there.
    Unfortunately, due to the limitation of not allowing generic data types in RFC, I'm unable to do this. Does anyone has any idea how to implement parallel processing using dynamic internal tables in these type of conditions.
    Any help will be highly appreciated.
    Thanks and regards,
    Ashin

    try the below code...
      DATA: w_subrc TYPE sy-subrc.
      DATA: w_infty(5) TYPE  c.
      data: w_string type string.
      FIELD-SYMBOLS: <f1> TYPE table.
      FIELD-SYMBOLS: <f1_wa> TYPE ANY.
      DATA: ref_tab TYPE REF TO data.
      CONCATENATE 'P' infty INTO w_infty.
      CREATE DATA ref_tab TYPE STANDARD TABLE OF (w_infty).
      ASSIGN ref_tab->* TO <f1>.
    * Create dynamic work area
      CREATE DATA ref_tab TYPE (w_infty).
      ASSIGN ref_tab->* TO <f1_wa>.
      IF begda IS INITIAL.
        begda = '18000101'.
      ENDIF.
      IF endda IS INITIAL.
        endda = '99991231'.
      ENDIF.
      CALL FUNCTION 'HR_READ_INFOTYPE'
        EXPORTING
          pernr           = pernr
          infty           = infty
          begda           = '18000101'
          endda           = '99991231'
        IMPORTING
          subrc           = w_subrc
        TABLES
          infty_tab       = <f1>
        EXCEPTIONS
          infty_not_found = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
        subrc = w_subrc.
      ELSE.
      ENDIF.

Maybe you are looking for

  • Problem with remote desktop and lock screen

    I know of the easy way to immediately lock a Mac's screen by clicking the menu bar lock icon from KeychainAccess. This works on every system under my control (rMBP running Mavericks, MacMini with 10.5 and Mavericks). However when I control the Macs v

  • Does anyone know how to get apple mail in Lion to connect with Exchange 2007?

    Does anyone know how to get apple mail in Lion 10.7.2 to connect with Exchange 2007?  It worked perfectly with Snow Leopard... upgraded to lion and it won't work.  We use Exchange 2007 with SP 3 and Rollup 4.  Won't connect... and I can't get Apple t

  • Get name of the folder after parent.

    Hi forum. I need a great help from you. If I could get the name of the folder which is between the Desktop and the indesign files where it ls saved... eg. /Users/wleastudio/Desktop/rantac/acb.indd. I need to get the folder name highlited in red and a

  • Portion of screen doesn't respond to touch

    I got my iPod Touch a few months ago and just today I found that about the top inch (almost half) of the screen doesn't respond to touch. I can't access 'calendar, notes, etc...', nor can i scroll through my songs from the top half or hit the 'back'

  • Multiple web pages

    Hello, is there any way to have multiple web pages open and showing on 1 page so you could thumb through them quicker and rotate pages