<?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: Insert internal table fieldname into itab in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-internal-table-fieldname-into-itab/m-p/2625614#M603279</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hardcoding it is the best option&lt;/P&gt;&lt;P&gt;second best option would be to generate a subroutine pool&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to do that you have to make a program in an internal table (you can easily put the fieldnames in that program by getting the names from REUSE_ALV_FIELDCATALOG_MERGE&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
" internal table declaration
  data: begin of gt_itab occurs 0,
    line(255) type c,
  end of gt_itab.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and after populating the internal table, use this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  data: gv_fname(30) type c value 'ZTEST_KRIS',   "program name
      gv_err(120) type c.                       "error variable

  generate subroutine pool gt_itab name gv_fname message gv_err.

  if sy-subrc eq 0.
    perform exec_sql in program (gv_fname) using it_mara
        if found.
    write:/ gv_err .
    clear gv_err.
  endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Aug 2007 02:59:53 GMT</pubDate>
    <dc:creator>former_member189059</dc:creator>
    <dc:date>2007-08-06T02:59:53Z</dc:date>
    <item>
      <title>Insert internal table fieldname into itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-internal-table-fieldname-into-itab/m-p/2625612#M603277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to download data into a textfile with the fieldname of an internal table as the header line. What would be the easiest way of doing that ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For eg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERNR     BEGDA    ENDDA        &amp;lt;-- is the Header&lt;/P&gt;&lt;P&gt;10000000  20070101  99991231     &amp;lt;-- is the data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried using :- Insert wa into itab index 1 but it insert a blank line instead of the fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone advice me ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p/s: i've search thru the forum but none i find it helpful for my case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Loo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 02:52:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-internal-table-fieldname-into-itab/m-p/2625612#M603277</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-06T02:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: Insert internal table fieldname into itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-internal-table-fieldname-into-itab/m-p/2625613#M603278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;    IT_HEADING-TEXT = 'Company Code'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'RFQ Number'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'RFQ Line Item'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'MO Number'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'MO Text'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'Material SVC Grp'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'PO Number'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'PO Line Item'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'RFQ Quantity'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'RFQ Unit'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'RFQ Amount'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'RFQ Currency'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'RFQ Platform'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'RFQ Equipment'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'PO Quantity'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'PO Unit'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'PO Amount'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'PO Currency'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'PO Platform'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'PO Equipment'.
    append IT_HEADING.

    move P_FNAME to L_FNAME.

    call function 'GUI_DOWNLOAD'
      exporting
        FILENAME                = L_FNAME
        FILETYPE                = 'DAT'
      tables
        DATA_TAB                = IT_FINAL
        FIELDNAMES              = IT_HEADING " HEADER to be passed here
      exceptions
        FILE_WRITE_ERROR        = 1
        NO_BATCH                = 2
        GUI_REFUSE_FILETRANSFER = 3
        INVALID_TYPE            = 4
        NO_AUTHORITY            = 5
        UNKNOWN_ERROR           = 6
        HEADER_NOT_ALLOWED      = 7
        SEPARATOR_NOT_ALLOWED   = 8
        FILESIZE_NOT_ALLOWED    = 9
        HEADER_TOO_LONG         = 10
        DP_ERROR_CREATE         = 11
        DP_ERROR_SEND           = 12
        DP_ERROR_WRITE          = 13
        UNKNOWN_DP_ERROR        = 14
        ACCESS_DENIED           = 15
        DP_OUT_OF_MEMORY        = 16
        DISK_FULL               = 17
        DP_TIMEOUT              = 18
        FILE_NOT_FOUND          = 19
        DATAPROVIDER_EXCEPTION  = 20
        CONTROL_FLUSH_ERROR     = 21
        others                  = 22.
    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.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gopi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 02:55:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-internal-table-fieldname-into-itab/m-p/2625613#M603278</guid>
      <dc:creator>gopi_narendra</dc:creator>
      <dc:date>2007-08-06T02:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Insert internal table fieldname into itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-internal-table-fieldname-into-itab/m-p/2625614#M603279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hardcoding it is the best option&lt;/P&gt;&lt;P&gt;second best option would be to generate a subroutine pool&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to do that you have to make a program in an internal table (you can easily put the fieldnames in that program by getting the names from REUSE_ALV_FIELDCATALOG_MERGE&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
" internal table declaration
  data: begin of gt_itab occurs 0,
    line(255) type c,
  end of gt_itab.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and after populating the internal table, use this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  data: gv_fname(30) type c value 'ZTEST_KRIS',   "program name
      gv_err(120) type c.                       "error variable

  generate subroutine pool gt_itab name gv_fname message gv_err.

  if sy-subrc eq 0.
    perform exec_sql in program (gv_fname) using it_mara
        if found.
    write:/ gv_err .
    clear gv_err.
  endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 02:59:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-internal-table-fieldname-into-itab/m-p/2625614#M603279</guid>
      <dc:creator>former_member189059</dc:creator>
      <dc:date>2007-08-06T02:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: Insert internal table fieldname into itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-internal-table-fieldname-into-itab/m-p/2625615#M603280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wouldn't want to hardcode the fieldname as i'll be downloading more than 1 file which doesn't seems to be the feasible way. &lt;SUP&gt;_&lt;/SUP&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any other way than using the subroutine and to grab the fieldname using this FM REUSE_ALV_FIELDCATALOG_MERGE??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Loo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 03:17:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-internal-table-fieldname-into-itab/m-p/2625615#M603280</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-06T03:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: Insert internal table fieldname into itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-internal-table-fieldname-into-itab/m-p/2625616#M603281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nothing else that i know of&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 03:20:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-internal-table-fieldname-into-itab/m-p/2625616#M603281</guid>
      <dc:creator>former_member189059</dc:creator>
      <dc:date>2007-08-06T03:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: Insert internal table fieldname into itab</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-internal-table-fieldname-into-itab/m-p/2625617#M603282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use the fn module GET_COMPONENT_LIST&lt;/P&gt;&lt;P&gt;DATA : IRSTRUCINFO LIKE RSTRUCINFO OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'GET_COMPONENT_LIST'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    PROGRAM    = sy-repid&lt;/P&gt;&lt;P&gt;    FIELDNAME  = 'ITAB' "INT_TABNAME&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    COMPONENTS = IRSTRUCINFO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now pass the irstrucinfo to gui_download.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;shiba dutta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 03:23:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-internal-table-fieldname-into-itab/m-p/2625617#M603282</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-06T03:23:45Z</dc:date>
    </item>
  </channel>
</rss>

