Scripts - Amount Problem

Hi all,
Im facing this peculiar problem in scripts while passing amounts to external subroutines.
Firstly I need to do a simple calculation of REGUP-DMBTR - REGUP-QSSHB and display the result in the script, as this calculation is not possible in scripts I need to pass these two fields to the subroutine.
While passing thru subroutines they are passed in char formats, now as I cant assign the char format directly to curr fields please let me know how to go about this.
I have tried using numc also, but using this the decimals are getting rounded off. Kindly let me know how to do this, any piece of code or advice is highly regarded.
Secondly, a peculiar problem Im facing is about the decimals and comas placement, normally any amount field will be displayed as 1,234.45 , but in my case it is displayed as 1.234,45 sometimes and the normal way sometimes. This is behaving randomly, I have checked the user settings also and they are fine as 1,234,567.89.
Presently my code is as below:
FORM get_vat TABLES in_tab STRUCTURE itcsy out_tab STRUCTURE itcsy.
  DATA: lv_var(255)  TYPE c, "dmbtr,
        lv_var1(255) TYPE c, "qsshb,
        lv_var2(255) TYPE c, "dmbtr.
        var(25) TYPE c,
        var1(25) TYPE c,
        var2(25) TYPE c,
        var3(25) TYPE c,
        var4(25) TYPE c,
        var5(25) TYPE c,
        var6(25) TYPE c,
        vari TYPE ztemp, (NUMC length 13, decimals 0)
        vari2 TYPE ztemp,
        vari3 TYPE ztemp.
  DATA: lv_var4 TYPE dmbtr,
        lv_var5 TYPE qsshb,
        lv_var6 TYPE dmbtr,
        len TYPE i,
        len1 TYPE i,
        dot TYPE c.
  READ TABLE in_tab WITH KEY 'REGUP-DMBTR'.
  IF sy-subrc EQ 0.
    lv_var = in_tab-value.
    len = STRLEN( lv_var ).
    len1 = len - 3.
    dot = lv_var+len1(1).
    IF dot = ','.
      SPLIT lv_var AT ',' INTO var1 var2.
      REPLACE '.' IN var1 WITH ','.
      CONCATENATE '.' var2 INTO var2.
      CONCATENATE var1 var2 INTO var.
      CONDENSE var.
      vari = var1.
      SHIFT vari LEFT DELETING LEADING '0'.
      CONCATENATE vari var2 INTO vari.
      lv_var4 = vari.
    ELSE.
      vari = lv_var.
      lv_var4 = vari.
    ENDIF.
    CLEAR: dot, len, len1.
  ENDIF.
  READ TABLE in_tab WITH KEY 'REGUP-QSSHB'.
  IF sy-subrc EQ 0.
    lv_var1 = in_tab-value.
    len = STRLEN( lv_var ).
    len1 = len - 3.
    dot = lv_var+len1(1).
    IF dot = ','.
      SPLIT lv_var1 AT ',' INTO var3 var4.
      REPLACE '.' IN var3 WITH ','.
      CONCATENATE '.' var4 INTO var4.
      CONDENSE var.
      vari2 = var3.
      SHIFT vari2 LEFT DELETING LEADING '0'.
      CONCATENATE vari2 var4 INTO vari2.
      lv_var6 = vari2.
    ELSE.
      vari2 = lv_var1.
      lv_var6 = vari2.
    ENDIF.
    CLEAR: dot, len, len1.
  ENDIF.
  lv_var5 = lv_var4 - lv_var6.
  lv_var2 = lv_var5.
  vari3 = lv_var5.
  SHIFT vari3 LEFT DELETING LEADING '0'.
  lv_var2 = vari3.
  READ TABLE out_tab WITH KEY 'LV_VAT'.
  IF sy-subrc EQ 0.
    out_tab-value = lv_var2.
    MODIFY out_tab INDEX 1.
  ENDIF.
ENDFORM.                    "get_vat
Regards,
Narendra.

Done.

Similar Messages

  • SAP SCRIPT code problem

    521
    - Heading for trans. w/out sp.G/L indicators (item sorting method 2)-
    Transactions without special G/L indicators
    522
    - Heading for trans. with sp.G/L indicators (item sorting method 2)-
    &T074T-LTEXT&
    523
    - Heading for open item list of line items -
    &ULINE(71)&
    <K>Invoice No,,Reference.,,Inv.Date,,                   Due date,,,,
                 Balance</>
    &ULINE(71)&
    PERFORM GET_DATE IN PROGRAM ZREPORT
    USING &BSID-BELNR&
    CHANGING &S_DATE&
    ENDPERFORM.
                                                                                    530
    - Line items    Customer open items -
    &BSID-BELNR&,,&RF140-BELEGNUM&,,&BSID-BLDAT&,,&S_DATE&,,
    FORM get_date tables
            int_cond structure itcsy
            outt_cond structure itcsy.
    BREAK SNAGI.
    tables : bseg.
    data : w_belnr type ITCSY-value.
    DATA due_date TYPE rfpos-faedt.
    READ TABLE OUTT_COND WITH KEY name = 'S_DATE'.
      IF sy-subrc = 0.
        outt_cond-value = S_itab11.
        MODIFY outt_cond INDEX sy-tabix.
       ENDIF.
    SELECT SINGLE
    shkzg zfbdt zbd1t zbd2t zbd3t rebzg
    FROM bseg
    INTO CORRESPONDING FIELDS OF bseg
    WHERE
    *bukrs = bukrs AND
    belnr = int_cond-value.
    *AND vbeln = belnr.
    CALL FUNCTION 'NET_DUE_DATE_GET'
    EXPORTING
    i_zfbdt = bseg-zfbdt
    i_zbd1t = bseg-zbd1t
    i_zbd2t = bseg-zbd2t
    i_zbd3t = bseg-zbd3t
    i_shkzg = bseg-shkzg
    i_rebzg = bseg-rebzg
    I_KOART = 'D'
    IMPORTING
    e_faedt = due_date.
    outt_cond-value = due_date.
    MODIFY outt_cond INDEX sy-tabix.
    ENDFORM.
    Now the problem is that,it is int_cond-value is always picking up the first invoice number.
    and the net due date is always same for all invoices..?
    should I loop in the sap script or in the form..?

    Solved my self.
    just placing the perform and endform in 530

  • Script language problem

    Hi friends,
    We designed a script for purchase order for taiwans, and it is
    displaying the incorrect Payment Terms when outputted (e.g. printed) using the ZEBT(own outtype) output type in language 'ZF'.  The Payment Terms text displayed in the ouputted form is not the correct text for the Payment Term on the Purchase Order.
    and it is displaying correct when the outtype in language 'EN'.
    can any suggest me on this, how it is happening.
    Thanks.

    HI friend..
    I have faced the same problem very long ago..
    Try to debug the script first in se71.
    At the main window look for the field netwr....
    Just do some checking there..
    Otherwise i can think for u  some other solution...
    regards..
    saravannan...

  • Indic script display problem - Open Office PDF export does

    I am trying to create a PDF document using iText (a Java library) and I found out that Indic script specificaly Malayalam Language Unicode is not displayed properly. Ligature substitution and reordering is not working at all. (See attached image1.png)
    However, Open Office does display the text properly (see attached image2.png)
    and when I export this document to a PDF document, the text in the PDF is fine (See attached image3.png).
    I am suprised at this bevahiour. The font I am using in all the three case is FreeSerif.ttf, which has support for Malayalam language and has the Open Type tables that is required for ligature substitutions.
    Please help.

    One difference I noted is this -
    Document Property (Fonts) of the PDF with problem shows FreeSerif , True Type (CID), Embedded
    and Document Property (Fonts) of the Open Office Exported PDF shows Free Serif, True Type, Embedded SubSet

  • Script execution problem

    dear sir
    i got a problem with script execution. i have successfully  activate the form painter in ABAP editor. but i am getting the error like "Form  ZLASRISUD language EN is not active and has no errors". please give me the solution for above as soon as possible.

    dear sir
    i got a problem with script execution. i have successfully  activate the form painter in ABAP editor. but i am getting the error like "Form  ZLASRISUD language EN is not active and has no errors". please give me the solution for above as soon as possible.

  • Help in script logic - problem in FOR loop

    Hi Experts,
    We are using BPC 7.5 SP08. I have written a FOR loop in script logic default.lgf which is as follows:
    *FOR %TIM_MEM%=%TIME_SET%
    *XDIM_MEMBERSET TIME =%TIM_MEM%
    *WHEN P_ACCT2
    *IS "OSDU"
    REC(EXPRESSION=[P_ACCT2].[ASSTCAINVURO][P_ACCT2].[COGSUPRVIPSA]/[P_ACCT2].[ASSTUPRVTAQTY],P_ACCT2="COGSUIPSAO")
    *ENDWHEN
    *COMMIT
    *NEXT
    As per my requirement, all this members: [ASSTCAINVURO], [COGSUPRVIPSA], [ASSTUPRVTAQTY] exists for months September to next year's August. But in my input schedule, the months are from August to next year's July(which is the company's fiscal year). Consequently the loop runs for month August to next year's July while I need to run the loop 1 month late(i.e. September to next year's August). This was achieved earlier by hard-coding the time members which we cannot afford as this requires to update these hard-coded member IDs every year.
    We have also tried using the "NEXT" property of TIME dimension as follows:
    *XDIM_MEMBERSET TIME =%TIM_MEM%.NEXT
    but %TIM_MEM%.NEXT doesn't get the month in 'NEXT'.
    Please suggest if there is any way out to solve this problem.
    Thanks in advance.

    Hi Appu,
    Even if you restrict the scope using the XDIM statement, your script will just run the number of times as per the for loop. Actually, in reality, the same calculation is happening again and again, in your code; since your calculation is not based on the time member.
    To use the for loop effectively, you need to incorporate the time member in your calculation.
    Please look at the below sample code:
    *XDIM_MEMBERSET TIME = %TIME_SET%
    *FOR %TIM_MEM%=%TIME_SET%
       *WHEN P_ACCT2
       *IS "OSDU"
          *REC(EXPRESSION=<CALCULATION>,P_ACCT2="COGSUIPSAO")
       *ENDWHEN
    *NEXT
    And in your calculation, you can use statements like
    ([P_ACCT2].[ASSTCAINVURO],TMVL(1, [TIME].[%TIM_MEM%]))
    This will ensure that everytime (as per the for loop), the calculation works on separate set of data.
    Hope you got the idea.

  • Withholding tax base amount problem

    Hi experts,
    I have WT configured like this:
    Base amount: Gross
    No accumulation
    Minimum/maximum: Type level (both)
    Central inv. prop. + Check min. base amnt at pmnt doc level
    In minimum/maximum per Withholding tax type: Minimum base amount "$500"
    The problem occurs when i try to pay an $250 invoice , the system calculates withholding tax for this case but it shouldnu2019t (because the invoice amount is less than $500).  This vendor has only one invoice to pay.
    The weird thing is this problem happen only for a few vendors, i´ve created a  test vendor, exact the same as the "problem vendor" and for the new one, the system is not calculating the withholding tax (its working fine)... I donu2019t know what else should i see...
    Thanks in advance
    Jorge

    Steve,
    My problem is when i try to pay an invoice smaller than the minimum base amount, the system calculates the WHT. This problem is only with a few vendors, but others, with same master data are working fine. I never did changes in those vendor master data, so the program its no necesary in this case.
    Thanks for answering.
    Regards,
    Jorge

  • Script alignment problem

    hi to everyone
    plz help me in this issue
    how to get alignment correct. iam facing problem for amount figures if hte amount value is more it is affecting all the other fields of the out put.
    how to align the amount fields without affecting other fields in out put.
    hi heilman
    but when the amount field when value is in twele or 13 digits i am gettinng a problem of left alignment,can u plz suggest how to get get left aligned of field withhuge value
    Thanks & Regards
    Kiran
    Message was edited by: kiran kumar

    Are you using tabs?   You can also specify a smaller length in the sapscript for the field.
    &ekpo-menge(6.2)&
    Regards,
    Rich Heilman

  • Check printing script debuggin problem

    Hi
    i am working on a check printing script. i need to adjust the layout of few things in this layout.
    in the debuggin mode i am getting the short dump stating vendor number = xxxxxxxxxxxx (invalid).
    can anyone tel me the windows for date,account payee,amount in words and amount in figures or atleast the fields related to them r tell me where i have to correct my script to proceed in debuggin mode.
    thanks in advance

    Hi,
    CHECKSPL  -> for amount in words,
    CHECK -> other fields ( date, amount )
    CHECKADD -> Payee
    other open form se71 -> display -> go to UTILITIES menu -> select FORM INFO. option
    There you find with general Find( CTRl + F ).
    Reward if helpful.
    Bye

  • Script PO problem

    Hi All,
    I am working on scripts for purchase order form .
    I am able to display the form perfectly.
    Problem is if i have 2 units of measure in  PO ex. OPU = 'EA' and ODU = 'ST'.
    then same line item is displaying two times.
    I am using elemnts 'ITEM_LINE_2F' and 'ITEM_LINE_3F'
    Can yanybody please provide solution where i am doing mistake.
    Thanks

    Hi ,
         Can u please give some more details like form name and which standard form u copied.
    Thanks,
    suma.

  • Script logic problem BPC 7.5

    Hi!
    We have a script logic that worked fine in BPC 5.1 but after our upgrade to BPC 7.5 it doesn´t work anymore.
    I will try to explain the part of or logic that doesn´t work anymore.
    We have 2 lines that will pass through the script, each line creates a temporary value  on KATEGORI ="#avskr1").
    Depending on the value created on  u201C#avskr1" it should do calculation A if the value is negative and calculation B if the value is positive. To do this we the following script logic:
    *WHEN GET(KATEGORI="#avskr1")
           *IS < 0
    *Calculation A
    ELS
    *Calculation B
    And this logic worked fine in BPC 5.1.
    If line X had -50 as a value in  u201C#avskr1"   and line Y had 75 as a value  in u201C#avskr1" , calculation A would be performed on line X and calculation B on line Y
    With the same example as above in BPC 7.5 calculation A will be performed on both lines.
    But if I change the logic to the following script logic in BPC 7.5:
    *WHEN GET(KATEGORI="#avskr1")
           *IS  = -50
    *Calculation A
    ELS
    *Calculation B
    Calculation A would be performed on line X and calculation B on line Y. It seems like the logic can´t handle <> signs in this script logic anymore.
    Regards
    Fredrik

    Hi!
    Unfortunately it didn´t help still the same error.
    And I just got an answer from SAP Support that there are a bug in the use of "Get whith When or lookup" in 7.5 SP03 which we currently are using, but it has been fixed in SP04. They just put up a SAP not 1515973 about the issue.
    Unfortunately they have no work around for this problem so I don´t know how to solve it untill we have installed SP04.
    Regards
    Fredrik

  • Pls. help, SQL script page problem

    Hi,
    Im using the Hands On Oracle Database 10g Express Edition for Linux. Im in chap06 already p. 218. I just uploaded the SYSMGMT1 script. After that I Clicked the script's icon but I cannot see any SQL DDL commands inside. Nothing happened. It said in the book that I supposed to see and browse the SQL DDL commands that make up the script. I tried to click RUN, nothing happened either. Is there some kind of a bug in my System? Pls. help me because I cannot continue this chapter's exercise if I cannot solve this first problem that I encountered here in chap06. Any help from the guys outhere is really greatly appreciated. Thank you.
    respectfully waiting,
    Len

    Hi, did you ever get a solution to this because I am having exact same problem - I cannot see the scripts if I upload them nor can I type them in from scratch as the area for seeing/editting the script doesn't seem to be accessible.

  • Irca script password problem

    Hello,
    When executing the irca script I keep receiving the following error : Failed to establish a database connection due to the following error : ORA-01017 : invalid username/password; logon denied
    The problem is that I'm very certain about the password that I'm using (it's my sys password). The username on the other hand is something that I'm unable to enter when executing the irca script. Perhaps this is the problem.
    All help would be greatly appreciated.
    Cheerz,
    Kris

    Oh what a tangled web we weave.  I read up on keychain and I don't understand what I'm reading.  Right now I cannot download my email on my computer, I can access it through the cloud. I'm sure it will be the same for the other iCloud feathers.   When I go to preferences and select iCloud when ever I try to sign in I get some dialog box it shows up "A keychain cannot be found to store 1076701306.  It doesn't matter whether I reset it or cancel it out iCloud preferences remains grayed out. 
    In keychain access on the left side under keychains and Read's local item, systems, and systems roots.
    When I select local items nothing shows up to the right under the name column even when down under all items is selected nothing shows up.  And nothing shows up to the right when under categories I selected the other options password etc.  On the other hand when I select under keychains systems, systems roots I do get items to show up on the right side under names under all items, passwords, etc.  Where do I start?

  • Script control problem

    hi good morning everybody
    iam in sap-script devleopment
    my problem is
    1) how to write the text or databade fields in the box, i hav created a box in the form latyout but i cant able to wite the data into that box.
    2)if there is 2 text elements in my main window namely a) address b) details
    my question is that did i requried 2 write_form fm to write these to text elements?
    bcaz iam not able to print the text which is under the second text element
    3) how to define the next page( i hav a main page and i wanna print the continues text in the subsequent page), did i requried call it in the print program?
    4) when iam witing the address and endaddress its not taking the /: means i hav to data base fields a) kunnr b) name1 so if iam defiing like this
    /:address paragraph p1
    /:&itab-kunnr&
    /:&itab-name1
    /:endaddress
    but iam not getting the output, but if i define like the below
    /:address paragraph p1
    p1& itab-kunnr&
    p1&itab-name1
    /:endaddress
    iam getting the result. whatz giong on here.

    1. After the box command use your fields, sure you can display the data in box.
    2. Only one write_form is enough.
    3. In pages definition fill the next page field. ( It can be same page or different page).

  • Benefit plan maximum coverage amount problem

    Hello.
    I guess I have a very simple problem, but I doesnu2019t get it running.
    I have an Insurance benefit plan.
    It only have one coverage rule with the following data:
    Salary Factor: 0.6000
    Rounding Rule: rounded up
    Rounding div:  1000.00
    Maximum amount: 90,000.00
    So if someone have a Benefit Salary of 225,000.00, it shows a basic Coverage amount of 135,000.00 in Infotype 0168.
    But I want a maximum Coverage amount of 90,000.00.
    Why it ignored the maximum limit?
    Any help would be very nice.
    Regards.

    Please close your thread if you solved your problem.

Maybe you are looking for

  • Connecting my all in one to my TV

    Hiya guys! I have a Wind Top AE2260 & would like to connect it to my TV. I have the HDMI cable which I connected to both, but don't seem to be able to get it to work, I am trying to use the tv as a monitor to watch my blu-rays. Any help would be real

  • Can I extend an O2 router network AND stream to an Airport Express?

    I'd like to put an AE upstairs so I can use AirPlay from my Mac to both the downstairs AppleTV and the upstairs Airport Express at the same time. Also, I'd like the Airport Express to act as a Wi-Fi Network extender for the O2 router that's downstair

  • Outer Joins in Oracle 9i

    Post Author: wtfinc CA Forum: Data Connectivity and SQL After upgrading to Oracle 9i, the SQL queries generated by Crystal Reports XI contain a syntax errors when performing Outer Joins.  The particular error returned by Oracle is "Old Style Outer Jo

  • Adobe plugin crash - one user profile only

    HI    I have been using adobe flash with no problems until yesterday.  I go onto facebook and the page loads but when I go to "home " on facebook a message states flash plugin has crashed reload again. I was using IE but loaded Mozilla firefox.  I un

  • Why are my downloads duplicating in my library (on MAC and iphone)?

    For the last 3-4 months, purchases made on itunes (songs) have been showing as duplicates in my MAC and iphone libraries (songs are coming up as "purchased" twice).  I'm not purchasing the songs twice, so why is this happening?  Anyone else have this