Negative sign for Values

Hi Experts,
   I am woking on BW and know some ABAP.
  While i am feching data from table i am getting value as Ex: 100-(negative), but i want to show this as -100. I am downloading data into flat file, not for display.
Data i am getting now:
Mat Customer Value Qty
M100 C100    100-  10-
But i want to show this as below.
Mat Customer Value Qty
M100 C100    -100  -10
I am not expert in ABAP, plese give some suggitions or  sample coding(if possible).
Thank you a lot.
Srini

hi srini,
just find if the value is negative..
data : char(20).
data : val type i.
  val = val - 50.
if val < 0.
   write val to char.
   concatenate '-' char into char .
   condense char no-gaps.
endif.
write : / char.
regards
satesh

Similar Messages

  • Negative sign for DMBTR field in ALV output

    Hi Experts,
    Before posting I have searched for more than 3 hours in the forums to get a solution for this.
    I did not get any solution so I am posting this problem which I need to resolve.
    I have to display the DMBTR field in ALV output for which a grand total will have to be displayed.
    Here for all the values in DMBTR which are negative are getting displayed as '-        6673.56','-       289956.23' as I am using the edit mask 'V_____________.__'.
    I have to get the value shown as '-6673.56', '-289956.23'.
    I tried to use convert this DMBTR to String and have successfully displayed the negative sign correctly in front of the value but I am not getting the totals which I need to have
    PLease check and suggest for a solution.
    Regards
    Kishore

    Hi,
      If this is the case, then you can use character field to display the sign on the left. Sum up the total and use the event end of list to display the same. Remember to set the TECH and NO_OUT in the field catalog.
    Hope this helps.
    Regards,
    Siva

  • Negative Sign for Asset G/L Account balance

    hi
       I m having one problem....I created the sales invoice for a customer "ABC" of total INR 63000.00 and when the customer paid the amount for that invoice thru "Cheque" .Banking -
    >Incoming Payments and i selected the BP code "ABC" and the invoice related to him get displayed and i choose the related invoice and went to "Payment Means" -
    >"Check" tab
          G/L Account -
    > 124563 ( Initially this account balance is 0.00)
      I entered all the Cheque details and its amount and added that incoming payment.
        After adding when i check the account balance 124563 its showing the balance as -63000.00 , the amount is shown in negative sign
        Company Details
          Display Credit Balance with Negative Sign is unchecked
       Please anyone help me out in making the balance with positive sign
    Edited by: Rajeswari Palaniyappan on Nov 25, 2008 10:00 AM

    Hi Rajeswari
    This is a common error that consultants make when implementing SAP Business One. There is no quick fix for this and the best is to create a new database and re-import all the transactions and masters. Make sure this time that the Display Credit Balance with Negative Sign is ticked.
    Unfortunately this one tick affects the way amounts are posted to the journal tables & others and cannot be fixed manually. You could try raising a support message with SAP but I am sure they will tell you the same thing I have.
    Kind regards
    Peter Juby

  • Negative sign for Currency fields

    Hello experts,
    If a currency field containt -Ve sign (86.47-) then, i have to move it this sign to Left sinde. I have do this as follow by moving the currency field value to Charractor field
    DATA:  w_total1 (18).
                 MOVE w_total To w_total1.
                 IF w_total1 CA '-'.
                   SHIFT w_total1 RIGHT CIRCULAR.
                 ENDIF.
                 CONDENSE w_total1 NO-GAPS.
    But don't want to move this to Chanddacter field for other pupepose. Now how can i **** the -Ve sign to left side for currency field, IF bsid-shkzg EQ 'H'.
    Thanks.

    Hi sandhya ,
    Try this :
    DATA:  w_total type string ,
          w_total1 type string.
    w_total = '1,4567.7-'.
                 MOVE w_total To w_total1.
                 IF w_total1 CA '-'.
                   SHIFT w_total1 RIGHT CIRCULAR.
                 ENDIF.
    *             CONDENSE w_total1 NO-GAPS.
                 write : / w_total1.
    Hope all your issues are fixed now .
    Regards ,
    lokesh
    Edited by: Lokesh Pattnayak on Oct 11, 2010 10:23 AM

  • Printing value fields with negative sign??

    Hello Experts,
    I have developed a interface, which writes the invoice data to application server/unix, this is a notepad. My specifications are as below,
    MWSK1(2)   TaxCode                         65     2     KONV-MWSK1     
    KWERT(13)  Condition Value                  67     13   KONV-KWERT     
    KSTEU(1)  Condition Control                80     1     KONV-KSTE
    I have to print KWERT value from 67th position until 13 positions, meaning until 80 positions, fine. My code is as below,
      MOVE: wa_invoice_price-mwsk1  TO unix_file+64(2).
      WRITE: wa_invoice_price-kwert    TO unix_file+66(13) RIGHT-JUSTIFIED.
      MOVE:  wa_invoice_price-ksteu    TO unix_file+79(1),
    So, it printing like below (pls. note 0.04 minus value in right bottom corner)
    P26701ZCG620101006C          100.00         0.00USD  1    UGL            0.00A A 9
    P60001ZF3520101006C          100.00         0.00USD  1    UGLG          0.04-H B 9
    But, business want to have like below (pls. note the DIFFERENCE for 0.04 minus value in right bottom corner),
    P26701ZCG620101006C         100.00        0.00USD  1    UGL               0.00   A A 9
    P60001ZF3520101006C         100.00         0.00USD  1    UGLG             0.04 - H B 9
    meaning, the 13th position should be negative sign (if at all any value does have a negative sign, else its normal)....so, the negative sign should sit on 13th postion. As am using WRITE statement with RIGHT JUSTIFIED am facing thisissue!! as u know we can not send a 'P' type value to unix/apps server, pls. let me know how to get it done?
    Thank you

    why can't the user live with a leading sign, like '-   0.04'?  If possible, do
    shift <fieldname> circular up to '-'.
    Or, if value is less than zero, set another variable to '-', else set to space, and multiply value with '-1', like:
    if <field> < 0.
       lv_sign = '-'.                " neagtive value
      <field> = <field> * '-1'.  "reverse the sign
    else.
    lv_sign = space.          "positive value
    endif.
    then, adjust your field length and insert a sign column or simply add a column for the sign....

  • Transferring the negative sign from Right to Left for a currency field.

    Hi All,
    I am trying to transfer the negative sign in a currency field from right to left but in doing that i am not getting the comma seperators of the currency field.
    For eg : If the value is 12,345,678.00- then after converting it i am getting it as
    -12345678.00 and i am loosing the commas.
    I am trying to transfer the negative sign by first converting the currency field into character field.
    Kindly help for the same.
    Thanks,
    Sharadendu

    Hi,
    Use FM CLOI_PUT_SIGN_IN_FRONT.
    Try this code as well
    data: var(10),
    length type i.
    var = '300-'.
    write var.
    length = strlen( var ).
    length = length - 1.
    replace first occurrence of '-' in var+length(1) with ''.
    concatenate '-' var into var.
    write:/ var.
    Regards,
    Satish
    Message was edited by:
            Satish Panakala

  • Negative Sign in the front for amount

    Hi Friends,
    i am facing problem in negative sign
    while using fm : cloi_put_sign_in_front which accepts char variable.
    In my report amount type is char15 and here negative sign appears after using this fm but when i download this data in one other char structure DATA: BEGIN OF itab_proextract OCCURS 0,
            line(502) TYPE c,
          END OF itab_proextract.
    Amount is right justified always..but afterusing this amount gets displayed in left due to this my other variable which are getting downloded after amount comes as concatenated for ex...
    Before :
    00102384NALCUS/406FED      00AX          4.26-         5126.84-
    After
    00102384NALCUS/406FED      00AX-4.26           -5126.84
    Please help me....

    Hi,
      You can reer to the following links:
    negative sign in front.
    negative sign before amount in report display(urgent)
    or
    try this code
    data : l_amt(15) value '435.46-'.
    CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
           CHANGING
                VALUE = l_amt.
    write : l_amt.
    or
    you can try this :
    DATA : BEGIN OF IG_DOWNLOAD OCCURS 0,
    F1(4),
    F2(4),
    F3 TYPE DMBTR,
    F4 TYPE I,
    F5 TYPE NETPR,
    F6,
    END OF IG_DOWNLOAD.
    DATA : BEGIN OF IG_DOWNLOAD1 OCCURS 0,
    F1(4),
    F2(4),
    F3(16),
    F4 TYPE I,
    F5(16),
    F6,
    END OF IG_DOWNLOAD1.
    DATA : VALUE(16).
    IG_DOWNLOAD-F1 = 'AAAA'.
    IG_DOWNLOAD-F2 = 'BBBB'.
    IG_DOWNLOAD-F3 = '-3.86'.
    IG_DOWNLOAD-F4 = 1.
    IG_DOWNLOAD-F5 = '4.58-'.
    IG_DOWNLOAD-F6 = 'A'.
    APPEND IG_DOWNLOAD.
    CLEAR IG_DOWNLOAD.
    LOOP AT IG_DOWNLOAD.
    MOVE-CORRESPONDING IG_DOWNLOAD TO IG_DOWNLOAD1.
    VALUE = IG_DOWNLOAD-F3.
    CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
    CHANGING
    VALUE = VALUE.
    IG_DOWNLOAD1-F3 = VALUE.
    VALUE = IG_DOWNLOAD-F5.
    CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
    CHANGING
    VALUE = VALUE.
    IG_DOWNLOAD1-F5 = VALUE.
    APPEND IG_DOWNLOAD1.
    CLEAR IG_DOWNLOAD1.
    ENDLOOP.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    FILENAME = 'C:\A1.xls'
    FILETYPE = 'ASC'
    WRITE_FIELD_SEPARATOR = 'X'
    TABLES
    DATA_TAB = IG_DOWNLOAD1.
    Thank You.
    Regads,
    Dhanalakshmi L

  • Negative sign mapping handling for amount field

    hi Experts,
    From SAP ecc to PI we are receiving - negative sign after the amount value 1000 - . can you please suggest the suitable graphical mapping or UDF whenever amount value in -ve should give the ouput result as -1000. .
    Regards,
    Krushi.

    Hi Krushi - I don't see any complexity in it..
    Use graphical function "endswith" to check if the amount has "-"
    If yes then use replace function to replace "-" and then again conact it with "-"
    amount                              then amount->replacevlaue "-"-> concat + "-",amount
              endswith          if
    -                                        else amount
    For graphical function look at the below blog-
    Standard Functions in PI 7.0 - Process Integration - SCN Wiki

  • Wat should be data type for  negative and decimal values (eg: -1.2222)

    What should be data type for  negative and decimal values (eg: -1.2222)

    Hi
    U can use the data type DEC while creating the DOMAIN and in the domain u  have sign check box at the left corner of the screen, click that check box , u can assign negative values for the field which refers this domain.
    REWARD IF HELPFULL
    Anees.

  • Move negative sign (minus) to left side of value in gui_download

    Hi,
    While downloading data using gui_download I want to bring the negative sign to the left side of the value. Is this possible?
    Regrads,
    Madhu

    Hi,
    Use FM
    CALL FUNCTION  'CLOI_PUT_SIGN_IN_FRONT'
    Regards.
    Eshwar.

  • Negative sign display for CURR field in ALV grid report

    I have a field BETRG defined as CURR field of length 15, decimal places 2. The value may be negative or positive. In case of negative values I am using EDIT_MSK option in the field catalog to bring the negative sign to the left of the value as shown below.
    Quote
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = sy-repid
          i_internal_tabname     = 'LT_FINAL'
          i_inclname             = sy-repid
        CHANGING
          ct_fieldcat            = fieldcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
    LOOP AT fieldcat.
        CASE fieldcat-fieldname.
            WHEN 'BETRG'.
            fieldcat-ctabname = ' '.
            fieldcat-cfieldname = ' '.
            fieldcat-edit_mask = 'RRV_______________.__'.
        ENDCASE.
        MODIFY fieldcat.
      ENDLOOP.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_buffer_active    = 'X'
          i_callback_program = sy-repid
          i_grid_title       = 'ABCD'
          is_layout          = gs_layout
          it_fieldcat        = fieldcat[]
          i_save             = 'A'
          is_variant         = gs_save
          it_events          = gs_events
        TABLES
          t_outtab           = lt_final
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
    Unquote
    On displaying the report using 'REUSE_ALV_GRID_DISPLAY' as shown above, when the value of BETRG is a smaller number like say 624, then the ALV output appears as '-            624.00' instead of '-624.00'.
    Is there any way that I can remove the space in between the negative sign and the number before displaying the ALV output using 'REUSE_ALV_GRID_DISPLAY'?

    Hi Deepak,
    I tried this and found that this doesn't work in case of currency field. Once you move back the char field (with negative sign to the left and condensed)  to the currency field, the negative sign again moves back to the right.
    I think that the only way a negative sign can be brought to the left of the currenct field is by using edit_mask of field catalog as I have shown above.
    Regards,
    Shayeree.

  • Editable field in ALV does not accept negative sign values

    Hi guys,
    We have an editable field in ALV but it does not accept negative sign,,, it is causing an error... We need to input a negative value in that editable field...
    How to handle this?
    Thanks!

    Hi Mark,
      This topic has been just discussed at this thread:
    Problem with OO ALV
    Regards,
    Chandra Sekhar

  • Issue in understanding the negative Wasted space value for a table while fragmentation

    Hi All,
           After running the command for getting Fragmentation on tables, i am getting a negative wasted_space for my table. However for rest of the tables i am getting positive value. Can anybody help me to understand that.
    OWNER                          TABLE_NAME                      size (kb) actual_data (kb) wasted_space (kb)
    PROVPROD                       BATCH_REQUEST_RESPONSE            4736696       4840637,48        -103941,48
    Regards,
    Arun Singh

    Thanks for such a detailed explanation. Here are the DDL for table.
    CREATE TABLE
    "PROVPROD"."BATCH_REQUEST_RESPONSE"
    "REQUESTRESPONSEID" NUMBER,
    "WORKINGID"         NUMBER
    NOT NULL ENABLE,
    "BATCHUID"        
    NUMBER NOT NULL ENABLE,
    "SOURCEAGENTID"     VARCHAR2(32 BYTE) NOT NULL
    ENABLE,
    "TRANSACTIONID"     VARCHAR2(256 BYTE),
    "BATCHENVNAME"      VARCHAR2(64 BYTE) NOT
    NULL ENABLE,
    "FILETYPE"        
    VARCHAR2(8 BYTE) NOT NULL ENABLE,
    "ISHEADER"        
    VARCHAR2(1 BYTE) NOT NULL ENABLE,
    "ROWNUMBER"         NUMBER
    NOT NULL ENABLE,
    "ROWVALUE" BLOB NOT NULL ENABLE,
    "SOSTATE"  VARCHAR2(16 BYTE) NOT NULL ENABLE,
    "SORESULT" NUMBER,
    "SOQUEUEDTS" TIMESTAMP (6),
    "SORESPONSETS" TIMESTAMP (6),
    "SOREQUESTXML" BLOB NOT NULL ENABLE,
    "SORESPONSEXML" BLOB DEFAULT EMPTY_BLOB(),
    "SOPRIORITY" NUMBER NOT NULL ENABLE,
    "SODELAY"  
    NUMBER NOT NULL ENABLE,
    "SOTYPE"     VARCHAR2(32 BYTE) NOT NULL ENABLE,
    "SOID"       NUMBER,
    "ACKREC"     VARCHAR2(1 CHAR) DEFAULT 'N',
    "FILENAME"   VARCHAR2(64 BYTE) NOT NULL ENABLE,
    PRIMARY KEY
    ("REQUESTRESPONSEID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
    COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
    2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
    FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "PROVPROD_DATA"
    ENABLE
    SEGMENT CREATION
    IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE
    INITIAL 65536
    NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1
    FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE
    DEFAULT
      TABLESPACE
    "PROVPROD_DATA" LOB
    "ROWVALUE"
      STORE AS BASICFILE
    TABLESPACE
    "PROVPROD_DATA" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION NOCACHE
    LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE
    DEFAULT CELL_FLASH_CACHE DEFAULT)
    LOB
    "SOREQUESTXML"
    STORE AS BASICFILE
    TABLESPACE
    "PROVPROD_DATA" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION NOCACHE
    LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE
    DEFAULT CELL_FLASH_CACHE DEFAULT)
    LOB
    "SORESPONSEXML"
    STORE AS BASICFILE
    TABLESPACE
    "PROVPROD_DATA" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION NOCACHE
    LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE
    DEFAULT CELL_FLASH_CACHE DEFAULT)
    CREATE UNIQUE INDEX
    "PROVPROD"."SYS_C0012044" ON
    "PROVPROD"."BATCH_REQUEST_RESPONSE"
    "REQUESTRESPONSEID"
    PCTFREE 10 INITRANS 2
    MAXTRANS 255 COMPUTE STATISTICS STORAGE
    INITIAL 65536
    NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1
    FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE
    DEFAULT
    TABLESPACE
    "PROVPROD_DATA" ;
    CREATE UNIQUE INDEX
    "PROVPROD"."SYS_IL0000064787C00016$$" ON
    "PROVPROD"."BATCH_REQUEST_RESPONSE"
    PCTFREE 10
    INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1
    MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL
    DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE
    "PROVPROD_DATA" PARALLEL (DEGREE 0 INSTANCES 0) ;
    CREATE UNIQUE INDEX
    "PROVPROD"."SYS_IL0000064787C00015$$" ON
    "PROVPROD"."BATCH_REQUEST_RESPONSE" ( PCTFREE 10 INITRANS 2
    MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
    2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
    FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE
    "PROVPROD_DATA" PARALLEL (DEGREE 0 INSTANCES 0) ;
    CREATE UNIQUE INDEX
    "PROVPROD"."SYS_IL0000064787C00010$$" ON "PROVPROD"."BATCH_REQUEST_RESPONSE"
    ( PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576
    MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE
    "PROVPROD_DATA" PARALLEL (DEGREE 0 INSTANCES 0) ;
    CREATE UNIQUE INDEX
    "PROVPROD"."TRANSACTIONIDINDX" ON
    "PROVPROD"."BATCH_REQUEST_RESPONSE"
    ("TRANSACTIONID") PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE
    STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
    2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
    FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE
    "PROVPROD_DATA" ;
    CREATE INDEX
    "PROVPROD"."METRICSRESULTINDX" ON
    "PROVPROD"."BATCH_REQUEST_RESPONSE"
    "BATCHUID",
    "SOURCEAGENTID",
    "BATCHENVNAME"
    PCTFREE 10
    INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0
    FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
    CELL_FLASH_CACHE DEFAULT
        TABLESPACE
    "PROVPROD_DATA" ;

  • BI Reports taking + sign for Node/Hierarchy input values in BI Portal

    We have BI Portal 7.01 SP 7. We are facing issues while running BI reports as it is appending + sign for the input which are of type Node/Hierarchy. Due to this we are getting error as invalid input:
    Input "\+CG1000(0SEM_CGCOMP)" for Company has invalid format
    However the same report runs fine when we are executing through Bex Analyzer without any + sign in the input values.
    The + sign is not coming if the input value is a number or a text. Its gets appended only to Node/Hierarchy type inputs.
    Your help to resolve this will be highly appreciated.
    Best Regards,
    Mahesh Das

    << Do not post the same question across a number of forums >>

  • Problem of negative sign in conversion of hexadecimal to decimal.

    class D {
    public static void main (String args[]) {
    int i= 0x80000000;
    int j=0x7FFFFFFF;
    System.out.print(i+" , "+j);
    The value of 'i' = 8*(16^7) =2^31 i.e. 2 raised to power 31.
    But it prints -2^31= -2147483648. My problem is that how we are getting a negative sign in 'i' ?
    while On printing 'j' we get a positive value.

    The max value for an int is 2,147,483,647. Since your number is larger than that, it wraps around to be a negative number.

Maybe you are looking for