<?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 Data type doubled on dynamic table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058215#M1353583</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm creating a Z program to insert data to any Z table created, for that, the user must put the name of the Z table and the path of the file with all data to be inserted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that on dynamic table creation the datatype of the fields are doubled, I.E.: if the datatype is N length 3, it's coming as N length 6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know to solve this issue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Sep 2009 14:46:56 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-09-02T14:46:56Z</dc:date>
    <item>
      <title>Data type doubled on dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058215#M1353583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm creating a Z program to insert data to any Z table created, for that, the user must put the name of the Z table and the path of the file with all data to be inserted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that on dynamic table creation the datatype of the fields are doubled, I.E.: if the datatype is N length 3, it's coming as N length 6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know to solve this issue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Sep 2009 14:46:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058215#M1353583</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-02T14:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: Data type doubled on dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058216#M1353584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hard to guess without knowing how you are doing this exactly.&lt;/P&gt;&lt;P&gt;So how are you doing this exactly? &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Sep 2009 15:52:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058216#M1353584</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2009-09-02T15:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Data type doubled on dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058217#M1353585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Thomas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sorry, I wasn't very clear, actually the problem is on "Intlen" field which it comes doubled in the table I'm using, here's a piece of code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : t_details type abap_compdescr_tab,&lt;/P&gt;&lt;P&gt;        wa_details type abap_compdescr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; data : ref_table_des type ref to cl_abap_structdescr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the structure of the table.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ref_table_des ?=&lt;/P&gt;&lt;P&gt;      cl_abap_typedescr=&amp;gt;describe_by_name( p_table ).&lt;/P&gt;&lt;P&gt;  t_details[] = ref_table_des-&amp;gt;components[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at t_details into wa_details.&lt;/P&gt;&lt;P&gt;    clear wa_fc.&lt;/P&gt;&lt;P&gt;    wa_fc-fieldname = wa_details-name .&lt;/P&gt;&lt;P&gt;    wa_fc-datatype = wa_details-type_kind.&lt;/P&gt;&lt;P&gt;    wa_fc-inttype = wa_details-type_kind.&lt;/P&gt;&lt;P&gt;    wa_fc-intlen = wa_details-length. "here, if the intlen on my Z table is 3, here comes as 6&lt;/P&gt;&lt;P&gt;    wa_fc-decimals = wa_details-decimals.&lt;/P&gt;&lt;P&gt;    append wa_fc to t_fc.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;on my selection-screen I put a parameter to get the path of the file with all the data to be inserted on the Z table and another one so the user can input the name of the Z table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's a simple program to insert values to any Z table created on system, my problem, as described above is that I'm creating the internal table dynamicly and the method I'm using it's bringing a table with the data field intlen doubled. I'd just like to know why this happen, because it shouldn't, right? And as it does, i get an error while inserting fields on my Z table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually I know how to overcome this problem, in this case, I can make a division by 2 with this field and modify my table, but I don't think this field should come this way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Sep 2009 12:13:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058217#M1353585</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-03T12:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Data type doubled on dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058218#M1353586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was looking for a resolution of this same problem. It seems the intlen is expressed in number of bytes, and thus it is doubled in UTF-16 (unicode) systems. So you have to divide by 2 (instead, use cl_abap_char_utilities=&amp;gt;charsize which is the number of bytes per character).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am wondering if there is a standard function module or a method which does that... (because there are many other field types to check too)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2009 14:48:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058218#M1353586</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2009-09-28T14:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Data type doubled on dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058219#M1353587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sandra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your answer. You got the point, I just wanted to know the reason why it came doubled and i did what you said: just divided by 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you find any standard method, please let us know!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2009 14:54:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058219#M1353587</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-28T14:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Data type doubled on dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058220#M1353588</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;Just Sandra said it's a unicode problem (I suppose your system is unicode).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the structure, so table, u need to create is defined in the dictionary, u can get the fields characteristics using the fm DDIF_FIELDINFO_GET, instead of the method cl_abap_typedescr=&amp;gt;describe_by_name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2009 15:02:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058220#M1353588</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-28T15:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: Data type doubled on dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058221#M1353589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I "give up". I have just found method CL_UG_MD_FIELDNAME=&amp;gt;CONVERT_INTLEN_TO_LENG supplied in FIN_BASIS component, but it requires DDIC type. I have migrated it to the following routine so that we can use the internal type. Examples: C 510 -&amp;gt; 255 (unicode), F -&amp;gt; 16, etc. I don't know if it works yet. I will test it in my program later. Note: I don't use the ALV, I just need the length like given in DDIC.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FORM convert_intlen_to_leng
      USING
        I_INTTYPE       TYPE INTTYPE
        I_INTLEN        TYPE numeric "bytes
      CHANGING
        R_LENG          TYPE numeric "DDIC
        NOT_CALCULABLE  TYPE flag.
  CASE i_inttype.
    WHEN 'C' OR 'N'.
      IF i_intlen IS INITIAL. not_calculable = 'X'. EXIT. ENDIF.
      r_leng = i_intlen / cl_abap_char_utilities=&amp;gt;charsize.
    WHEN 'P'.
      IF i_intlen IS INITIAL. not_calculable = 'X'. EXIT. ENDIF.
      r_leng = i_intlen * 2 - 1.
    WHEN 'D'.
      r_leng = '8'.
    WHEN 'F'.
      r_leng = '16'.
    WHEN 'b'.
      r_leng = '3'.
    WHEN 's'.
      r_leng = '5'.
    WHEN 'I'.
      r_leng = '10'.
    WHEN 'X'.
      IF i_intlen IS INITIAL. not_calculable = 'X'. EXIT. ENDIF.
      r_leng = i_intlen.
    WHEN 'l' OR 'r'.
      r_leng = '0'.
    WHEN 'y'.
      r_leng = '0'.
    WHEN 'g'.
      r_leng = '0'.
    WHEN 'T'.
      r_leng = '6'.
    WHEN OTHERS.
      not_calculable = 'X'. EXIT.
  ENDCASE.
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2009 16:36:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058221#M1353589</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2009-09-28T16:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Data type doubled on dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058222#M1353590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes Max, my system is unicode&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your answer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2009 16:50:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058222#M1353590</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-28T16:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Data type doubled on dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058223#M1353591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks once again for your time Sandra....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Later I'll try to use it too!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2009 16:52:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058223#M1353591</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-28T16:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Data type doubled on dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058224#M1353592</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;Just as I said, if u need to create a table like a dictionary table u can use the standard fm DDIF_FIELDINFO_GET in order to get the informations, so it doesn't need to calculate the real size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My system is unicode too, and I used the fm above to create dynamically a structure based on dictionary definition:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; LOOP AT VAKE_DFIES_TAB INTO DFIES WHERE FIELDNAME &amp;lt;&amp;gt; 'KFRST' AND
                                          FIELDNAME &amp;lt;&amp;gt; 'KBSTAT'.
    COMPONENT-NAME = DFIES-FIELDNAME.

    MOVE DFIES-LENG     TO _LEN.
    MOVE DFIES-DECIMALS TO _DEC.

    CASE DFIES-DATATYPE.
      WHEN 'CHAR' OR 'LANG' OR 'CUKY'.
        MOVE CL_ABAP_ELEMDESCR=&amp;gt;GET_C( P_LENGTH = _LEN )
                                                      TO LR_VALUE_DESCR.
      WHEN 'NUMC'.
        MOVE CL_ABAP_ELEMDESCR=&amp;gt;GET_N( P_LENGTH = _LEN )
                                                      TO LR_VALUE_DESCR.
      WHEN 'INT1' OR 'INT2' OR 'INT4'.
        MOVE CL_ABAP_ELEMDESCR=&amp;gt;GET_I( ) TO LR_VALUE_DESCR.
      WHEN 'DATE'.
        MOVE CL_ABAP_ELEMDESCR=&amp;gt;GET_D( ) TO LR_VALUE_DESCR.
      WHEN 'DEC' OR 'CURR'.
        MOVE CL_ABAP_ELEMDESCR=&amp;gt;GET_P( P_LENGTH   = _LEN
                                       P_DECIMALS = _DEC )
                                                      TO LR_VALUE_DESCR.
      WHEN 'TIME'.
        MOVE  CL_ABAP_ELEMDESCR=&amp;gt;GET_T( ) TO LR_VALUE_DESCR.
      WHEN 'UDEF'.
    ENDCASE.

    COMPONENT-TYPE = LR_VALUE_DESCR.
    INSERT COMPONENT INTO TABLE LT_COMPONENTS.
  ENDLOOP.
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    PERFORM RAISE_ERROR USING 'C'.
  ENDIF.
* Creazione struttura chiave
  LR_STRUCT_DESCR
        = CL_ABAP_STRUCTDESCR=&amp;gt;CREATE( P_COMPONENTS = LT_COMPONENTS
                                       P_STRICT     = 'X' ).

  CREATE DATA DYN_VAKEY TYPE HANDLE LR_STRUCT_DESCR.
  ASSIGN DYN_VAKEY-&amp;gt;* TO &amp;lt;FS_VAKEY&amp;gt;. &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2009 16:58:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058224#M1353592</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-28T16:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Data type doubled on dynamic table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058225#M1353593</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;Anyway u can use the value from attribute CL_ABAP_CHAR_UTILITIES=&amp;gt;CHARSIZE in order to know how many bytes are for a CHAR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write CL_ABAP_CHAR_UTILITIES=&amp;gt;CHARSIZE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2009 17:10:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/data-type-doubled-on-dynamic-table/m-p/6058225#M1353593</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-28T17:10:19Z</dc:date>
    </item>
  </channel>
</rss>

