Sum the currency field by MATNR -urgent

Hi All,
LOOP AT itab1.
LOOP AT itab2 where matnr = itab1-matnr.
itab3-Diff = itab1-zzstwrt - itab2-zzstwrt.
if itab3-diff ne 0.
WRITE: /01 itab1-YYRVCTR, 09 itab1-VRSIO,17 itab1-VKORG,
23 itab1-zzstwrt,47 itab1-STWAE,53 itab2-matnr,
62 itab2-zzstwrt,87 itab2-STWAE,100 itab3-Diff.
endif.
ENDLOOP.
ENDLOOP.
How to SUM along this code ..this si u
example
MATNR(materil)
EU_11504
EU_11504
EU_11504
EU_11504
EU_11504
EU_11504
EU_11504
zzstwrt (ST Currency S780-field)
759.01
759.01
759.01
759.01
759.01
759.01
759.01
0.00
Differece (ST curr Difference )
6,831.09
6,831.09
6,831.09
6,831.09
6,831.09
6,831.09
6,831.09
I have to SUMARAISE by materail..
same matnr have different amount ..how to sum by currency towards MATNR
I mean currency amount should add by matetail wiese

HI,
USE SUM EVENT..
check this.... MATNR shub be the first field in itab for reference.
REPORT zkb_test.
DATA: BEGIN OF i_tab1 OCCURS 0,
matnr(18) TYPE c,
desc(20) TYPE c,
valu TYPE i,
quan TYPE i,
sno(2) TYPE c,
END OF i_tab1.
DATA: i_tab2 LIKE TABLE OF i_tab1 WITH HEADER LINE.
START-OF-SELECTION.
i_tab1-sno = 1.
i_tab1-matnr = 'abc'.
i_tab1-desc = 'abc'.
i_tab1-valu = 10.
i_tab1-quan = 20.
APPEND i_tab1.
i_tab1-sno = 2.
i_tab1-matnr = 'xyz'.
i_tab1-desc = 'xyz'.
i_tab1-valu = 10.
i_tab1-quan = 20.
APPEND i_tab1.
i_tab1-sno = 3.
i_tab1-matnr = 'abc'.
i_tab1-desc = 'abc'.
i_tab1-valu = 10.
i_tab1-quan = 20.
APPEND i_tab1.
SORT i_tab1 BY matnr.
LOOP AT i_tab1.
i_tab2 = i_tab1.
AT END OF matnr.
SUM.
i_tab2-valu = i_tab1-valu.
i_tab2-quan = i_tab1-quan.
APPEND i_tab2.
ENDAT.
ENDLOOP.
LOOP AT i_tab2.
WRITE:/ i_tab2-sno, i_tab2-matnr, i_tab2-valu, i_tab2-quan.
ENDLOOP.
Regards
SAB

Similar Messages

  • Make the currency field in SOCO editable

    Hi All:
    PDP Scenario
    I have a requirement to make the currency field in SOCO. I did try to control it in SPRO > SAP SRM > Cross-App > Extensions and Field Control > Configure Control for Fields on Item Level > Metadata for Fields on Item Levels, but did not work.
    Configuration Entries:
    Field Name: Currency
    Object Type: BUS2121
    Transaction Type: " "
    Field Visible: Checked
    Field Enable: Checked
    Field Required: Unchecked
    Any input is appreciated.
    Thanks: Mike

    Hi Mike,
    You were almost at the right spot:
    SPRO >  SAP SRM > Cross-App > Extensions and Field Control > Configure Field Control > Configure Control for Fields of Substructures > Metadata for Fields of Substructures and Table-Like Enhancements
    Entries:
    Set type: SI
    Field name: Currency
    Obj Type: AO_SOCO
    Set level: ITEM
    Field Visible: Checked
    Field Enable: Checked
    Field Required: Unchecked
    Perhaps you also need to check the "post-editable" field...
    Hope that works!
    Best regards,
    Jos

  • Validated the currency field in WEB

    Dear all,
    I have a develop a new WEB SRM screen, but I'm not managing to validate the Currency field when the user puts letters.
    The field is of type CURR and when the user hits "enter" it puts all letters in CAP but doesn't sends any error message.
    Anyone had this problem?
    Thank you in advanced,
    Vasco Pires

    Hi Masa,
    The screen works corretly when we run it on SAP Gui, the field has the type CURR, but when we executed on web, with a its web interface:
    <input type="text" name="ZDADOS_FACT-PRC_NOVO[`j`]"  value="`ZDADOS_FACT-PRC_NOVO[j].value`"
              maxlength="17" size="10">
    But when the users inputs the price, the system doesn't send the error box with the error message.
    Thank you for your support,
    Vasco

  • To Remove comma's from the Currency Field

    Hi,
    I Want to print the Currency Field in the smartform without
    comma's.
    Is there any Function Module to suppress comma's .
    Eg: 1,000.00 to 1000.00
    Regards
    Praveen.
    Edited by: praveen kumar on Jan 20, 2009 2:13 PM

    Hi,
    Following code will help you in this way,
    TABLES: aufk.
    TYPES: BEGIN OF t_aufk,
      user4 LIKE aufk-user4,
      withoutc(13),
      END OF t_aufk.
    DATA: it_aufk TYPE STANDARD TABLE OF t_aufk WITH HEADER LINE,
          wa_it_aufk TYPE t_aufk.
    SELECT user4 FROM aufk UP TO 10 ROWS
      INTO CORRESPONDING FIELDS OF TABLE it_aufk.
    BREAK-POINT.
    LOOP AT it_aufk INTO wa_it_aufk.
      wa_it_aufk-withoutc = wa_it_aufk-user4.
      MODIFY it_aufk FROM wa_it_aufk INDEX sy-tabix.
    ENDLOOP.
    LOOP AT it_aufk into wa_it_aufk.
      WRITE: / wa_it_aufk-user4,  wa_it_aufk-withoutc.
    ENDLOOP.
    Please test with your own table and field may be you will not able to get any amount in the above used itab, if you only want to test place a break point just before 1st loop and add some values in the debuger mode to the amount field.
    Please Reply if any Issue,
    Kind Regards,
    Faisal
    Edited by: Faisal Altaf on Jan 20, 2009 6:46 PM

  • How can I find the currency field of table KOMU

    I need to select data from table KOMU, including field wrbtr. in 'Currency/Quantity Fields' tab, it's defined to use bkpf-waers.
    but how can i find the corresponding record in bkpf? could anyone tell me the relation between these two table?
    or is there another way to get the currency field?
    thank you!

    Hi,
    In that case, please retrieve the currency & store it in variable. Pass the variables to the Function Module.
    CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
         EXPORTING
              date             = syst-datum
              foreign_amount   = for_amount
              foreign_currency = L_cur1
              local_currency   =  l_cur2
         IMPORTING
              local_amount     = loc_ammount
         EXCEPTIONS
              no_rate_found    = 1
              overflow         = 2
              no_factors_found = 3
              no_spread_found  = 4
              derived_2_times  = 5.
    [Code]
    Best regards,
    Prashant
    [code]

  • Problem with summing up the currency fields

    The below is my code through which I cannot display hthe sum at the end for all the below fields please advice on the soln. Also srched in SDN the answers are bit ambigious/also tried.
    gw_fieldcat-fieldname  = 'WTGXXX'.
      gw_fieldcat-datatype   = 'CURR'.
    *  gw_fieldcat-cfieldname = 'WAERS'.
      gw_fieldcat-tabname    = 'gt_output'.
      gw_fieldcat-seltext_l  = 'Material(Transaction currency)'.
      gw_fieldcat-no_zero    = 'X'.
      gw_fieldcat-do_sum     = 'X'.
      APPEND gw_fieldcat TO gt_fieldcat.
      CLEAR gw_fieldcat.
      gw_fieldcat-fieldname  = 'WOGXXX'.
      gw_fieldcat-datatype   = 'CURR'.
    *  gw_fieldcat-cfieldname = 'WAERS'.
      gw_fieldcat-tabname    = 'gt_output'.
      gw_fieldcat-seltext_l  = 'Material(Object currency)'.
      gw_fieldcat-no_zero    = 'X'.
      gw_fieldcat-do_sum     = 'X'.
      APPEND gw_fieldcat TO gt_fieldcat.
      CLEAR gw_fieldcat.
      gw_fieldcat-fieldname  = 'WKGXXX'.
      gw_fieldcat-datatype   = 'CURR'.
    *  gw_fieldcat-cfieldname = 'WAERS'.
      gw_fieldcat-tabname    = 'gt_output'.
      gw_fieldcat-seltext_l  = 'Material(Controlling area currency)'.
      gw_fieldcat-no_zero    = 'X'.
      gw_fieldcat-do_sum     = 'X'.
      APPEND gw_fieldcat TO gt_fieldcat.
      CLEAR gw_fieldcat.
      gw_fieldcat-fieldname  = 'WTGXXX1'.
      gw_fieldcat-datatype   = 'CURR'.
    *  gw_fieldcat-cfieldname = 'WAERS'.
      gw_fieldcat-tabname    = 'gt_output'.
      gw_fieldcat-seltext_l  = 'Labour(Transaction currency)'.
      gw_fieldcat-no_zero    = 'X'.
      gw_fieldcat-do_sum     = 'X'.
      APPEND gw_fieldcat TO gt_fieldcat.
      CLEAR gw_fieldcat.
      gw_fieldcat-fieldname  = 'WOGXXX1'.
      gw_fieldcat-datatype   = 'CURR'.
    *  gw_fieldcat-cfieldname = 'WAERS'.
      gw_fieldcat-tabname    = 'gt_output'.
      gw_fieldcat-seltext_l  = 'Labour(Object currency)'.
      gw_fieldcat-no_zero    = 'X'.
      gw_fieldcat-do_sum     = 'X'.
      APPEND gw_fieldcat TO gt_fieldcat.
      CLEAR gw_fieldcat.
      gw_fieldcat-fieldname  = 'WKGXXX1'.
      gw_fieldcat-datatype   = 'CURR'.
    *  gw_fieldcat-cfieldname = 'WAERS'.
      gw_fieldcat-tabname    = 'gt_output'.
      gw_fieldcat-seltext_l  = 'Labour(Controlling area currency)'.
      gw_fieldcat-no_zero    = 'X'.
      gw_fieldcat-do_sum     = 'X'.
      APPEND gw_fieldcat TO gt_fieldcat.
      CLEAR gw_fieldcat.
      gw_fieldcat-fieldname  = 'TOTAL1'.
      gw_fieldcat-datatype   = 'CURR'.
    *  gw_fieldcat-cfieldname = 'WAERS'.
      gw_fieldcat-tabname    = 'gt_output'.
      gw_fieldcat-seltext_l  = 'Total(Transaction currency)'.
      gw_fieldcat-no_zero    = 'X'.
      gw_fieldcat-do_sum     = 'X'.
      APPEND gw_fieldcat TO gt_fieldcat.
      CLEAR gw_fieldcat.
      gw_fieldcat-fieldname  = 'TOTAL2'.
      gw_fieldcat-datatype   = 'CURR'.
    *  gw_fieldcat-cfieldname = 'WAERS'.
      gw_fieldcat-tabname    = 'gt_output'.
      gw_fieldcat-seltext_l  = 'Total(Object currency) '.
      gw_fieldcat-no_zero    = 'X'.
      gw_fieldcat-do_sum     = 'X'.
      APPEND gw_fieldcat TO gt_fieldcat.
      CLEAR gw_fieldcat.
      gw_fieldcat-fieldname  = 'TOTAL3'.
      gw_fieldcat-datatype   = 'CURR'.
    *  gw_fieldcat-cfieldname = 'WAERS'.
      gw_fieldcat-tabname    = 'gt_output'.
      gw_fieldcat-seltext_l  = 'Total(Controlling area currency)'.
      gw_fieldcat-no_zero    = 'X'.
      gw_fieldcat-do_sum     = 'X'.
      APPEND gw_fieldcat TO gt_fieldcat.
      CLEAR gw_fieldcat.
    thanks in advance.

    Try passing datatype = 'DEC'.

  • Problem with the currency fields in the table cdpos

    Hi Gurus,
           I have observed one thing with the cdpos table like whenever we made changes to the currecy( and numeric fields also ,i am not sure ) fields ,then in the cdpos table it is showing a new entry for that change but not showing that old value, why? .But when we made any changes to date fields ,then it is storing that old date.
    So Is there any specific feature in this table.
    Thanks & Regards,
    Rakesh.

    Hello
    In ABAP-programm try this:
    DATA:       NEW LIKE CDPOS-VALUE_NEW,
          OLD LIKE CDPOS-VALUE_OLD,
          NEW1 TYPE MENGE_D,
          OLD1 TYPE MENGE_D.
    FIELD-SYMBOLS: <f> TYPE ANY.
    * make select from CDHDR and CDPOS
    IF CDPOS-FNAME = 'MENGE'.
      MOVE CDPOS-VALUE_NEW TO NEW.
      MOVE CDPOS-VALUE_OLD TO OLD.
      ASSIGN NEW TO <f>.
      CATCH SYSTEM-EXCEPTIONS CONVT_NO_NUMBER = 2
           OTHERS = 4.
           NEW1 = <f>.
      ENDCATCH.
      ASSIGN OLD TO <f>.
      CATCH SYSTEM-EXCEPTIONS CONVT_NO_NUMBER = 2
           OTHERS = 4.
           OLD1 = <f>.
      ENDCATCH.
    ENDIF.
    After this in NEW1 and OLD1 you will see values.

  • Purchase Requisition number : In which table the currency field stored?

    When we raise a Purchase requisition nr : t codes ME53N / ME21N
    the PR nr, item nr, PR doc type, PR group, plant etc are stored in EBAN table.
    PR amount can be calculated based on MENGE * PREIS / PEINH from the table EBAN.
    Where will be the PR amount currencies like 'EUR' or 'GBP' stored?
    How can we relate those Table with EBAN?
    Please let me know the exact TABLE for this.

    hi kpreddy
    before going to raise purchage order u must give the purchage requisition plan
    why we r going to purchage the material??? so many things to approve to purchage a material
    menge - purchage order quntity
          preis -
    that currencies depend upon the country wise purchage order..........

  • Cursor on the same field after validation (urgent.)

    Hi All,
      I m doin validation on certain field. if the user enters wrong value then error message should be given  along with the cursor should be in that field only.
    Here in my case what happens is the cursor goes to intial screen i want it at on that field where i have given the validation.
    What should i do for the same?
    Please help me with the same..
    Thanx in advance,
    Amruta.

    Hi,
    try this
    SET CURSOR FIELD 'P_DATE'.
    Message ..................
    OR
    Try to give out the error message inside a module inbetween
    Chain.
    field: <Fieldname>
    module Endchain.
    Regards,
    Omkar.

  • How to convert the currency field.

    Hi All,
    I have one question,
    data : w_icm like konv-kwert.
    but this w_icm value is like this 878.40
    but i want to change it as 878,40 and will get back in to the same variable (w_icm).
    can any one suggest me how to proceed with this issue.
    if you send the code that will be highly helpfull to me.
    Thanks for your help.

    Hi,
         1. Change the user profile (system->user profile->own data-> user dafault tabs and change the decimal notation.
      2. use the domain BF_RWBTR.
    Regards,
    GN
    Edited by: Niyaz Ahamed on Jun 13, 2008 2:30 PM

  • Offset for the currency field

    Hi frndz,
       i having a amount (2000.00)
    i need to convert to 2000
    and next i need to apply offset functonality
    to 2000 to split. but its telling this function cannt be applied for the p type data.
    Edited by: Alvaro Tejada Galindo on Apr 30, 2008 1:44 PM

    Just another option
    DATA:
      amt         TYPE p DECIMALS 2 VALUE '2000.00',
      amt2(10)    TYPE n,
      amt3(10)    TYPE c,
      leftover(2) TYPE c.
    amt2 = amt.
    amt3 = amt.
    SPLIT amt3 AT '.' INTO amt3 leftover.
    write amt3 to amt3 right-justified.
    WRITE:/ amt.
    WRITE:/ amt2.
    WRITE:/ amt3.
    Output
            2,000.00  
    0000002000        
          2000        

  • Urgent : Problem with Editable  ALV Grid  for Quantity and Currency Fields

    Hi All,
    I am using Editable ALV Grid display and have quantity and value as editable fields in the display.
    When user changes these values these values are not changing properly .
    For the quantity field the domain is MENG13 with 3 deciamal places and here  if we enter 500 it takes it as 0.500   .
    The same problem is for the currency field. Here the Domain is WERT7 with 3 decimal places.
    Here also it takes last 2 digits after decimal places by default.
    Please advice how to get proper values in this case from ALV editable fields.
    Thanks and Regards
    Harshad
    Edited by: Harshad Rahirkar on Dec 25, 2007 7:39 AM

    for all the currency field , it will display like that only.
    u have to manipulate uin program before displaying.
    if they are giving 500, in program multiply with 100 and move it to table.
    when u are getting from table, divinde and display.
    this is what I am doing.
    Reward if helpfull.

  • How to do the calculations with currency fields in table control?

    Hi everybody,
    Can anyone tell me how to do the calculations (arithmetical) with the currency fields which have been assigned for a table control fields? Actually they should be fetched from the database table and need to do some calculations and after that the same should get updated at the database level.
    Here, i am getting the short dump after doing the calculations and trying to display at the table control field itself.....
    Can anyone help me in this issue........
    Thank you very much.....in advance,
    Somu.

    Hi,
    Thanks to your replies all,
    But, even though the sign check box is checked in the SAP domain WRTV7, in my program it is not showing the negative sign at all...
    I am keep trying for all the options...
    But still it is not working out...
    My requirement is after fetching the data from the database i need to do calculations and save back same to the customized table field, for which the domain i have checked the sign and have done it also...
    I'd be highly thankful to you, if you can help me out...
    Thank you,
    Somu.

  • 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

  • Problem in Summing the value in one internal table. Its very urgent.

    Hi Experts,
    I have 10 fields in one internal table and based on the 8th field changing, I have to sum the 3rd field.
    I am unable to use AT END OF <FIELD8>, because any of the fields from 1 to 7 are changing, then this control break statement triggering.
    Could any body tell me, how I have to do this.
    Thanks,
    bsv.

    Hi,
    I think it could be as simple as below.
    DATA: l_field8 TYPE bla bla.
    READ TABLE itab
         INTO wa_itab
         INDEX 1.
    l_field8 = wa_itab-field8.
    LOOP AT itab INTO wa_itab.
         IF l_field8 NE wa_itab-field8.
              "Do the sum here
         ENDIF.
    ENDLOOP.
    Regards,
    Teddy
    Edited by: Teddy Kurniawan on Jan 25, 2008 8:38 AM

Maybe you are looking for

  • My array in the Vector is not working

    Hi all, I have my program sample where problem is the content of vector of (array) only produce the last items of the array, but during the for loop, my vector (m_Dist) gives the correct contents. my question is why is my vector produce such output?

  • Merging iWeb 06 site into iWeb 08 site

    Hi, I've looked around at other posts regarding this subject but don't really understand what's going on. I have an old site built in iWeb 06 that I want to use in iWeb 08. I have multiple copies of the Domain. I have a new site built in iWeb 08. The

  • How can i write in Hungarian? Version 11.0.07 adobe reader

    I am learning Hungarian and some of the files require me to type into certain areas of the worksheet. I have looked through the languages area in preferences section but it only has English. I am not highly tech savvy but i would imagine there may be

  • 5.1 Surround Sound speakers not working since 7.1 downloaded

    I'm not sure what is causing it...But I cannot get my surround sound speakers working with ITunes since I down loaded 7.1. They all work with Windows media player. Is therre any setting I should be aware of? Dell Dimension E510   Windows XP  

  • 'assert' in Eclipse @ 1.4

    Hi, I am coding the following line in Eclipse: assert true;The IDE keepsgiving me compile time error: Syntax error on token "assert", AssignmentOperator expected after this token.It does not like the syntax. My Java compile level is at 1.4, and ofcou