<?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: PACK statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/pack-statement/m-p/2481692#M559237</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;   PACK statement converts the content of the data object source to the data type p of length 16 without decimal places.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unpacks the packed field f and places it in the field g with leading zeros. If g is too short, it is truncated on the left. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;DATA: P_FIELD(2) TYPE P VALUE 103, &lt;/P&gt;&lt;P&gt;C_FIELD(4) TYPE C. &lt;/P&gt;&lt;P&gt;UNPACK P_FIELD TO C_FIELD. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE: / C_FIELD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward points&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jun 2007 06:21:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-21T06:21:21Z</dc:date>
    <item>
      <title>PACK statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pack-statement/m-p/2481691#M559236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can anyone brief me the answers for these questions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. What is the use of the PACK and UNPACK statement.&lt;/P&gt;&lt;P&gt;2. If i say a character is packed what does it means?&lt;/P&gt;&lt;P&gt;3. If i say a characted is unpacked what does it mean?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Phyrose.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 06:18:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pack-statement/m-p/2481691#M559236</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T06:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: PACK statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pack-statement/m-p/2481692#M559237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;   PACK statement converts the content of the data object source to the data type p of length 16 without decimal places.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unpacks the packed field f and places it in the field g with leading zeros. If g is too short, it is truncated on the left. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;DATA: P_FIELD(2) TYPE P VALUE 103, &lt;/P&gt;&lt;P&gt;C_FIELD(4) TYPE C. &lt;/P&gt;&lt;P&gt;UNPACK P_FIELD TO C_FIELD. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE: / C_FIELD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward points&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 06:21:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pack-statement/m-p/2481692#M559237</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T06:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: PACK statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pack-statement/m-p/2481693#M559238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pack&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/pack.htm" target="test_blank"&gt;http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/pack.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA C_FIELD(4) TYPE C VALUE '0103',&lt;/P&gt;&lt;P&gt;     P_FIELD(2) TYPE P.&lt;/P&gt;&lt;P&gt;PACK C_FIELD TO P_FIELD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unpack&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/unpack.htm" target="test_blank"&gt;http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/unpack.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: P_FIELD(2) TYPE P VALUE 103,&lt;/P&gt;&lt;P&gt;      C_FIELD(4) TYPE C.&lt;/P&gt;&lt;P&gt;UNPACK P_FIELD TO C_FIELD.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 06:26:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pack-statement/m-p/2481693#M559238</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T06:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: PACK statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pack-statement/m-p/2481694#M559239</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;Packing means you are deleting the leading zeros.Unpacking means you are adding leading zeros according to character's width.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 06:29:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pack-statement/m-p/2481694#M559239</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2007-06-21T06:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: PACK statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pack-statement/m-p/2481695#M559240</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;PACK source TO destination. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement, which is forbidden in classes, converts the content of the data object source to the data type p of length 16 without decimal places. Decimal separator in source is ignored. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data type of source must be character-type, flat, and its content must be interpretable as a numeric value. The data type of destination must be flat. If destination has the data type p, the interim result is assigned to it from left to right. Surplus characters are cut off on the left, and the decimal places are determined by the data type of destination. If destination does not have the data type p, the interim result is converted to the data type of destination according to the rules in the conversion table for source field type p. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function of the statement PACK is based on the second half-byte of the code corresponding to a character in most character representations of the BCD representation for the corresponding numeric value. This compilation is generally known as "packing". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the source field contains a number without a decimal separator, and the target field has dobj2 of data type p with sufficient length and without decimal places, the result of the PACK statement (which is forbidden in classes) corresponds to the result of the statement MOVE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UNPACK f TO g. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;Unpacks the packed field f and places it in the field g with leading zeros. If g is too short, it is truncated on the left. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg&lt;/P&gt;&lt;P&gt;data: v_matnr like mara-matnr, &lt;/P&gt;&lt;P&gt;c_test(10) value '1234'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;unpack c_test to v_matnr. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;v_matnr now contains 000000000000001234 .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 06:29:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pack-statement/m-p/2481695#M559240</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T06:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: PACK statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pack-statement/m-p/2481696#M559241</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;PACK &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basic form&lt;/P&gt;&lt;P&gt;PACK f TO g. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;Places the character field f in packed format in the field g . Reverse of the UNPACK command. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA C_FIELD(4) TYPE C VALUE '0103',&lt;/P&gt;&lt;P&gt;     P_FIELD(2) TYPE P.&lt;/P&gt;&lt;P&gt;PACK C_FIELD TO P_FIELD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C_FIELD: C'0103' --&amp;gt; P_FIELD: P'103C' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note&lt;/P&gt;&lt;P&gt;The field f can contain up to 16 characters. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=================================================&lt;/P&gt;&lt;P&gt;UNPACK &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basic form&lt;/P&gt;&lt;P&gt;UNPACK f TO g. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;Unpacks the packed field f and places it in the field g with leading zeros. If g is too short, it is truncated on the left. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: P_FIELD(2) TYPE P VALUE 103,&lt;/P&gt;&lt;P&gt;      C_FIELD(4) TYPE C.&lt;/P&gt;&lt;P&gt;UNPACK P_FIELD TO C_FIELD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P_FIELD: P'103C' --&amp;gt; C_FIELD: C'0103' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes&lt;/P&gt;&lt;P&gt;If f is not type P , it is converted to type P (see MOVE ). &lt;/P&gt;&lt;P&gt;g should always be type C . Otherwise, unwanted side effects may occur. &lt;/P&gt;&lt;P&gt;The sign in the packed number is ignored. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't forget to reward if useful....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 06:36:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pack-statement/m-p/2481696#M559241</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T06:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: PACK statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pack-statement/m-p/2481697#M559242</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;You can use PACK keyword which Converts type C variables to type P.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PACK &amp;lt;f&amp;gt; TO &amp;lt;g&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Packs the string &amp;lt;f&amp;gt; and places it in the field &amp;lt;g&amp;gt;. This can be reversed with the UNPACK statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: PACK TYPE P DECIMALS 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PACK = '12345'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE PACK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;123.45&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Padmam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 06:36:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pack-statement/m-p/2481697#M559242</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T06:36:42Z</dc:date>
    </item>
  </channel>
</rss>

