<?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: displaying negative nos. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010533#M78780</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure what the problem is,  in the above examples, the integar field WILL show a negative sign.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I missing something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Jul 2005 20:01:42 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2005-07-27T20:01:42Z</dc:date>
    <item>
      <title>displaying negative nos.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010529#M78776</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 am working on an ALV program which should show the no. of days as negative...if the due date is past the current date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instance if the due date is 07/26/2005, it should show 1-.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have declared the data as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;no_of_days_1 type I.&lt;/P&gt;&lt;P&gt;no_of_days_1_d(10) type C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my code: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;disc_d_date: gets calculated at run time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;no_of_days_1 = sy-datum - disc_d_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if no_of_days_1 &amp;lt; 0 .&lt;/P&gt;&lt;P&gt;concatenate&lt;/P&gt;&lt;P&gt;no_of_days_1_d '-' into&lt;/P&gt;&lt;P&gt;no_of_days_1_d.&lt;/P&gt;&lt;P&gt;condense no_of_days_1_d NO-GAPS.&lt;/P&gt;&lt;P&gt;shift no_of_days_1_d RIGHT&lt;/P&gt;&lt;P&gt;DELETING TRAILING space.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;no_of_days_1_d = no_of_days_1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem it appears, no_of_days_1_d being declared as I(integer), cannot store negative nos. A possible solution would be to create a data element with the sign checkbox ticked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would appreciate if anybody has a better solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rajib&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2005 19:08:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010529#M78776</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-27T19:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: displaying negative nos.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010530#M78777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, integers can have a negative value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check out the sample program,  pay attention to the IMARA-TESTF field.  This is all you need to do to show negative in your ALV grid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0004
       no standard page heading.

type-pools slis.

data: fieldcat type slis_t_fieldcat_alv.
data: sort     type slis_t_sortinfo_alv.

data: begin of imara occurs 0,
      matnr type mara-matnr,
      matkl type mara-matkl,
      labor type mara-labor,
      brgew type mara-brgew,
      maktx type makt-maktx,
&amp;lt;b&amp;gt;      testf type i,&amp;lt;/b&amp;gt;
      end of imara.

* Selection Screen
selection-screen begin of block b1 with frame title text-001 .
select-options: s_matnr for imara-matnr .
selection-screen end of block b1.

start-of-selection.

  perform get_data.
  perform write_report.

************************************************************************
*  Get_Data
************************************************************************
form get_data.

  select  mara~matnr mara~matkl mara~labor mara~brgew makt~maktx
            into corresponding fields of table imara
              from mara
               inner join makt
                 on mara~matnr = makt~matnr
                    where mara~matnr in s_matnr
                      and makt~spras = sy-langu.

&amp;lt;b&amp;gt;  loop at imara.
    imara-testf = sy-tabix * -1.
    modify imara.
  endloop.&amp;lt;/b&amp;gt;

endform.

************************************************************************
*  WRITE_REPORT
************************************************************************
form write_report.

  perform build_field_catalog.

* CALL ABAP LIST VIEWER (ALV)
  call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
            it_sort     = sort
            it_fieldcat = fieldcat
       tables
            t_outtab    = imara.

endform.

************************************************************************
* BUILD_FIELD_CATALOG
************************************************************************
form build_field_catalog.

  data: fc_tmp type slis_t_fieldcat_alv with header line.
  clear: fieldcat. refresh: fieldcat.

  clear: fc_tmp.
  fc_tmp-reptext_ddic    = 'Material Number'.
  fc_tmp-fieldname  = 'MATNR'.
  fc_tmp-tabname   = 'IMARA'.
  fc_tmp-outputlen  = '18'.
  fc_tmp-col_pos    = 2.
  append fc_tmp to fieldcat.

  clear: fc_tmp.
  fc_tmp-reptext_ddic    = 'Material Description'.
  fc_tmp-fieldname  = 'MAKTX'.
  fc_tmp-tabname   = 'IMARA'.
  fc_tmp-outputlen  = '40'.
  fc_tmp-col_pos    = 5.
  append fc_tmp to fieldcat.


&amp;lt;b&amp;gt;  clear: fc_tmp.
  fc_tmp-reptext_ddic    = 'Test Field'.
  fc_tmp-fieldname  = 'TESTF'.
  fc_tmp-tabname   = 'IMARA'.
  fc_tmp-outputlen  = '12'.
  fc_tmp-do_sum     = 'X'.
  fc_tmp-col_pos    = 4.
  append fc_tmp to fieldcat.&amp;lt;/b&amp;gt;
endform.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2005 19:38:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010530#M78777</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-07-27T19:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: displaying negative nos.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010531#M78778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So in your case,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0004.


data:

     no_of_days_1 type i,
     disc_d_date type sy-datum value '20051231'.


no_of_days_1 = sy-datum - disc_d_date.


write:/ no_of_days_1.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2005 19:42:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010531#M78778</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-07-27T19:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: displaying negative nos.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010532#M78779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is based on the date difference, the column has to show 1 or 1-(negative).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wouldn't it be better if I can define a data element as negative, something like AFRV-HRBET.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rajib&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2005 19:46:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010532#M78779</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-27T19:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: displaying negative nos.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010533#M78780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure what the problem is,  in the above examples, the integar field WILL show a negative sign.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I missing something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2005 20:01:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010533#M78780</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-07-27T20:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: displaying negative nos.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010534#M78781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what abt nos that are positive....for e.g if the due date is 07/28 and the current system date is 07/27...it should show 1 and if the due date is 07/26, it should show 1-.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i will try you suggestion tommorrow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rajib&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jul 2005 21:57:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010534#M78781</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-27T21:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: displaying negative nos.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010535#M78782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;value = sy-datum - due_date.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where due_date is 07/28/2005, value will be -1&lt;/P&gt;&lt;P&gt;where due_date is 07/26/2005, value will be 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need the sign(-) the other way around, just multiple by -1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;value = ( sy-datum - due_date ) * -1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or you can swich the fields around.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;value = due_date - sy-datum .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It really depends on what you want to see.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2005 00:32:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010535#M78782</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-07-28T00:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: displaying negative nos.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010536#M78783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried "value = due_date - sy-datum ." and it solved my problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Got pretty confused yesterday.....when I got a positive diffference between the current date and an earlier date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rajib&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jul 2005 11:48:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/displaying-negative-nos/m-p/1010536#M78783</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-28T11:48:16Z</dc:date>
    </item>
  </channel>
</rss>

