ABAP calculating in Include MV45AFZZ

Hej.
I am experiencing strange things with this bit of code.  This code is taking place in FORM userexit_save_document_prepare in include MV45AFZZ.
And the result of the calculation is wrong, when I take the code and try it out in a new program, then i get a different results.
Here is the example.
xkomv-KWERT = 3.5
xkomv-KUMNE = 1000.
xkomv-KUMZA = 1000.
The result in the l_pris_pr_kg is : 1.8272945598830532E+01 But should be : 1.8272945598830531E-01
  DATA: BEGIN OF xpreis OCCURS 20,
          posnr TYPE kposn,
          preis TYPE bapre,
  DATA: END OF xpreis.
  DATA: l_pris_pr_kg TYPE f.
  LOOP AT xkomv WHERE kschl = 'ZMKP'.   "
    xpreis-posnr = xkomv-kposn.
    l_pris_pr_kg = ( xkomv-KWERT * xkomv-KUMNE ) / xkomv-KUMZA.
     xpreis-preis = l_pris_pr_kg.
    APPEND xpreis.
  ENDLOOP.
I have also tryed to put this into a STRING where in the Include MV45AFZZ I get the result
String = 18,
but in my test program i get the result
String = 0.18272945598831  (Which is correct).
So it seems that in this include I cannot get this to work correctly.
Is there anyone that has experienced something similiar, all help would be appreciated.
Thanks Gisli

Hi Ankur,
The problem lokks similar But, MV45AFZZ is a Standard include,
No Fixed point Arthematic Available,,,
Hi Gisli,
Try to divide i_pris_pr_kg by 100... Hope this could solve your problem...
Thanks & regards,
Dileep .C

Similar Messages

  • Include MV45AFZZ

    I am new in ABAP.
    And I'll want to move some fields of a contract (vbak tcode va41) to a repair order (vbap tcode va01).
    I think that I founded a User Exit (include mv45afzz) to

    May This would be Handy in your case.I found few BADi for VA01,but they are yet not released for customer.
    Anyways you can also find BADi with the help of below Blog.
    How to search for BAdIs? (Trace it)

  • Help needed in Form userexit_save_document_prepare include MV45AFZZ

    Hi Experts,
    I need to check the values entered in table control under sales tab in VA01.
    If the item category for a material is 'TANN' it should save if not it should not save and display an error message and then it should alow the user to edit the table control values. 
    how do i achieve it in Form userexit_save_document_prepare include MV45AFZZ.
    this is what I have done. kindly check the logic and help me further.
    case sy-ucomm.
    when 'SICH'.          " On Save action
    if vbak-vtweg eq 'HA'.  " Check Distribution channel
      flg_dh = 'X'.         " Sets if DC is 'HA'.
    endif.
    if flg_dh eq 'X'.
      if vbap-pstyv eq 'TANN'.    " Check item category
        flg_itmc = 'X'.            " Set if item cat is 'TANN'.
      else.
      message 'SO could not be created Please enter brokerage material' type 'E'.
      endif.

    Hi,
    Please use the following:
    when 'SICH'.          " On Save action
    if vbak-vtweg eq 'HA'.  " Check Distribution channel
      flg_dh = 'X'.         " Sets if DC is 'HA'.
    endif.
    if flg_dh eq 'X'.
      if vbap-pstyv eq 'TANN'.    " Check item category
        flg_itmc = 'X'.            " Set if item cat is 'TANN'.
      else.
      message 'SO could not be created Please enter brokerage material' type 'E' display like 'E'.
      endif.
    endif.

  • How to distinguish the ABAP Code in include program into different TRs

    Hello Friends,
      In our current project, two teams are working on the developments.  One team is for LES related developements and another team is for billing related developments.  As part of developments, same programs are sharing by two teams, example -
    Include - MV45AFZZ, the userexits in include are using by both the teams for their developments
    Now the issue was, since the same program is using by both the teams, and during program activation , system automatically includes the code in both the team TRs.  This was causing issue while testing and transport to other testing systems, since billing project is going live in next year and LES in coming november
    Hence, we need to understand how we can differentiate the code which should not impact with other TRs.
    Many thanks for your inputs
    Best Regards,
    Goutham

    Thanks all for the quick reply..
    I would like to brief more clear...
    In current project, Team 1 is working for Logistics developments, Team 2 is for Billing developments.  As part of project plan, Logistics is going live this november
    When two teams are working on the same include, Team 1 is activated the changes then the task is updated in their TR, later when Team 2 has made changes in the same inlcude then the task was includeded in their TR.    Now the problem facing was, Team 2 has developed statements like COMMIT  WAIT WORK  and also BAPI call etc... and these statements are causing performance issues and some other problems......
    Recently Logistics related TRs are moved to testing system for testing, in that all the development TRs are moved into testing system and also code related to Billing project (Team2)  as well.... when we cross check the reason then it was identified that the same include is using by both the teams for the development.    Now we need distinguish the code specific to team whcih should not impact other...
    Hope my explanation clear the criticality of the problem
    Thanks
    Best Regards,
    Goutham

  • Doubt in include MV45AFZZ

    Hi,
    Can I use a subroutine(perform) with in the USEREXIT_MOVE_FIELD_TO_VBKD .
    I have repeated lengthy code, which needs to call atleast 2 times. So wanted include the code in Perform.
    Can I include form, endform with in the include MV45AFZZ.
    Pls suggest.
    Rgs,
    Priya

    Hi,
    1. you can write the subroutine in  side this include
    2.   you can  also write a separate program and right the required logic in side this in the preform function.
          and then call this perform in the  USEREXIT_MOVE_FIELD_TO_VBKD.
         PERFORM subroutine name IN PROGRAM Program name using required table using and changing parameters.

  • Unable to add code in USEREXIT_SAVE_DOCUMENT_PREPARE in include MV45AFZZ

    Hi Experts,
    I need to add some custom codes in USEREXIT_SAVE_DOCUMENT_PREPARE
    -> I opened the include program MV45AFZZ in display mode
    -> Edit -> Enhancement operations -> Show implicit enhancement operations.
    On the status bar it displays an information "Creating of enhancement supported only for line length > 72" 
    inside form USEREXIT_SAVE_DOCUMENT_PREPARE I right clicked -> selected enhancement implementations -> create.
    and now I get the same message On the status bar "Creating of enhancement supported only for line length > 72"  .
    how do I add a piece of code here.
    I can't type in under USEREXIT_SAVE_DOCUMENT_PREPARE.
    Give a solutions experts.
    Regards,
    Ranjith N

    Hi ,
    I believe we need not use the enhancement framework in MV45AFZZ
    Go to SE38 -> MV45AFZZ -> change mode
    Keep the mouse on the user exit USEREXIT_SAVE_DOCUMENT_PREPARE
    On the tool bar click on "Insert" icon ->icon description: Insert Line Area
    ControlShiftF8....
    An editable area will be displayed with a
    *{   INSERT         &$&$&$&$                                          1
    *---> Write code here
    *}   INSERT
    Save and activate the code
    Hope it helps
    Regards
    Byju

  • TYPES statement in abap class to include structure

    hi ,
    i have declared following in a abap class...
    TYPES:
          zts_alv_line TYPE zmat_pr_costest_alv.
         TYPES:BEGIN OF ts_alv_line,
                include type zts_alv_line,
                matkl type mara-matkl,
                t023t type t023t-wgbez,
                lvorm type mara-lvorm,
                end of ts_alv_line.
         TYPES: tt_alv_data TYPE STANDARD TABLE OF ts_alv_line WITH DEFAULT KEY.
         DATA:
          alv_data TYPE tt_alv_data.
    now while refering to alv_data-matnr the sap is giving error that this component does not have matnr.
    please help.
    Edited by: Suhas Saha on Feb 3, 2012 1:11 PM

    TYPES: zts_alv_line TYPE zmat_pr_costest_alv.
    TYPES:BEGIN OF ts_alv_line,
                include type zts_alv_line,
                matkl type mara-matkl,
                t023t type t023t-wgbez,
                lvorm type mara-lvorm,
                end of ts_alv_line.
    Actually by defining this you've defined include as field of ts_alv_line. Actually ts_alv_line is a nested structure.
    I think you need to re-define the structure definition as:
    TYPES:BEGIN OF ts_alv_line.
          INCLUDE TYPE zts_alv_line.
    TYPES: matkl TYPE mara-matkl,
           t023t TYPE t023t-wgbez,
           lvorm TYPE mara-lvorm.
    TYPES: END OF ts_alv_line.
    BR,
    Suhas

  • Can't get iPhone 5 calculator to include tax in total - Help!

    Bought my iPhone 5 July 25, 2013, but haven't had much time to learn how it works. About the calculator... On most calculators, if I enter 239.00 x .0825 = I get 19.7175. If I then enter + = I get the total including tax 258.7175. For some reason, I can't get the calculator on my iPhone 5 to do this. What do I need to do? Thanks!

    Thanks to all for your input and attempts to help.
    Hot Spur, I got an email where you said:  "How is the iOS calculator going to know the tax in any given area? It's different everywhere."  I already know the tax rate so I don't need the calculator to know  it.
    I was just hoping the standard iPhone 5 calculator would allow me to enter the sale price, multiply it by the tax rate, hit the equal sign to see the tax amount, hit the plus sign, then the equal sign, then see the total due, including tax. This is the order it typically prints out on a receipt, too.
    Sale Price
    x Tax Rate = Tax Amount
    + = Total Due, including tax
    I'll use my WalMart and Staples calculators until Apple comes up with a calculator that can do this. I had no idea it was so complicated...

  • Doubt in Include MV45AFZZ - form userexit_move_field_to_vbap

    Hello ,
    When user enters material at line item in VA01 , to throw a pop-up mentioning texts .
    I have added a include in form userexit_move_field_to_vbap in which i declared a internal table containing material number and item number .
    First i import this table from memory so nothing was there and it throws a popup after checks .
    And then export the same table .
    Now suppose the user enters again the same material and line item no popup will come .
    Problem : Suppose the user doesnt save the order and come out , the record remains in the exported table and doesnt display popup .
    Please help .

    When the user exits an external session (/i in the command field), the corresponding ABAP memory is automatically initialized or released.
    IMPORT/EXPORT to memory id uses ABAP memory.So, when user comes out of the transaction screen without saving, the data in the internal table will wipe out.
    Problem : Suppose the user doesnt save the order and come out , the record remains in the exported table and doesnt display popup .
    I think u won't have this problem.
    G@urav.

  • ABAP Report with INCLUDE for subroutine.

    Dear All,
    I have ABAP report list.
    I have the following code:
    SELECT-OPTIONS: s_date FOR oijne-astdtt.
    PARAMETERS : p_time LIKE sy-uzeit DEFAULT sy-uzeit.
    SELECT-OPTIONS : s_soldto FOR oijnomi-soldto.
    in my program i have INCLUDE ZER0100F. as incude for subroutine form.
    If i put the subroutine in the include and in side this subroutine i am using the s_date or s_soldto.
    It gives me error.
    The field "S_DATE" is unknown

    Hi,
    There is no need to use Using or tables since the select option is global and will be accessible in your routine.
    E.g:
    TABLES kna1.
    SELECT-OPTIONS: s_date FOR sy-datum.
    PARAMETERS : p_time LIKE sy-uzeit DEFAULT sy-uzeit.
    SELECT-OPTIONS : s_soldto FOR kna1-kunnr.
    START-OF-SELECTION.
      PERFORM f_routine.
    FORM f_routine.
      WRITE : 'low :' , s_soldto-low.
    ENDFORM.                    "f_routine
    Regards.
    Edited by: Dev Parbutteea on Apr 29, 2009 8:05 AM

  • Create an ABAP Calculator

    how can i create a calculator with reports, which will have 4 radio buttons namely addition,sub,multiplication and division.if the user clicks on any one of the radio button then  a screen will come which will ask the user for the two numbers and if the user has selected the addition radio button then addition is done n if the user has selected subtraction then subtraction is done....
    if it is possible with abap then how can i do this...
    plzz help me work out the logic.
    Edited by: Alvaro Tejada Galindo on Mar 12, 2008 6:03 PM

    Hi,
    Try this...
    DATA: X_VALUE(15) TYPE C.
    call function 'FITRV_CALCULATOR'
    *EXPORTING
    *INPUT_VALUE                =
    *CURRENCY                   =
    *START_COLUMN               = '10'
    *START_ROW                  = '10'
      IMPORTING
        OUTPUT_VALUE               = X_VALUE
      EXCEPTIONS
        INVALID_INPUT              = 1
        CALCULATION_CANCELED       = 2
        OTHERS                     = 3.
    *IF SY-SUBRC = 0.
    *WRITE:/ 'Output Value ', X_VALUE.
    *ENDIF.
    R/points if helpful....
    Regards
    AK
    Edited by: AK on Mar 13, 2008 8:57 AM

  • ABAP Coding:The included type has no structure

    Hi All,
    When i tried to write following code, i 'm getting error like "*The included type has no structure *"
    TYPES:
          BEGIN OF it_datapak1.
                INCLUDE STRUCTURE RESULT_PACKAGE.
        TYPES:
             alpha(18) TYPE c,
          END OF it_datapak1.
    Any guesses?

    Hi
    Check in SE11 wether you have any structure with name RESULT_PACKAGE.
    Regards
    Srilaxmi

  • Added code for VA01 transaction ----in the include MV45AFZZ

    Hi All,
    I have added the code for pop-up
    if the quantity is greter than 20000 then we need to give the confirm pop-up.
    for that i have added code like this.
    When we clik on YES it will save the order.
    suppose if i clik on NO then i need to change the quantiy value.
    Whats needs to be doing for this.
    Please help me on this.
    IF ( vbak-vkorg = 'CA01' OR vbak-vkorg = 'CA02' OR
           vbak-vkorg = 'CA03' ).
        IF vbak-netwr > '50000.00'.  "Comparing quatity value
          w_txt = 'Order Quantity exceeded 50000 CAD. Please confirm'.
          w_txt1 = 'Order Quantity Check'.
           MESSAGE w901(zmsg1) WITH '50,000.00 CAD'.
          CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
               EXPORTING
                   defaultoption  = 'Y'
                    textline1      = w_txt
                    TEXTLINE2      = ' '
                    titel          = w_txt1
                    START_COLUMN   = 25
                    START_ROW      = 6
                   cancel_display = ' '
              IMPORTING
                   answer         = w_ans.
          CASE w_ans.
            WHEN 'J'.  "<b>This is for COnfirm means Yes</b>
               CONTINUE.
            WHEN 'N'.  "<b>This is for NO</b>
                SET SCREEN 4008.
               CALL SCREEN  4008.
                LEAVE TO SCREEN 4008.
    Thanks
    Sriman.

    Hi,
    I assume that you are writing this code in "<b>USEREXIT_SAVE_DOCUMENT_PREPARE</b>". If not that first thing you do is move your code here.
    The next thing is modify your code like this
    IF ( vbak-vkorg = 'CA01' OR vbak-vkorg = 'CA02' OR
         vbak-vkorg = 'CA03' ).
      DATA: lv_screenno TYPE syst-dynnr.
      IF vbak-netwr > '50000.00'.
        w_txt  = 'Order Quantity exceeded 50000 CAD. Please confirm'.
        w_txt1 = 'Order Quantity Check'.
        CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
             EXPORTING
                  defaultoption  = 'Y'
                  textline1      = w_txt
                  titel          = w_txt1
                  cancel_display = ' '
             IMPORTING
                  answer         = w_ans.
        CASE w_ans.
          WHEN 'J'. "This is for COnfirm means Yes
          WHEN 'N'. "This is for NO
    *        SET SCREEN 4008.        "Remove this line
    *        LEAVE TO SCREEN 4008.   "Remove this line
    *" No need to define variable FCODE again,
    *" it is alreay define in MV45ACOM
            fcode = 'ENT1'.   "sy-ucomm.  Add this line
            lv_screenno = sy-dynnr.       "Add this line
            LEAVE TO SCREEN lv_screenno.  "Add this line
        ENDCASE.
      ENDIF.
    ENDIF.
    Let me know if you have any question.
    Regards,
    RS

  • Sales order creation with ref. to contract. Quantity related issue

    Hii All,
    I am creating sales order with ref. to contract. But i can enter more quantity than that mentioned in the contract. Here i need the system should give a warning while saving the order. I refered the thread Sales Order Against Contract
    In this thread the procedure to convert the warning to error is given. but i need how to give this warning message.
    In VTAA, I have maintained copy requirement as 303 at item level. & DataT as 151, 102 & 002.
    Please suggest.

    Dear Vijay,
    in incompletion procedure we can arrange to check whether any field is empty, here data comparison is not possible.
    As far as I know you can not achieve this through standard config.
    To achieve your requirement, you will need to take help of an ABAPer, it can be achieved using Userexit.
    ABAPer can use include MV45AFZZ
    and Userexit ""USEREXIT_SAVE_DOCUMENT".
    the code written in this userexit will check and compare the quantities before saving the dcument.
    Logic if quantity enter is greater than the quantity mentioned in Contract show warning Message.
    I hope this solves your Problem.
    Regards,
    Paresh

  • Material Variant Matching in Sales Order Creation with ref.to Sales Order

    Hi All,
    We are working in Variant configuration.Our product is defined at PQD(Product, Quality & Dimension).
    But, Sales Contracts are created at PQ (Product, Quality/Grade ) level only.
    We have defined Variant Characteristics GRADE(ALLOY CODE),DIMENSION AND TWO MATERIALS.
    MAT 1 , configurable material.
    MAT 2, A Material Variant of MAT 1, Having values of GRADE = A & DIMENSION = 150 in MRP 3 view of the same.
    When a Sales Order is created for MAT 1  and its characteristics values are GRADE = A, DIMENSION = 150, Material Variant type matching happens & it replaces the configurable material.
    Similarly,Sales  Contract is created for Configurable material MAT 1, with only GRADE = A ( As mentioned above, only quality is known at contract creation level).But, when we are trying to creart a Sales Order with reference to this Contract, we are trying to punch characteristic Value for DIMENSION = 150 also. At this stage, Materuial Variant MAT 2 is shown, but it is not replacing MAT 1.
    Is this the standard behaviour or there is some solution/enhancement available.
    regards,
    Stuti

    Dear Vijay,
    in incompletion procedure we can arrange to check whether any field is empty, here data comparison is not possible.
    As far as I know you can not achieve this through standard config.
    To achieve your requirement, you will need to take help of an ABAPer, it can be achieved using Userexit.
    ABAPer can use include MV45AFZZ
    and Userexit ""USEREXIT_SAVE_DOCUMENT".
    the code written in this userexit will check and compare the quantities before saving the dcument.
    Logic if quantity enter is greater than the quantity mentioned in Contract show warning Message.
    I hope this solves your Problem.
    Regards,
    Paresh

Maybe you are looking for

  • How do I make a flow chart in pages

    How can I make a simple flow chart in pages for a lesson plan?  Or can I?

  • Oracle JDBC Driver, SQL, and erroneous ORA-00942

    We've been running the following prepared statement without trouble for several months: "SELECT ST FROM STATELT WHERE UPPER(ST)=UPPER(?) OR UPPER(STATE)=UPPER(?) OR UPPER(ABBREV)=UPPER(?) ", using the latest version of the Oracle JDBC drivers. The co

  • Isolation level when using UserTransaction

              What isolation level does WLS assign to JDBC connection objects when used within           a user-controlled JTA transaction?           e.g. when using the following code within a servlet:           UserTransaction ut = (UserTransaction) ic

  • Can I import settings from CS5's Live Trace to CS6's Image Trace?

    I'm loving CS6 Illustrator, except for one thing. Image Trace. Here, Adobe seem to have taken away the two most usefull settings from Live Trace, and replaced all the presets with ones that are pretty much unusable. I almost always used either 'Comic

  • Turning image traced PNG to paths?

    Hello, I am trying to make a crack wall texture effect on some text in illustrator cs6. I have some crack texture photoshop brushes I really like, so I brushed on a blank psd canvas and saved it to PNG with transparent background. I placed that in il