<?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: Dynamic internal table or structure field type change dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436987#M1551155</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guillaume,&lt;/P&gt;&lt;P&gt;&amp;lt;li&amp;gt;The below code works fine. What I want is that after downloading, I must see preceding zeros for the PERNR field.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZTEST_PROGRAM.
 DATA: GV_DREF TYPE REF TO DATA,
       GW_DREF TYPE REF TO DATA.
*FIELD-SYMBOLS
 FIELD-SYMBOLS: &amp;lt;IT_DATA&amp;gt; TYPE STANDARD TABLE,
                &amp;lt;WA_DATA&amp;gt; TYPE ANY.
 PARAMETERS:P_TABLE TYPE RSRD1-TBMA_VAL default 'PA0001'.
*" START-OF-SELECTION
 START-OF-SELECTION.

   CREATE DATA GV_DREF TYPE TABLE OF (P_TABLE).
   ASSIGN GV_DREF-&amp;gt;* TO &amp;lt;IT_DATA&amp;gt;.

   CREATE DATA GW_DREF LIKE LINE OF &amp;lt;IT_DATA&amp;gt;.
   ASSIGN GW_DREF-&amp;gt;* TO &amp;lt;WA_DATA&amp;gt;.

   SELECT * FROM (P_TABLE) INTO TABLE &amp;lt;IT_DATA&amp;gt;  UP TO 10 ROWS.

   CALL FUNCTION 'GUI_DOWNLOAD'
     EXPORTING
       FILENAME = 'C:\temp\test.txt'
       FILETYPE = 'ASC'
     TABLES
       DATA_TAB = &amp;lt;IT_DATA&amp;gt;.
   IF SY-SUBRC = 0.
     WRITE 'successfully downloaded'.
   ENDIF&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Venkat.O&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Nov 2010 16:54:41 GMT</pubDate>
    <dc:creator>venkat_o</dc:creator>
    <dc:date>2010-11-22T16:54:41Z</dc:date>
    <item>
      <title>Dynamic internal table or structure field type change dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436985#M1551153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;&amp;lt;li&amp;gt;I am creating dynamic internal table based  on the table given on the Selection-screen input parameter.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;PARAMETERS:P_TABLE TYPE RSRD1-TBMA_VAL.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;lt;li&amp;gt;Creating dynamic internal table and dynamic structure like below&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CREATE DATA GV_DREF TYPE TABLE OF (P_TABLE).
   ASSIGN GV_DREF-&amp;gt;* TO &amp;lt;IT_DATA&amp;gt;.

   CREATE DATA GW_DREF LIKE LINE OF &amp;lt;IT_DATA&amp;gt;.
   ASSIGN GW_DREF-&amp;gt;* TO &amp;lt;WA_DATA&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Question&lt;/STRONG&gt;:&lt;/EM&gt; &lt;/P&gt;&lt;P&gt;Can I change dynamically created internal table field type to C(char) type ? &lt;/P&gt;&lt;P&gt;or &lt;/P&gt;&lt;P&gt;Actually I am developing generic program to download Infotype table table data. After creating dynamic table, is there any way to keep preceding Zeros to Employee number when you download to XLS file.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Venkat.O&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Nov 2010 16:27:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436985#M1551153</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2010-11-22T16:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic internal table or structure field type change dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436986#M1551154</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;Try adding simple quoite (') in front of numeric fields.&lt;/P&gt;&lt;P&gt;Haven't tried it yet but did you try ABAP2XLSX ?&lt;/P&gt;&lt;P&gt;/people/community.user/blog/2010/07/12/abap2xlsx--generate-your-professional-excel-spreadsheet-from-abap&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Guillaume&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Nov 2010 16:33:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436986#M1551154</guid>
      <dc:creator>guillaume-hrc</dc:creator>
      <dc:date>2010-11-22T16:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic internal table or structure field type change dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436987#M1551155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guillaume,&lt;/P&gt;&lt;P&gt;&amp;lt;li&amp;gt;The below code works fine. What I want is that after downloading, I must see preceding zeros for the PERNR field.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ZTEST_PROGRAM.
 DATA: GV_DREF TYPE REF TO DATA,
       GW_DREF TYPE REF TO DATA.
*FIELD-SYMBOLS
 FIELD-SYMBOLS: &amp;lt;IT_DATA&amp;gt; TYPE STANDARD TABLE,
                &amp;lt;WA_DATA&amp;gt; TYPE ANY.
 PARAMETERS:P_TABLE TYPE RSRD1-TBMA_VAL default 'PA0001'.
*" START-OF-SELECTION
 START-OF-SELECTION.

   CREATE DATA GV_DREF TYPE TABLE OF (P_TABLE).
   ASSIGN GV_DREF-&amp;gt;* TO &amp;lt;IT_DATA&amp;gt;.

   CREATE DATA GW_DREF LIKE LINE OF &amp;lt;IT_DATA&amp;gt;.
   ASSIGN GW_DREF-&amp;gt;* TO &amp;lt;WA_DATA&amp;gt;.

   SELECT * FROM (P_TABLE) INTO TABLE &amp;lt;IT_DATA&amp;gt;  UP TO 10 ROWS.

   CALL FUNCTION 'GUI_DOWNLOAD'
     EXPORTING
       FILENAME = 'C:\temp\test.txt'
       FILETYPE = 'ASC'
     TABLES
       DATA_TAB = &amp;lt;IT_DATA&amp;gt;.
   IF SY-SUBRC = 0.
     WRITE 'successfully downloaded'.
   ENDIF&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Venkat.O&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Nov 2010 16:54:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436987#M1551155</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2010-11-22T16:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic internal table or structure field type change dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436988#M1551156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't do HR so I can't see the field definition you refer to, but the format you're asking for should be automatic if it's stored that way in the DB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After creating dynamic table, is there any way to keep preceding Zeros to Employee number when you download to XLS file. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, you are not creating an XLS file, given the code that you showed; you are creating a fixed-width text file and the field formatiing should not change from the selected record to the downloaded record.  How are you viewing the file after download?  Are you forcing a field conversion during opening?  What does Notepad show?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Nov 2010 17:56:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436988#M1551156</guid>
      <dc:creator>brad_bohn</dc:creator>
      <dc:date>2010-11-22T17:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic internal table or structure field type change dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436989#M1551157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;   I think you can create a fieldcatalog first using the table name &lt;/P&gt;&lt;P&gt;then change the datatype to 'C' from 'N' for the required fields.&lt;/P&gt;&lt;P&gt;You can then create your internal table using same fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the below code for the reference,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      I_STRUCTURE_NAME       = TABLENM
      I_CLIENT_NEVER_DISPLAY = 'X'
    CHANGING
      CT_FIELDCAT            = T_FCAT_LVC.
*changes to fcat as required

 CALL METHOD CL_ALV_TABLE_CREATE=&amp;gt;CREATE_DYNAMIC_TABLE
      EXPORTING

         IT_FIELDCATALOG           = T_FCAT
       IMPORTING
         EP_TABLE                  = DY_TABLE
             .
     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;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Anmol Bhat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Nov 2010 17:58:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436989#M1551157</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-11-22T17:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic internal table or structure field type change dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436990#M1551158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&amp;lt;li&amp;gt;Small correction&lt;/P&gt;&lt;P&gt; Changing file path &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;'C:\temp\test.txt'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;to &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;'C:\temp\test.xls'&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Venkat.O&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Nov 2010 02:12:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436990#M1551158</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2010-11-23T02:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic internal table or structure field type change dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436991#M1551159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anmol, &lt;/P&gt;&lt;P&gt;&amp;lt;li&amp;gt; &lt;STRONG&gt;CL_ALV_TABLE_CREATE=&amp;gt;CREATE_DYNAMIC_TABLE&lt;/STRONG&gt; has length restiction I believe.&lt;/P&gt;&lt;P&gt;Any how it does not serve my problem. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Venkat.O&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Venkat.O on Nov 23, 2010 10:56 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Nov 2010 02:56:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436991#M1551159</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2010-11-23T02:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic internal table or structure field type change dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436992#M1551160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u2022Small correction&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That 'small correction' makes a huge difference in the question...since you have specified 'XLS' then Excel has assumed the field is numeric and dropped the leading zeros.  Use RTTI to read the field definitions and format the cells accordingly before a binary download.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Nov 2010 14:27:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-or-structure-field-type-change-dynamically/m-p/7436992#M1551160</guid>
      <dc:creator>brad_bohn</dc:creator>
      <dc:date>2010-11-23T14:27:58Z</dc:date>
    </item>
  </channel>
</rss>

