Skip to Content
avatar image
Former Member

How To Display Minus value in SAP SCript

Hello Guys.

I am working on a Script. My Problem is that For a fields BSAD-DMBTR.

I have to show this fields value as minus or plus as per condition with fields

<b>bsad-shkzg</b>. In my Internal table it's update as minus but when I am calling Write form with loop. the value is not display with minus sign.

How can I display value with minus sign in SAP script.

Regards

Swati,,

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Apr 17, 2007 at 08:32 AM

    Hi,

    Based on the condition ..like Credit or debit ...

    Mutliply the amount field by -1 ..like itab-dmbtr = itab-dmbtr * -1

    Reward points if it is useful".

    Thanks,

    Manjunath MS

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 17, 2007 at 08:46 AM

    Hi,

    U have to check this in the script itself...

    Just based on the credit and debit indicator u can multiply with (* -1).

    wherever u want..

    Hope this helps...

    Cheers,

    Simha.

    Reward all the helpful answers...

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Guys..

      Thanks for Reply. But I am doing that thing already. My Internal table is updated with minus value. My Problem is not That.

      let's suppose.

      itab-name = 'xyz'.

      itab-value = 100.

      append itab.

      itab-name = 'xyz1'.

      itab-value = -1 * 100.

      append itab.

      loop at itab.

      CALL FUNCTION 'WRITE_FORM'

      EXPORTING

      element = 'LINE'

      function = 'SET'

      type = 'BODY'

      window = 'MAIN'

      EXCEPTIONS

      element = 1

      function = 2

      type = 3

      unopened = 4

      unstarted = 5

      window = 6

      bad_pageformat_for_print = 7

      spool_error = 8

      codepage = 9

      OTHERS = 10.

      IF sy-subrc <> 0.

      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      ENDIF.

      endloop.

      Now when value is printed in SAP Script both value is display as plus .I want to display secound value as minus.

      Please reply it's urgent.

      Thanks

      Swati....

  • avatar image
    Former Member
    Apr 17, 2007 at 10:03 AM

    Hello Guys.

    I got the Answer. In SAP SCript I have change like .

    if Shkg = 'H'.

    &Wa_dmbtr&(-)

    else.

    endif.

    This Way my Problem is solved.

    Add comment
    10|10000 characters needed characters exceeded