<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Runtime error on Toolbar click  in set_table_for_first_display in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-on-toolbar-click-in-set-table-for-first-display/m-p/2010836#M410390</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Tatyana&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Most likely the &amp;lt;i&amp;gt;Print-Preview&amp;lt;/i&amp;gt; fails due to missing technical information in the fieldcatalog. Instead of building the fieldcatalog manually I would prefer to use the &amp;lt;b&amp;gt;function module&amp;lt;/b&amp;gt; in the following way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  REFRESH: gt_fcat.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name             = 'CDHDR'
*     I_CLIENT_NEVER_DISPLAY       = 'X'
    CHANGING
      ct_fieldcat                  = gt_fcat
    EXCEPTIONS
      inconsistent_interface       = 1
      program_error                = 2
      OTHERS                       = 3.
  IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  DELETE gt_fcat WHERE ( fieldname ne 'UDATE' ).


  REFRESH: gt_fcat.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name             = 'EBAN'
*     I_CLIENT_NEVER_DISPLAY       = 'X'
    CHANGING
      ct_fieldcat                  = gt_fcat
    EXCEPTIONS
      inconsistent_interface       = 1
      program_error                = 2
      OTHERS                       = 3.
  IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.  

  DELETE gt_fcat WHERE ( ref_table = 'EBAN' )
                          AND      ( fieldname ne 'BANFN'    AND
                                        fieldname ne 'BNFPO'    AND
                                        ... ).

" Finally, rearrange the fields if necessary
  READ TABLE gt_fcat INTO ls_fcat
            WITH KEY fieldname = 'UDATE'.
  IF ( syst-subrc = 0 ).
    DELETE gt_fcat INDEX syst-tabix.

   INSERT ls_fcat INTO gt_fcat INDEX 6.
  ENDIF.

" Renumbering of the columns
  LOOP AT gt_fcat INTO ls_fcat.
    ls_fcat-col_pos = syst-tabix.
    MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
  ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Mar 2007 03:57:56 GMT</pubDate>
    <dc:creator>uwe_schieferstein</dc:creator>
    <dc:date>2007-03-20T03:57:56Z</dc:date>
    <item>
      <title>Runtime error on Toolbar click  in set_table_for_first_display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-on-toolbar-click-in-set-table-for-first-display/m-p/2010835#M410389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;lt;b&amp;gt;I am using OOP in my report. &lt;/P&gt;&lt;P&gt;The report will display an internal table  which I build using selection criteria. The internal table is NOT an extract of ONE table but is composed of several tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting a Runtime error after I click Print, Views -&amp;gt;Print Preview and  Export-&amp;gt; Local file buttons.  The error is "OBJECTS_NOT_CHARLIKE".&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                              &amp;lt;u&amp;gt; &amp;lt;b&amp;gt; First I define my Internal table this way:&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* Types declaration
TYPES: BEGIN OF it_ln,
        banfn  LIKE eban-banfn,
        bnfpo  LIKE eban-bnfpo,
        menge  LIKE eban-menge,
        preis  LIKE eban-preis,
        totval LIKE eban-menge,
        udate  LIKE cdhdr-udate,
        txz01  LIKE eban-txz01,
END OF it_ln.

* Data
DATA: BEGIN OF it_ln,
        banfn  LIKE eban-banfn,
        bnfpo  LIKE eban-bnfpo,
        menge  LIKE eban-menge,
        preis  LIKE eban-preis,
        totval LIKE eban-menge,
        udate  LIKE cdhdr-udate,
        txz01  LIKE eban-txz01,
END OF it_ln.

* Internal table declaration
DATA: it TYPE STANDARD TABLE OF it_ln.  " Int Table w/out header line

* Fieldcatalog declaration
      I_fld     TYPE lvc_t_fcat.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                                        &amp;lt;u&amp;gt; &amp;lt;b&amp;gt; Then  I build fieldcatalog:&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*----------------------------------------------------------------------*
*  Build Fieldcatalog.
*----------------------------------------------------------------------*
FORM fieldcat_init.
  gs_layout-zebra = 'X'.
  gs_layout-cwidth_opt = 'X'.

  wa_fld-fieldname   = 'BANFN'.
  wa_fld-ref_table   = 'IT'.
  wa_fld-coltext = 'Req Number'.
  APPEND WA_FLD TO I_FLD.

  wa_fld-fieldname   = 'BNFPO'.
  wa_fld-ref_table   = 'IT'.
  wa_fld-coltext = 'Item Number'.
  APPEND WA_FLD TO I_FLD.

  wa_fld-fieldname   = 'MENGE'.
  wa_fld-ref_table   = 'IT'.
  wa_fld-coltext     = 'Quantity'.
  APPEND WA_FLD TO I_FLD.

  wa_fld-fieldname   = 'PREIS'.
  wa_fld-ref_table   = 'IT'.
  wa_fld-coltext     = 'Price'.
  APPEND WA_FLD TO I_FLD.

  wa_fld-fieldname   = 'TOTVAL'.
  wa_fld-ref_table   = 'IT'.
  wa_fld-coltext     = 'Total Value'.
  APPEND WA_FLD TO I_FLD.

  wa_fld-fieldname   = 'UDATE'.
  wa_fld-ref_table   = 'IT'.
  wa_fld-coltext     = 'Date Approved'.
  APPEND WA_FLD TO I_FLD.

  wa_fld-fieldname   = 'TXZ01'.
  wa_fld-ref_table   = 'IT'.
  wa_fld-coltext     = 'Description'.
  APPEND WA_FLD TO I_FLD.

ENDFORM.                " fieldcat_init&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                                    &amp;lt;u&amp;gt;    &amp;lt;b&amp;gt;After that I call set_table_for_first_display:&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  CALL  METHOD grid1-&amp;gt;set_table_for_first_display
         EXPORTING i_structure_name = 'IT'
                   is_layout        = gs_layout
                   is_print         = gs_print
         CHANGING  it_outtab        = it[]
                   IT_FIELDCATALOG  = I_FLD[].&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;                         &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;If I change the call to use an existing table - then no error happens and all toolbar buttons work just fine:&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                 &amp;lt;u&amp;gt;     &amp;lt;b&amp;gt;  I build fieldcatalog:&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*----------------------------------------------------------------------*
* FORM fieldcat_init_flight.
*----------------------------------------------------------------------*

FORM fieldcat_init_flight.
  gs_layout-zebra = 'X'.
  gs_layout-cwidth_opt = 'X'.

  wa_fld-fieldname   = 'CARRID'.
  wa_fld-ref_table   = 'SFLIGHT'.
  wa_fld-coltext = 'Carrier'.
  APPEND WA_FLD TO I_FLD.

  wa_fld-fieldname   = 'CONNID'.
  wa_fld-ref_table   = 'SFLIGHT'.
  wa_fld-coltext = 'Connection'.
  APPEND WA_FLD TO I_FLD.

  wa_fld-fieldname   = 'FLDATE'.
  wa_fld-ref_table   = 'SFLIGHT'.
  wa_fld-coltext = 'Date'.
  APPEND WA_FLD TO I_FLD.

  wa_fld-fieldname   = 'PRICE'.
  wa_fld-ref_table   = 'SFLIGHT'.
  wa_fld-coltext = 'Price'.
  APPEND WA_FLD TO I_FLD.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                            &amp;lt;u&amp;gt; &amp;lt;b&amp;gt;  Then I call set_table_for_first_display:&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;   CALL METHOD GRID1-&amp;gt;SET_TABLE_FOR_FIRST_DISPLAY
         EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'
                   IS_PRINT         = GS_PRINT
                   IS_LAYOUT        = GS_LAYOUT
         CHANGING  IT_OUTTAB        = GT_SFLIGHT
                   IT_FIELDCATALOG  = I_FLD[].&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Please help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2007 20:37:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-on-toolbar-click-in-set-table-for-first-display/m-p/2010835#M410389</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-19T20:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Runtime error on Toolbar click  in set_table_for_first_display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-on-toolbar-click-in-set-table-for-first-display/m-p/2010836#M410390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Tatyana&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Most likely the &amp;lt;i&amp;gt;Print-Preview&amp;lt;/i&amp;gt; fails due to missing technical information in the fieldcatalog. Instead of building the fieldcatalog manually I would prefer to use the &amp;lt;b&amp;gt;function module&amp;lt;/b&amp;gt; in the following way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  REFRESH: gt_fcat.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name             = 'CDHDR'
*     I_CLIENT_NEVER_DISPLAY       = 'X'
    CHANGING
      ct_fieldcat                  = gt_fcat
    EXCEPTIONS
      inconsistent_interface       = 1
      program_error                = 2
      OTHERS                       = 3.
  IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  DELETE gt_fcat WHERE ( fieldname ne 'UDATE' ).


  REFRESH: gt_fcat.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name             = 'EBAN'
*     I_CLIENT_NEVER_DISPLAY       = 'X'
    CHANGING
      ct_fieldcat                  = gt_fcat
    EXCEPTIONS
      inconsistent_interface       = 1
      program_error                = 2
      OTHERS                       = 3.
  IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.  

  DELETE gt_fcat WHERE ( ref_table = 'EBAN' )
                          AND      ( fieldname ne 'BANFN'    AND
                                        fieldname ne 'BNFPO'    AND
                                        ... ).

" Finally, rearrange the fields if necessary
  READ TABLE gt_fcat INTO ls_fcat
            WITH KEY fieldname = 'UDATE'.
  IF ( syst-subrc = 0 ).
    DELETE gt_fcat INDEX syst-tabix.

   INSERT ls_fcat INTO gt_fcat INDEX 6.
  ENDIF.

" Renumbering of the columns
  LOOP AT gt_fcat INTO ls_fcat.
    ls_fcat-col_pos = syst-tabix.
    MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
  ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2007 03:57:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-on-toolbar-click-in-set-table-for-first-display/m-p/2010836#M410390</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-03-20T03:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Runtime error on Toolbar click  in set_table_for_first_display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-on-toolbar-click-in-set-table-for-first-display/m-p/2010837#M410391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i would suggest you to debug the program and check whether there is any variable which should not be declare as character.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2007 12:09:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-on-toolbar-click-in-set-table-for-first-display/m-p/2010837#M410391</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-20T12:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Runtime error on Toolbar click  in set_table_for_first_display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-on-toolbar-click-in-set-table-for-first-display/m-p/2010838#M410392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Uwe and Mrutyunjaya, thank you very much!&lt;/P&gt;&lt;P&gt;You helped me both.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what I came up with.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;#1.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prior to calling method 'SET_TABLE_FOR_FIRST_DISPLAY' the table catalog has to be built if the table is not defined in the data dictionary.&lt;/P&gt;&lt;P&gt;Obviously my internal table is NOT in the data dictionary. &lt;/P&gt;&lt;P&gt;My internal table IT is made of structure IT_LN.&lt;/P&gt;&lt;P&gt;The  structure IT_LN contains fields MENGE, PREIS and TOTVAL which are not CHAR,  NUMC or DATE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After "try and see" I noticed that after I remove those fields from the table - then clicking Print, Print Preview and Local file buttons  doesn't cause the program to blow up and everything is just fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So Print, Print Preview and Local file don't like NOT character fields when the catalog is NOT a default (meaning that you build the catalog yourself).   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;#2.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function  'FIELDCATALOG_MERGE'  is worth to use when the grid column headers comes from the data dictionary fields.  Correct me if I am wrong here. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Is there a documentation on CHARLIKE restriction? How to find names of the functions performing Print, Print Preview and Local file so I could to look up?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Tatyana.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2007 18:55:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-on-toolbar-click-in-set-table-for-first-display/m-p/2010838#M410392</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-20T18:55:00Z</dc:date>
    </item>
  </channel>
</rss>

