How to cummuale the quantity
hi
how can i cummulate the quantity from multile records into one record from unique fields Plant,matnr,lgort.
please help me
Syntax Diagram
COLLECT
Basic form
COLLECT [wa INTO] itab.
Extras:
1. ... ASSIGNING <fs>
2. ... REFERENCE INTO dref
3. ... SORTED BY f
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Short Forms in Line Operations.
Effect
COLLECT allows you to create unique or summarized datasets. The system first tries to find a table entry corresponding to the table key. (See also Defining Keys for Internal Tables). The key values are taken either from the header line of the internal table itab, or from the explicitly-specified work area wa. The line type of itab must be flat - that is, it cannot itself contain any internal tables. All the components that do not belong to the key must be numeric types ( ABAP Numeric Types).
If the system finds an entry, the numeric fields that are not part of the table key (see ABAPNumeric Types) are added to the sum total of the existing entries. If it does not find an entry, the system creates a new entry instead.
The way in which the system finds the entries depends on the kind of the internal table:
STANDARD TABLE:
The system creates a temporary hash administration for the table to find the entries. This means that the runtime required to find them does not depend on the number of table entries. The administration is temporary, since it is invalidated by operations (such as DELETE, INSERT, MODIFY, or SORT). A subsequent COLLECT is then no longer independent of the table size, because the system has to use a linear search to find entries. For this reason, you should only use COLLECT to fill standard tables.
SORTED TABLE:
The system uses a binary search to find the entries. There is a logarithmic relationship between the number of table entries and the search time.
HASHED TABLE:
The system uses the internal hash administration of the table to find records. Since (unlike standard tables), this remains intact even after table modification operations, the search time is always independent of the number of table entries.
For standard tables and SORTED TABLEs, the system field SY-TABIX contains the number of the existing or newly-added table entry after the COLLECT. With HASHED TABLEs, SY-TABIX is set to 0.
Notes
COLLECT allows you to create a unique or summarized dataset, and you should only use it when this is necessary. If neither of these characteristics are required, or where the nature of the table in the application means that it is impossible for duplicate entries to occur, you should use INSERT [wa INTO] TABLE itab instead of COLLECT. If you do need the table to be unique or summarized, COLLECT is the most efficient way to achieve it.
If you use COLLECT with a work area, the work area must be compatible with the line type of the internal table.
If you edit a standard table using COLLECT, you should only use the COLLECT or MODIFY ... TRANSPORTING f1 f2 ... statements (where none of f1, f2, ... may be in the key). Only then can you be sure that:
-The internal table actually is unique or summarized
-COLLECT runs efficiently. The check whether the dataset
already contains an entry with the same key has a constant
search time (hash procedure).
If you use any other table modification statements, the check for entries in the dataset with the same key can only run using a linear search (and will accordingly take longer). You can use the function module ABL_TABLE_HASH_STATE to test whether the COLLECT has a constant or linear search time for a given standard table.
Example
Summarized sales figures by company:
TYPES: BEGIN OF COMPANY,
NAME(20) TYPE C,
SALES TYPE I,
END OF COMPANY.
DATA: COMP TYPE COMPANY,
COMPTAB TYPE HASHED TABLE OF COMPANY
WITH UNIQUE KEY NAME.
COMP-NAME = 'Duck'. COMP-SALES = 10. COLLECT COMP INTO COMPTAB.
COMP-NAME = 'Tiger'. COMP-SALES = 20. COLLECT COMP INTO COMPTAB.
COMP-NAME = 'Duck'. COMP-SALES = 30. COLLECT COMP INTO COMPTAB.
Table COMPTAB now has the following contents:
NAME | SALES
Duck | 40
Tiger | 20
Addition 1
... ASSIGNING <fs>
Effect
If this statement is successfully executed, the field symbol <fs> is set to the changed or new entry. Otherwise the field symbol remains unchanged.
Addition 2
... REFERENCE INTO dref
Effect
If this statement is successfully executed the reference to the relevant line is placed in dref. Otherwise the data reference dref remains unchanged.
Addition 3
... SORTED BY f
Effect
COLLECT ... SORTED BY f is obsolete, and should no longer be used. It only applies to standard tables, and has the same function as APPEND ... SORTED BY f, which you should use instead. (See also Obsolete Language Elements).
Note
Performance:
If you are still using internal tables with headers but, as recommended, keep your data in work areas with a different name, you do not need to assign the data to the header first in order to pass it to the internal tables. Instead, you should use the work area directly as with tables without headers. For example, "APPEND wa TO itab." is roughly twice as fast as "itab = wa. APPEND itab.". The same applies to COLLECT and INSERT.
The runtime of a COLLECT increases with the width of the table key and the number of numeric fields whose contents are summated.
Exceptions
Catchable Exceptions
CX_SY_ARITHMETIC_OVERFLOW
Cause: Overflow in the integer field when forming totals
Runtime Error: COLLECT_OVERFLOW
Cause: overflow in type P field when forming totals
Runtime Error: COLLECT_OVERFLOW_TYPE_P
Non-Catchable Exceptions
Cause: COLLECT on non-numeric fileds
Runtime Error: TABLE_COLLECT_CHAR_IN_FUNCTION
Related
APPEND, WRITE ... TO, MODIFY, INSERT
Additional help
Inserting Summarized Table Lines
Similar Messages
-
How to show the quantity in decimal in MIGO
Dear expert,
How to show the quantity in decimal in MIGO?? for example in material BOM the quantity is 12.480 but the quantity in MIGO is 13. it's automatically rounded.
what should I do to show the decimal point in MIGO?
Thanks
PaulineHi,
Please check in su3 -
defaults (Tab) -
Decimal Notation.
Change the decimal notation and logoff and login to apply the changes.
I think it may help you.
Regards
Sreedhar Reddy -
How to restrict the quantity & rate of MIRO with MIGO and PO
Hi friends,
Can any body tell me how to restrict the quantity & rate of MIRO with MIGO and PO.
e.g. if we have done MIGO for quantity 10 and the rate maintained in the PO is Rs.100.Then at the time of MIRO system should not allow to change the quantity and rate.
How we can do this?
Regards
Purnesh SharmaHi,
You are misunderstanding the use of MIRO.
If you change the details in MIRO you are NOT changing anything. You are just entering the price and quantity from the Invoice.
If this price and or qty is different from the GR aqty and PO price then the system will block the invoice for payment (and it can issue messages toinform the buyer if configured correctly).
The whole design of MIRO is based on the principle that you enter EXACTLY what the vendor has put on the invoice. By preventing the users from changing anything you will get NO mismatched invoices, but you will not be paying the vendor the amount specified on their invoice. This will surely cause problems.
If you do want to ensure that ONLY the GR qty and the PO price are used and cannot be changed then why not consider using ERS (Eveluated Receipt Settlement. this is basically self billing.
Effectively you will be paying the vendor based on what you have received in MIGO multiplied by the price from the PO. (which is what you would be doing if you stop any changes in MIRO)
Steve B -
How to incorporate the quantity formula in work centre
I have to incorporate the quantity in work center. if i m using a formula of operation quantity but it is giving me the error that u can only use the formula which has been defined as origin 2. can any one guide me how to incorporate the quantity formula in work center,
The situation is this my client asked me to incorporate the GR quantity as activity type, is there any provision in the system to incorporate the activity as standard value of workcentre i hav used the standard parameter provided for GR quantity but it has the dimension of time while every thing produced at my client location is either is KG or in Carton..
kindly guide me to resolve the issue.........Hi,
Create a Parameter "ZQUN" with Dimesion as "Mass" and standard value init "KG" and assign this parameter to a formula and assign the formula in the work center, define the standard quantity initially, at the time of final confirmation enter the actual GR quanitity.
Pls get back for any clarification -
Ck11n:how to calculate the Quantity?
Dear all.
I use the tcode ck11n to create material cost estimate with quality structure.
And input the parameter like below:
Material = 600000-000000-0012
plant = 1000
Costing Variant = PPC1
Costing Lot Size = 1
After press return,the sap show the Itemization for material like below:
20.11.2008 Dynamic List Display 1
Itemization for material 600000-000000-0012 in plant 1000
Material 600000-000000-0012
Plant 1000
Costing Variant PPC1 Standard Cost Est. (Mat.)
Costing Version 1
Costing Date from-to 01.12.2008 - 31.12.9999
Lot Size 1 KARCarton
Cost Base 1 KARCarton
Cost of Goods Manufactured
ItmNo
ItemCat
Resource
Cost Eleme
Total
Fixed
Currncy
Quantity
Un
1
E
J0103033 WC1 A03
1001
14,400.00
7,200.00
CNY
3,600
CAR
2
E
J0103033 WC1 A01
1001
25,200.00
10,800.00
CNY
3,600
CAR
3
E
J0103033 WC1 A02
1001
14,400.00
7,200.00
CNY
3,600
CAR
4
E
J0103033 WC1 A04
1001
14,400.00
7,200.00
CNY
3,600
CAR
5
E
J0103033 WC1 A05
1001
14,400.00
7,200.00
CNY
3,600
CAR
6
M
1000 600000-000000-0013
40000002
9.00
0.00
CNY
3
CAR
7
G
CC_AT01 41000001
41000001
2.25
0.00
CNY
82,811.25
39,600.00
CNY
At the first line,the Resource was "J0103033 WC1 A03",and the Quantity was "3600".
I don't know why the Quantity was "3600" or where the Quantity come from?
So I need someone tell me how to calculate the Quantity?
Thank you so much.
Regards
YodaHi,
Pl note the Item Category, " M "- Material - The 3 quantity has been picked up from BOM correctly.
You are referring to Quantity 3600, which is against item category - E. Item category " E" means Internal activity allocation i.e the date flows through assignment to Routing. Check the Work center, Cost center & Activity types J0103033 WC1 A03 1001.
Now i think it is clear.
Cheers !
Siva
Cost of Goods Manufactured
ItmNo ItemCat Resource Cost Eleme Total Fixed Currncy Quantity Un
1 E J0103033 WC1 A03 1001 14,400.00 7,200.00 CNY 3,600 CAR
2 E J0103033 WC1 A01 1001 25,200.00 10,800.00 CNY 3,600 CAR
3 E J0103033 WC1 A02 1001 14,400.00 7,200.00 CNY 3,600 CAR
4 E J0103033 WC1 A04 1001 14,400.00 7,200.00 CNY 3,600 CAR
5 E J0103033 WC1 A05 1001 14,400.00 7,200.00 CNY 3,600 CAR
6 M 1000 600000-000000-0013 40000002 9.00 0.00 CNY 3 CAR
7 G CC_AT01 41000001 41000001 2.25 0.00 CNY -
How to change the Quantity in Excise Invoice where PART1&2 are posted
Dear Gurus
I have a PO with 2 Qty
Where i have received GR for 1 QTY with excise invoice for 1 Qty
now the User is done GR for 2 Qty with excise details of 1 where Part 1&2 are posted
now i want to change the quantity from 2 to 1 in Excise Document and the GR
how to solve this issue
Please help meHi,
As you needed, 1st reverse GR document in 102 Movement type in t.code: MIGO and cancel the excise entries with t.code: J1IEX, go for post and then cancel for excise amount with entering Rejection Code in miscellaneous TAB.
Regards,
Biju K -
How to find the quantity of items under WIP job and under PO?
Hi,
How can I find the quantity of the Items that are under:
1. WIP Jobs that are not yet completed?
2. PO that are not yet received?
Kindly help me. If you have proper query for it, let me know.
Regards,
KMselect e1.empno,
e1.ename,
e2.direct_managed_employee_count
from emp e1,
select mgr,
count(*) direct_managed_employee_count
from emp
group by mgr
) e2
where e2.mgr = e1.empno
EMPNO ENAME DIRECT_MANAGED_EMPLOYEE_COUNT
7566 JONES 2
7698 BLAKE 5
7782 CLARK 1
7788 SCOTT 1
7839 KING 3
7902 FORD 1
6 rows selected.
SQL> SY. -
How to sum the quantity in opportunity ?
Hi all,
On the opportunity detail page, you can add an "opportunity product revenue". For each record you define the quantity and the purchase price. When you click on the "Update opportunity Totals", the revenue field from opportunity is automatically updated with the sum of the opportunity product revenues. I would like to do the same not with the revenue but with the quantity. Is it possible to do so, or is it an other way to get the sum of the quantity ?
Thanks for your answer.
Regards,
GuillaumeYou cannot perform this function within the native application and you would need to create a webservice query to complete this
-
How to change the Quantity in the Credit Memo using BAPI
Hi All,
I have a requirement in which i need to change the Quantity Value field available in the Credit Memo using BAPI.
Can anyone help me out to get any available BAPI to perform this action or any Solution to change the Quantity in the Credit Memo ?.
Regards,
Muruganand.KHi,
Try using BAPI_SALESORDER_CHANGE.
DATA: s_order_header_in LIKE bapisdh1.
DATA: s_order_header_inx LIKE bapisdh1x.
DATA: BEGIN OF i_order_item_in OCCURS 0.
INCLUDE STRUCTURE bapisditm.
DATA: END OF i_order_item_in.
DATA: BEGIN OF i_order_item_inx OCCURS 0.
INCLUDE STRUCTURE bapisditmx.
DATA: END OF i_order_item_inx.
DATA: BEGIN OF it_return OCCURS 0.
INCLUDE STRUCTURE bapiret2.
DATA: END OF it_return.
DATA: BEGIN OF i_sched OCCURS 10.
INCLUDE STRUCTURE bapischdl.
DATA: END OF i_sched.
DATA: BEGIN OF i_schedx OCCURS 10.
INCLUDE STRUCTURE bapischdlx.
DATA: END OF i_schedx.
s_order_header_inx-updateflag = 'U'.
i_order_item_in-itm_number = vbap-posnr.
i_order_item_in-TARGET_QTY = rv45a-zzqty.
i_order_item_inx-updateflag = 'U'.
i_order_item_inx-itm_number = vbap-posnr.
i_order_item_inx-TARGET_QTY = 'X'.
APPEND: i_order_item_in, i_order_item_inx.
i_sched-itm_number = vbap-posnr.
i_sched-sched_line = '0002'.
i_sched-req_qty = rv45a-zzqty.
APPEND i_sched.
i_schedx-itm_number = vbap-posnr.
i_schedx-sched_line = '0002'.
i_schedx-updateflag = 'U'.
i_schedx-req_qty = 'X'.
APPEND i_schedx.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = xvbap-vbeln
order_header_in = s_order_header_in
order_header_inx = s_order_header_inx
behave_when_error = 'P'
TABLES
return = it_return
order_item_in = i_order_item_in
order_item_inx = i_order_item_inx
schedule_lines = i_sched
schedule_linesx = i_schedx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
Change the fields as per your logic before populating orders item and schedule line data.
You have to pass the quantity in schedule line items as well in case you want to change quanity in order.
KR Jaideep,
Edited by: Jaideep Sharma on Jun 22, 2009 7:35 PM -
How to restrict the quantity in bex query?
Hi all,
i have created a query using infosets and it looks like this :
material cost tax amount units
madhb 21,693 1,443.42 99 each.
I want to restrict the query in such a way only one unit value need to be displayed.
How to restrict it by showing only single unit.
The expected result should be like this??
material cost tax amount units
madhb 293 144 1 ea
Can anyone let me know how to restict the quanity so the query will display the results only for one unit.
thanxs
harithaHi Pradiba santosh,
I have created a conditions and restricted the key figured.
zunit equal 1.
and i have saved and executed the query. But still it displayed for all the units. And it didnt display the query for one unit. Why is that so?
can you let me know what went wrong on it?
thanxs
haritha -
How to validate the quantity booked in sales order
Hi,
When a sales order is booked for a customer, a validation should be done for the quantity ordered on this particular customer,
If any order placed for an item beyond max order quantity for this customer, system should pop up some message or alert to the user.
This should take care of multiple entries of that item in the sales order lines.
Awaiting your valuable reply,
Regards,
PrasadHi,
If I understood correctly, a customer “C” can order at most 10 units, for example, in one order, however, “C“ can order 20 units divided in two orders, 10 units each.
If you use blanket sales order, you can define the maximum quantity that can be entered in each release. I made some tests here and it’s performing the validation only at the line level, not across all order lines as you require. I don’t know if this is the intended functionality. If it is, maybe a forms personalization could be used in order to validate the total ordered quantity against the quantity defined in the blanket sales order.
Another issue is that you will not enter the sales order directly into Sales Order form; you will need to find the blanket sales order and then create a release (sales order linked to the blanket).
In order to prevent user from entering orders to this customer with no reference to the blanket, it’s possible to define a security rule in OM preventing orders to this customers without a blanket sales orders reference.
Regards,
Ketter Ohnes -
In Free goods how to restrict the quantity to not to alter.
Dear All,
I have maintain condition record for free goods in VBN1.EX.102.While creating sales order for 20 quantities system populates 204.But if am changing this as 152 or 205,system is allowing to do.Same is the case at delivery.How can we restrict the system to not to allow the changes in sales order in case of free goods .Please guide me.
Regards,
DeeptiHi
KIndly check the below user exit and make the free goods item as in display mode
MV45AFZZ 'USEREXIT_FIELD_MODIFICATION'
to change the SCREEN-INPUT = 0 to make it display for free goods item category Tann
By doing above if any one changes main item system will accordingly change the free goods item also
Regards
Damu. -
How to display the Quantity and Rate fields in PO Report
I am trying to get a Purchase Order report that has the following fields in it.
1. Ordering Date
2. Purchase Order ID
3. Supplier
4. Product
5 Quantity
6. Rate
7. Amount (Quantity x Amount)
The reports under the Purchase Order WoC do not display Quantity and Rate.
Any more information like pointing to an Article or Help Topic is appreciated.
Regards
YagyeshTry the Purchase Order Volume report as your starting point.
I got everything you need onto that report in about two minutes (except quantity which may take longer).
The report can be found under the reports menu or you can find it under Business Analytics WoC if you have access.
I have been using the Business Analytics WoC for all of my reporting since it saves me the step of going to each WoC to look for the core reports.
Jim -
How to cummulate the quantity based on the date condition?
hi,
In my query,i need to cummulate the open quantity based on the two date condition.
If my Schedule line date > system date, i need to cummulate the open quantity.
But in my query level i am getting 0 or 1 based on the above condition.
i am struggling to cummulate the open qty based on the above condition.
can any body throws an idea to resolve my issue.
Regards,
ravi.Thanks for suggestion,Almost i narrow down my issue to get the proper result.
But i have one doubt.
Is it possible to user Formula variable (Processing by replacement path-Reference char as Scheduline date) in my Calculated Key Fig calculation.?? But here i am created Scheduline date as Characher infoobject.
Actually i am created Scheduline date as Character InfoObject,If i am using the following condition like
(Schedule line date > system date) its throwing "X" value.
For the above issue,if i am changing the Scheduline date as Key figure InfoObject means i will get the proper output for the condition(Schedule line date > system date) either 0 or 1.
Is it correct????
Regards,
Ravi. -
How to round the quantity in iprocurement
Hi,
I want to restrict from entering non round values like (0.3, 7.6, or 4.67) for unit of measures like Each,Case and Unit. As we can not have 0.3 in single piece. Whenever the user enters the non round value he should get an error message. Please can anyone help on thisHi,
Please check in su3 -
defaults (Tab) -
Decimal Notation.
Change the decimal notation and logoff and login to apply the changes.
I think it may help you.
Regards
Sreedhar Reddy
Maybe you are looking for
-
I am sorry nhylo this your answer I hope it will help you
MAC OS iMac There are several versions of the iMac computer. The first two versions (referred to as revision A and revision B) were colored Bondi Blue. The next version (referred to as revision C) was introduced in January 1999 and came in five diffe
-
I bought the app Dark Knight Rises and I can not download
I bought the app Dark Knight Rises and I can not download, always gives error in the middle. Can someone help me
-
Need help reducing file size.
We're using Acrobat 8 Standard and are able to reduce an 8 MB file down to 7 MB but a fellow employee with Acrobat 9 Pro was able to reduce the size of the same file to 1.8 MB. We're doing the same function (Reduce File Size) in both apps so we're no
-
Dear SAP gurus, Is it advisable to delete the error BDocs in SMW01? There is one case where when i deleted one of the error BDocs in SMW01, the changes that were made, were reverted. What should be the best way to do if i would like to clear off all
-
How to add log to an application
Hi, Can anyone give me the procedure for how to add logs to my application Regards Padma