Error while creating a dynamic internal table refers to custom field

Hi all,
I am getting the exception TYPE_NOT_FOUND when I try to create a dynamic internal table using:-
DATA: gr_desc TYPE REF TO cl_abap_typedescr.
gr_desc = cl_abap_typedescr=>describe_by_name( p_field ).
The field p_field is a Z-field inside a DB table, (e.g. a user added field in MARA). The statement fails at that point and gives a runtime exception. Any suggestions to how I may solve this problem? Or any alternatives for the same? I guess we face this issue for all custom fields..has SAP released a note for this??
Thanks..

that's just the wrong method, you should use DESCRIBE_BY_DATA
gr_desc = cl_abap_typedescr=>describe_by_data( p_field ).
Note: DESCRIBE_BY_NAME is to be used for referencing a DDIC type by its name. Example:
gr_desc = cl_abap_typedescr=>describe_by_name( 'MARA-ZZFIELD' ).

Similar Messages

  • Problem with creating an dynamic internal table with only one field.

    Hi,
    i create an internal table like this:
    FIELD-SYMBOLS: <GT_ITAB>      TYPE TABLE,
                   <GS_ITAB>,
                   <FS>.
    DATA: GT_DATA TYPE REF TO DATA.
    DATA: GS_DATA TYPE REF TO DATA.
    DATA: TABNAME   LIKE DD03L-TABNAME.
    DATA: FIELDNAME LIKE DD03L-FIELDNAME.
    DATA: TBFDNAM   TYPE TBFDNAM VALUE 'LFA1-NAME1'.
    SPLIT TBFDNAM AT '-' INTO TABNAME FIELDNAME.
    CREATE DATA GT_DATA TYPE TABLE OF (TABNAME).
    ASSIGN GT_DATA->* TO <GT_ITAB>.
    CREATE DATA GS_DATA  LIKE LINE OF <GT_ITAB>.
    ASSIGN GS_DATA->* TO <GS_ITAB>.
    SELECT * FROM (TABNAME) INTO CORRESPONDING FIELDS OF TABLE <GT_ITAB>.
      BREAK-POINT.
    it works OK.
    Now i want to create an internal table not like LFA1 but with LFA1-NAME1 Field TBFDNAM.
    It's not only LFA1-NAME1 it shell be the value of TBFDNAM.
    When i change
    CREATE DATA GT_DATA TYPE TABLE OF (TABNAME).
    to
    CREATE DATA GT_DATA TYPE TABLE OF ( TBFDNAM).
    i get an shortdump.
    Any idea?
    Regards, Dieter

    Hi Dieter,
    Your approach is ok, but it will create dynamic table without a structure of NAME1. Only the line type will be suitable (but field name will not exists -> hence the error in the select statement).
    In this case you need to create a dynamic table which structure consists of one field named NAME1.
    This code is the appropriate one:
    " your definitions
    DATA: tabname LIKE dd03l-tabname.
    DATA: fieldname LIKE dd03l-fieldname.
    DATA: tbfdnam TYPE tbfdnam VALUE 'LFA1-NAME1'.
    FIELD-SYMBOLS <gt_itab> TYPE table.
    "new ones
    DATA: it_fcat TYPE lvc_t_fcat WITH HEADER LINE.
    DATA: gt_itab TYPE REF TO data.
    " get table and fieldname
    SPLIT tbfdnam AT '-' INTO tabname fieldname.
    " create dynamic table with structure NAME1 (only one field)
    it_fcat-fieldname = fieldname.
    it_fcat-tabname = tabname.
    APPEND it_fcat.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog           = it_fcat[]
      IMPORTING
        ep_table                  = gt_itab
      EXCEPTIONS
        generate_subpool_dir_full = 1
        OTHERS                    = 2.
    CHECK sy-subrc = 0.
    " dereference table
    ASSIGN gt_itab->* TO <gt_itab>.
    " insert data only to NAME1 field
    SELECT * FROM (tabname) INTO CORRESPONDING FIELDS OF TABLE <gt_itab>.
    I checked, this works fine:)
    Regards
    Marcin

  • How to populate dynamic internal table according to the field names

    Hi ,
          Iam having a dynamic internal table <DYN_TABLE> , it has fields like
    MATNR   MAKTX       MEINS    BISMT     MTART  ...
    Now my requirement is i need to fill them according to the fieldname from another internal table (static) .
    The order of  internal table (static) and dynamic internal are not same. 
    kindly help me.

    Hi,
    Here is the code. Please reward points if helpful.
    REPORT z_dynamic.
    TYPE-POOLS : abap.
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                   <dyn_wa>,
                   <dyn_field>.
    DATA: dy_table TYPE REF TO data,
          dy_line  TYPE REF TO data,
          xfc TYPE lvc_s_fcat,
          ifc TYPE lvc_t_fcat.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS: p_table(30) TYPE c DEFAULT 'T001'.
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
      PERFORM get_structure.
      PERFORM create_dynamic_itab.
      PERFORM get_data.
      PERFORM write_out.
    *&      Form  get_structure
          text
    FORM get_structure.
      DATA : idetails TYPE abap_compdescr_tab,
             xdetails TYPE abap_compdescr.
      DATA : ref_table_des TYPE REF TO cl_abap_structdescr.
    Get the structure of the table.
      ref_table_des ?=
          cl_abap_typedescr=>describe_by_name( p_table ).
      idetails[] = ref_table_des->components[].
      LOOP AT idetails INTO xdetails.
        CLEAR xfc.
        xfc-fieldname = xdetails-name .
        xfc-datatype = xdetails-type_kind.
        xfc-inttype = xdetails-type_kind.
        xfc-intlen = xdetails-length.
        xfc-decimals = xdetails-decimals.
        APPEND xfc TO ifc.
      ENDLOOP.
    ENDFORM.                    "get_structure
    *&      Form  create_dynamic_itab
          text
    FORM create_dynamic_itab.
    Create dynamic internal table and assign to FS
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = ifc
        IMPORTING
          ep_table        = dy_table.
      ASSIGN dy_table->* TO <dyn_table>.
    Create dynamic work area and assign to FS
      CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.
    ENDFORM.                    "create_dynamic_itab
    *&      Form  get_data
          text
    FORM get_data.
    Select Data from table.
      SELECT * INTO TABLE <dyn_table>
                 FROM (p_table).
    ENDFORM.                    "get_data
    *&      Form  write_out
          text
    FORM write_out.
    Write out data from table.
      LOOP AT <dyn_table> INTO <dyn_wa>.
        DO.
          ASSIGN COMPONENT  sy-index
             OF STRUCTURE <dyn_wa> TO <dyn_field>.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          IF sy-index = 1.
            WRITE:/ <dyn_field>.
          ELSE.
            WRITE: <dyn_field>.
          ENDIF.
        ENDDO.
      ENDLOOP.
    ENDFORM.                    "write_out

  • Create a dynamic internal table

    Hi ,
    Can any one send me some code for creating dynamic internal table
    My req is like this
    Input table:
    OP   QUAN  DATE
    1      2          10/10/2009
    2      3           10/10/2009
    3      2           11/10/2009
    4      1           12/10/2009
    Output table should look like this ( there are 3 different dates in above input and my output should have 3 additional columns and quan should fall under date)
    OP  10/10/2009   11/10/2009    12/10/2009
    1      2                    0                      0
    2      3                    0                      0
    3      0                    2                      0
    4      0                   0                       1
    Any quick respone will be greatlt appreciated
    Moderator message - Please search before asking - post locked
    Edited by: Rob Burbank on Dec 16, 2009 4:52 PM

    The dynamic creation of internal tables has been discussed many times before in the forum. Please search the forum for them. If you have difficulties after that, post a new message with the code you have to create the table along with a description of your difficulty.
    Rob

  • Error while creating VO dynamically and assigning it to Table Region

    Hi,
    I am getting the below exception while running my OAF page
    oracle.apps.fnd.framework.OAException: Programming error. Row (oracle.jbo.server.ViewRowImpl@1e) must be of type oracle.apps.fnd.framework.OARow.
    I've created a dynamic VO using createViewObjectFromQueryStmt(), and used setViewUsage() on messageStyledTextBean of my table.
    Couldn't find anything related to the error on forum.
    Any sort of help is appreciated.

    Check in Corresponding VORowImpl ---
    change the Import Statement -- from -
    import oracle.jbo.server.ViewRowImpl; // 11i
    to
    import oracle.apps.fnd.framework.server.OAViewRowImpl; // R12
    Hope This will help Out..

  • Javascript error while creating rows dynamically (IE)

    hi all,
    as per the requirement i am creating rows dynamically by createElement() method ...
    when i load the page method where i am creating the rows is called on onLoad ... bring the data required .. some method code like this ...
    function createRows()
    var myTable = document.getElementById("itemTable");
              var tBody = myTable.getElementsByTagName('tbody')[0];
              alert(tBody);
              var td;
              var classVar;
              var browser = navigator.appName;
              if(browser=="Microsoft Internet Explorer")
                   classVar = "className";
              }else{
                   classVar = "class";
              <%
              Set keyset = checklistItems.keySet();
              Iterator keySetIterator = keyset.iterator();
              while(keySetIterator.hasNext())
                   String checklistType = (String)keySetIterator.next();
                   %>
                   if ((type == "Show_All") || (type == '<%=checklistType%>'))
                                  var newTypeTR = document.createElement('tr');
                                  var newTypeTD = document.createElement('td');
                                  newTypeTD.setAttribute("width","100%");
                                  newTypeTD.setAttribute(classVar,"font_black_s_bold");
                                  if(browser=="Microsoft Internet Explorer")
                                       newTypeTD.innerText = '<%= checklistType %>';
                                  else
                                       newTypeTD.innerHTML = '<%= checklistType %>';
                                  newTypeTR.appendChild (newTypeTD);
                                  newTypeTR.setAttribute(classVar,"td5");
                                  tBody.appendChild (newTypeTR);
    table is defined in jsp like
    <table width="727" cellSpacing="0">
                   <tr>
                        <td>
                             <div id="checklist_item_div">
                                  <table border="0" id='itemTable' width="100%" cellPadding="4" cellSpacing="0">     
                                  <tbody>
                                       <tr>
                                       </tr>     
                                  </tbody>
                                  </table>
                             </div>
                        </td>
                   </tr>
    </table>
    Now i have a combo box on my page , where onchange i am bringing new data using ajax to fill ....
    and now i want to flush all the rows i created earlier ...and again call the same method as above to create the rors and cols dynamically ...
    so after ajax call my script code to flush all rows and cols like
    var browser=navigator.appName;
                        if(browser=="Microsoft Internet Explorer")
                             itmTable.innerText = "<tbody></tbody>";
                        else
                             itmTable.innerHTML = "<tbody> </tbody>";
    but when i call the createRows function after this , i got the error on the line
    tBody.appendChild (newTypeTR);
    as tBody now getting as undefined .... this problem is with IE (working on IE 7.0)
    works very fine on firefox and safari browsers ...
    please helm me out ...
    Edited by: prashant-kadam on Jun 12, 2008 5:22 AM

    what does this have to do with Java?
    hint: Java != Javascript

  • Error while downloading data from internal table into XML file

    hi all,
    i developed a program to download data from into internal table to xml file like this.
    tables: mara.
    parameters: p_matnr like mara-matnr.
    data: begin of itab_mara occurs 0,
                matnr like mara-matnr,
                ernam like mara-ernam,
                aenam like mara-aenam,
                vpsta like mara-vpsta,
          end of itab_mara.
    data: lv_field_seperator type c,     " value 'X',
          lv_xml_doc_name(30) type c,    " string value ‘my xml file’,
          lv_result type i.
          lv_field_seperator = 'x'.
          lv_xml_doc_name = 'my xml file'.
    types: begin of truxs_xml_line,
              data(256) type x,
          end of truxs_xml_line.
    types:truxs_xml_table type table of truxs_xml_line.
    data:lv_tab_converted_data type truxs_xml_line,
         lt_tab_converted_data type truxs_xml_table.
    data: lv_xml_file type rlgrap-filename value 'c:\simp.xml'.
    select matnr ernam aenam vpsta from mara into table itab_mara up to 5
           rows where matnr = p_matnr.
    CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
    EXPORTING
       I_FIELD_SEPERATOR          = lv_field_seperator
      I_LINE_HEADER              =
      I_FILENAME                 =
      I_APPL_KEEP                = ' '
       I_XML_DOC_NAME             = lv_xml_doc_name
    IMPORTING
       PE_BIN_FILESIZE            = lv_result
      TABLES
        I_TAB_SAP_DATA             = itab_mara
    CHANGING
       I_TAB_CONVERTED_DATA       = lt_tab_converted_data
    EXCEPTIONS
      CONVERSION_FAILED          = 1
      OTHERS                     = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    open dataset lv_xml_file for output in binary mode.
    loop at lt_tab_converted_data into lv_tab_converted_data.
    transfer lv_tab_converted_data to lv_xml_file.
    endloop.
    close dataset lv_xml_file.
    this program is syntactically correct and getting executed, but when i open the target xml file it is showing the following error.
    The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    XML document must have a top level element. Error processing resource 'file:///C:/simp.xml'.
    will anyone show me the possible solution to rectify this error
    thanks and regards,
    anil.

    Hi,
    Here is a small sample program to convert data in an internal table into XML format and display it.
    DATA: itab  TYPE TABLE OF spfli,
          l_xml TYPE REF TO cl_xml_document.
    * Read data into a ITAB
    SELECT * FROM spfli INTO TABLE itab.
    * Create the XML Object
    CREATE OBJECT l_xml.
    * Convert data in ITAB to XML
    CALL METHOD l_xml->create_with_data( name = 'Test1'
                                         dataobject = t_goal[] ).
    * Display XML Document
    CALL METHOD l_xml->display.
    Here are some other sample SAP programs to handle XML in ABAP:
    BCCIIXMLT1, BCCIIXMLT2, and BCCIIXMLT3.
    Hope this helps,
    Sumant.

  • How to create an dynamic internal table with the structure of a ddic table

    Hi all,
    I want to fill ddic-tables (which I already created) in my abap dictionary with data out of CSV-files (which are located on the CRM-Server).  The ddic tables have different amount of fields.
    I started with creating a table which contains the name of the tables and the path to the matching CSV-file.
    At the beginning I'm filling an internal table with part of this data (the name of the ddic-tables) - after that I am looping at this internal table.
    LOOP AT lt_struc ASSIGNING <lfs_struc>.
         LOOP AT lv_itab1 INTO lv_wa1 WHERE ztab_name = <lfs_struc>.
         lv_feld = lv_wa1-zdat_name.
        ENDLOOP.
        CONCATENATE 'C:\-tmp\Exportierte Tabellen\' lv_feld INTO lv_pfad.
        Do.
        OPEN DATASET lv_pfad FOR INPUT IN TEXT MODE ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
        READ DATASET lv_pfad INTO lv_rec.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
        enddo.
        REPLACE ALL OCCURRENCES OF '"' IN lv_rec WITH ''.
        SPLIT lv_rec AT ';' INTO TABLE lt_str_values.
        INSERT into (<lfs_struc>) values lr_str_value.
        CLOSE DATASET lv_pfad.
    endloop.
    This is not the whole code, but it's working until
    SPLIT lv_rec AT ';' INTO TABLE lt_str_values.
    I want to split all the data of lv_rec into an internal table which has the structure of the current ddic-table, but I didn't find out how to do give the internal table the structure of the ddic-table. In the code I used an internal tyble type string but I should be the structure of the matching tabel.
    If I try to create an internal table by using a fiel symbol, I am told, that the data types are not matching.
    Has anyone an idea?

    Hi Mayari,
    though you were successfull with
    METHOD cl_alv_table_create=>create_dynamic_table
    I must warn you not to use it. The reason is that the number of tables created is limited, the method uses GENERATE SUBROUTINE statement and this triggers an unwanted database commit.
    If you know the DDIC structure, it is (starting with ECC6.0) much easier:
    field-symbols:
      <table> type standard table.
    data:
      lr_data type ref to data.
    Create data lr_data type table of (<DDIC structure>).
    assign lr_data->* to <table>.
    The split code can be simplified gaining speed loosing complexity not loosing functionality.
    field-symbols:<fs_s> type any.
    field-symbols:<fs_t> type any.
    SPLIT lv_rec AT ';' INTO table it_string.
    loop at it_string assigning <fs_s>.
      assign component sy-tabix of wa_string to <fs_t>.
    if sy-subrc = 0.
      <fs_t> = <fs_s>.
    endif.
    at last.
      append <fs_itwa3> to <ft_itab3>.
    endat.
    endloop.
    Though it may work as Keshav.T suggested, there is no need to do that way.     
    Regards,
    Clemens

  • Error While Create Business Components From Tables Wizard -- need help asap

    Hi , i have created a view and while create Business Components through wizard for that view i am getting following error.
    ENTITY CREATION FAILED FOR THE FOLLOWING DATABASE OBJECT
    NO PRIMARY KEY ATTRIBUTES AND DOES NOT SUPPORT ROWID . USE ENTITY WIZARD TO CREATE THE ENTITY OBJECT.
    very urgent.
    Regards
    bhanu prakash

    thanks shay .
    Jdeveloper version :: 10.1.3.1.0
    view Syntax is :
    SELECT
    oh.order_number||'- ('||ol.line_number||'-'||ol.shipment_number||')' so_line,
    oh.cust_po_number customer_po,
    ol.flow_status_code status,
    ol.shipping_method_code carrier,
    ol.ordered_item item_no,
    nvl(xxapplication_express_pkg.getcustomerpart(ol.inventory_item_id, hca.cust_account_id), ' ') customer_item_number,
    nvl(mtl.description , 'na') description,
    nvl(org.organization_name , 'oak park') ship_from,
    hcsu.location||' ('||hl.city||' '||hl.state||' '||hl.postal_code||')' ship_to,
    nvl(ol.promise_date, sysdate) promised_date,
    nvl(ol.ordered_quantity, 0) order_quality ,
    xxapps.xx_eg_calculated_onhand(ol.line_id) available_qty,
    nvl(ol.shipped_quantity, 0) shipped_quality ,
    ol.order_quantity_uom uom,
    hp.party_name customer_name,
    jrs.name sales_person_name,
    0 refer
    FROM
    oe_order_headers_all oh,
    oe_order_lines_all ol,
    hz_cust_accounts hca,
    hz_parties hp ,
    hz_cust_site_uses_all hcsu,
    hz_cust_acct_sites_all hcas,
    hz_party_sites hps,
    hz_locations hl,
    org_organization_definitions org ,
    mtl_system_items_b mtl ,
    jtf_rs_salesreps jrs
    WHERE
    oh.header_id = ol.header_id and
    oh.org_id = ol.org_id and
    oh.sold_to_org_id = hca.cust_account_id and
    hca.party_id = hp.party_id and
    hcas.cust_account_id = hca.cust_account_id and
    hcsu.cust_acct_site_id = hcas.cust_acct_site_id and
    hcas.party_site_id = hps.party_site_id and
    hps.location_id = hl.location_id and
    hcsu.site_use_id = oh.ship_to_org_id and
    hcsu.site_use_code = 'SHIP_TO' and
    org.organization_id = ol.ship_from_org_id and
    org.organization_id = mtl.organization_id and
    ol.inventory_item_id = mtl.inventory_item_id and
    ol.ship_from_org_id = mtl.organization_id and
    ol.salesrep_id = jrs.salesrep_id and
    ol.org_id = jrs.org_id
    Regards
    Bhanu Prakash

  • Error while creating a Event in Table maintanence gen

    Hi,
    I've created a table maintanence gen every thing worked fine...i wanted to create a event 05 at new entries in my table main gen so i did it and wrote a subroutine inside it without any logic since i thougt of doing it later and just saved it and came out out the event creation......Now when i want to go to same even the its pops up a Information error which says 'Function group  zxyz cannot be processed.' I cant open any thing from the main menu of the screen...like from environment or from utilities...for every thing it pops up the same message....is it bcoz of the event which i've just created......if i still want to delete it...its not allowing me to go into the event again..how to do it guys...suggest me
    Thanking you.........

    Hi Younus,
    Check whether the function group u created is ACTIVE or not.
    Go to se80. Give the FG name.. check it. Check all the includes in the Function Group whether they are ACTIVE or not.
    Try checking the Package in the TABLE MAINTANCE GENERATOR screen. Assign the Function Group to the correct package.
    I think this solves the issue.
    check the FG name in display mode in the TMG.
    Regards,
    Priyanka.

  • Error while creating data source using table KONP

    Hi Frnds,
       I am creating  a data source (RSo2) from Extraction from view, using the Table KONP , then i getting an error saying that
    Field KBETR with reference field KONWA: ZOXPTS0031 is to replace reference table RV13A
    Message no. R8390
    Field MXWRT with reference field KONWA: ZOXPTS0031 is to replace reference table RV13A
    Message no. R8390
    Field GKWRT with reference field KONWA: ZOXPTS0031 is to replace reference table RV13A
    Message no. R8390
    Regards
    rakesh

    You have to include reference fields also in the extract structure.

  • Error while creating dynamic internal table.

    Hello Expert,
    While creating a dynamic internal table, it throw an run time error as :
    " LOAD PROGRAM NOT FOUND
      CX_SY_PROGRAM_NOT_FOUND"
    i tried to debug the program, it found this error comes while calling
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    please anyone help me out to resolve this problem.
    what could be the reason of error? and how to avoid it?
    <REMOVED BY MODERATOR>
    thanks in advance.
    ~ shweta.
    Edited by: Alvaro Tejada Galindo on Feb 28, 2008 2:41 PM

    Hi,
    Go through this program.
    Report z_dynamic.
    type-pools : abap.
    field-symbols: <dyn_table> type standard table,
    <dyn_wa>,
    <dyn_field>.
    data: dy_table type ref to data,
    dy_line type ref to data,
    xfc type lvc_s_fcat,
    ifc type lvc_t_fcat.
    selection-screen begin of block b1 with frame.
    parameters: p_table(30) type c default 'T001'.
    selection-screen end of block b1.
    start-of-selection.
    perform get_structure.
    perform create_dynamic_itab.
    perform get_data.
    perform write_out.
    form create_dynamic_itab.
    Create dynamic internal table and assign to FS
    call method cl_alv_table_create=>create_dynamic_table
    exporting
    it_fieldcatalog = ifc
    importing
    ep_table = dy_table.
    assign dy_table->* to <dyn_table>.
    Create dynamic work area and assign to FS
    create data dy_line like line of <dyn_table>.
    assign dy_line->* to <dyn_wa>.
    endform.
    Regards,

  • How to create Dynamic internal table with columns also created dynamically.

    Hi All,
    Any info on how to create a dynamic internal table along with columns(fields) also to be created dynamically.
    My requirement is ..On the selection screen I enter the number of fields to be in the internal table which gets created dynamically.
    I had gone thru some posts on dynamic table creation,but could'nt find any on the dynamic field creation.
    Any suggestions pls?
    Thanks
    Nara

    I don't understand ...
    something like that ?
    *   Form P_MODIFY_HEADER.                                              *
    form p_modify_header.
      data : is_fieldcatalog type lvc_s_fcat ,
             v_count(2)      type n ,
             v_date          type d ,
             v_buff(30).
    * Update the fieldcatalog.
      loop at it_fieldcatalog into is_fieldcatalog.
        check is_fieldcatalog-fieldname+0(3) eq 'ABS' or
              is_fieldcatalog-fieldname+0(3) eq 'VAL' .
        move : is_fieldcatalog-fieldname+3(2) to v_count ,
               p_perb2+5(2)                   to v_date+4(2) ,
               p_perb2+0(4)                   to v_date+0(4) ,
               '01'                           to v_date+6(2) .
        v_count = v_count - 1.
        call function 'RE_ADD_MONTH_TO_DATE'
            exporting
              months        = v_count
              olddate       = v_date
            importing
              newdate       = v_date.
        if is_fieldcatalog-fieldname+0(3) eq 'ABS'.
          concatenate 'Quantité 0'
                      v_date+4(2)
                      v_date+0(4)
                      into v_buff.
        else.
          concatenate 'Montant 0'
                      v_date+4(2)
                      v_date+0(4)
                      into v_buff.
        endif.
        move : v_buff to is_fieldcatalog-scrtext_s ,
               v_buff to is_fieldcatalog-scrtext_m ,
               v_buff to is_fieldcatalog-scrtext_l ,
               v_buff to is_fieldcatalog-reptext .
        modify it_fieldcatalog from is_fieldcatalog.
      endloop.
    * Modify the fieldcatalog.
      call method obj_grid->set_frontend_fieldcatalog
           exporting it_fieldcatalog = it_fieldcatalog.
    * Refresh the display of the grid.
      call method obj_grid->refresh_table_display.
    endform.                     " P_MODIFY_HEADER

  • Dynamic internal table and dynamic field catalog

    hi
    i need to decide the number of fields of the internal table at runtime
    and then need to pass value to this internal table.
    then i need to create the field catalog for this internal table (so here
    field catalog is also dynamic) to display in alv.
    how to achieve this dynamic internal table creation and dyanmic field catalog generation

    Hi Ajay,
      U can use the below code to create a dynamic internal table.
    *adding the field names only once for the dynamic table     .
          MOVE 'PRCTR' TO gw_component-name.
          gw_component-type ?= cl_abap_elemdescr=>get_string( ).
          INSERT gw_component INTO TABLE gt_components.
          MOVE 'RCNTR' TO gw_component-name.
          gw_component-type ?= cl_abap_elemdescr=>get_string( ).
          INSERT gw_component INTO TABLE gt_components.
          MOVE 'RACCT' TO gw_component-name.
          gw_component-type ?= cl_abap_elemdescr=>get_string( ).
          INSERT gw_component INTO TABLE gt_components.
          MOVE 'RYEAR' TO gw_component-name.
          gw_component-type ?= cl_abap_elemdescr=>get_string( ).
          INSERT gw_component INTO TABLE gt_components.
          MOVE 'YTDBAL' TO gw_component-name.
          gw_component-type ?= cl_abap_elemdescr=>get_string( ).
          INSERT gw_component INTO TABLE gt_components.
          MOVE 'OBAL' TO gw_component-name.
          gw_component-type ?= cl_abap_elemdescr=>get_string( ).
          INSERT gw_component INTO TABLE gt_components.
    *get structure descriptor -> GR_STRUCTDESCR
              gr_structdescr ?= cl_abap_structdescr=>create( gt_components ).
    create work area of structure GR_STRUCTDESCR -> GR_WA
              CREATE DATA gr_wa TYPE HANDLE gr_structdescr.
              ASSIGN gr_wa->* TO <gw_wa>.
    determine key components -> GT_KEYS
              MOVE lv_value1 TO gw_key-name.
              INSERT gw_key INTO TABLE gt_keys.
    create descriptor for internal table -> GR_TABLEDESCR
              gr_tabledescr ?= cl_abap_tabledescr=>create( p_line_type  = gr_structdescr
                                                           p_table_kind = cl_abap_tabledescr=>tablekind_hashed
                                                           p_unique     = abap_true
                                                           p_key        = gt_keys
                                                           p_key_kind   = cl_abap_tabledescr=>keydefkind_user ).
    create internal table -> GR_ITAB
              CREATE DATA gr_itab TYPE HANDLE gr_tabledescr.
              ASSIGN gr_itab->* TO <gt_itab>.
              CREATE DATA gr_itab LIKE STANDARD TABLE OF <gw_wa>.
              ASSIGN gr_itab->* TO <gt_sttab>.
    Now u r internal table named <gt_sttab> has been created with fields like RCNTR, PRCTR,RACCT, RYEAR etc whatever the field u need u can go ahead and create dynamically.
    then by using the table <gt_sttab> u can create u r field catalog.
    Regards,
    Rose.

  • Problem in creating dynamic internal table

    Hi Experts,
    I am trying creating a dynamic internal table.
    But I am getting the error 'The field string "LT_GENTAB" contains no fields. 4 LT_GENTAB".
    Can anybody tell me what is the error and how to solve it.
    Thanks,
    Sudheer

    Hi,
    Please find the below code.
    data : wa_fieldcat type slis_fieldcat_alv,
           wa_fieldcat1 type slis_fieldcat_alv,
           wa_fieldcat2 type LVC_S_FCAT,
           it_fieldcat type slis_t_fieldcat_alv,
           it_fieldcat1 type slis_t_fieldcat_alv,
           it_fieldcat2 type LVC_T_FCAT,
           V_LAYOUT TYPE SLIS_LAYOUT_ALV,
           LS_LVC_FIELDCATALOGUE  TYPE LVC_S_FCAT,
           LT_LVC_FIELDCATALOGUE  TYPE LVC_T_FCAT,
           IT_EVENTS TYPE SLIS_T_EVENT,
           WA_EVENTS TYPE SLIS_ALV_EVENT.
    data : L_TABLE    TYPE REF TO DATA.
    FIELD-SYMBOLS :  <IT_TABLE>    TYPE STANDARD TABLE.
    FIELD-SYMBOLS :  <IT_ITEM1>    TYPE STANDARD TABLE.
    v_col = 1.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'PRUEFLOS'.
    wa_fieldcat2-seltext   = 'Inspection Lot'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'WERKS'.
    wa_fieldcat2-seltext   = 'Plant'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'ART'.
    wa_fieldcat2-seltext   = 'Inspection Type'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'HERKUNFT'.
    wa_fieldcat2-seltext   = 'Lot Origin'.
    WA_FIELDCAT1-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'STAT35'.
    wa_fieldcat2-seltext   = 'Usage Decision Made'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'ENSTEHDAT'.
    wa_fieldcat2-seltext   = 'Lot created on'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'ERSTELLER'.
    wa_fieldcat2-seltext   = 'Created by'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'PASTRTERM'.
    wa_fieldcat2-seltext   = 'Insp. Start Date'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'PAENDTERM'.
    wa_fieldcat2-seltext   = 'End of Inspection'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'PLNTY'.
    wa_fieldcat2-seltext   = 'Task List Type'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'AUFNR'.
    wa_fieldcat2-seltext   = 'Order No.'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'KTEXTMAT'.
    wa_fieldcat2-seltext   = 'Object short text'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'KURZTEXT'.
    wa_fieldcat2-seltext   = 'Short Text for Code'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'KATALGART1'.
    wa_fieldcat2-seltext   = 'Catalog Type'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'GRUPPE1'.
    wa_fieldcat2-seltext   = 'Code Group'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'CODE1'.
    wa_fieldcat2-seltext   = 'Code'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    *WA_FIELDCAT2-COL_POS = v_col.
    *WA_FIELDCAT2-FIELDNAME = 'ORIGINAL_INPUT'.
    *WA_FIELDCAT2-SELTEXT_M   = 'Original Value'.
    **WA_FIELDCAT2-OUTPUTLEN   = 20.
    *v_col = v_col + 1.
    *APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    *CLEAR  WA_FIELDCAT2.
    loop at it_qamv1 into wa_qamv1.
      read table it_qasr into wa_qasr with key wa_qamv1-prueflos.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = wa_qamv-kurztext.
    wa_fieldcat2-seltext   = wa_qasr-original_input.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    endloop.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'EQUNR'.
    wa_fieldcat2-seltext   = 'Equipment'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'TPLNR'.
    wa_fieldcat2-seltext   = 'Functional Location'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'TPLMA'.
    wa_fieldcat2-seltext   = 'Superior Funct Loc.'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'STATUS'.
    wa_fieldcat2-seltext   = 'Status'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'INACT'.
    wa_fieldcat2-seltext   = 'Status Inactive'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    Create internal table dynamic
      CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = LT_LVC_FIELDCATALOGUE
        IMPORTING
          EP_TABLE        = L_TABLE.
      ASSIGN L_TABLE->* TO <IT_TABLE>.
    I am getting the error when the method  CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
    is executed.
    Please help me
    Thanks,
    Sudheer

Maybe you are looking for

  • Time Machine hard drive is not sleeping.

    I have been using a 1TB Maxtor Basics (Seagate?) external USB hard drive for Time Machine on my iMac for over a year now without any problems, until recently. Between backups, the Time Machine HD does not go to sleep anymore. I am certain that until

  • QuickTime Pro on my two hard drives one Mac

    I have QT Pro on my Panther Hard Drive, and I have Tiger on a 2nd HD on the same Mac, is it possible to use the QT pro I've already purchased on the Tiger HD? Thought I'd ask before I purchased the same QT again. Don't want to install Tiger over my P

  • HT1212 how do you enable your ipod when its diabled and wont connect to itunes to fix it?

    i recently tried to login to my ipod and it disabled me completely from it. The last time i tried to login in it showed a message "iPod is disabled connect to iTunes" so naturally i went to connect to itunes to fix this. Then ITunes showed a message

  • Dynamically Accessing a PL/SQL Table

    If I have 2 plsql tables : vt1_games and vt2_games that I usuallly update with the following: vt1_games(vt1_count).team1_num := ...... or vt2_games(vt2(count).team1_num := ...... How can I use a variable for the plsql table name and pointer? Thanks,

  • Show View Options (DEFAULT) DOES NOT work

    I'm pulling out my hair trying to get my Finder "show view options" to default. This worked fine in Leopard, but in Snow Leopard, the make "default" option doesn't seem to work. I'm using an erase and install version of Snow Leopard. I've used Cockta