Get Valuation Type (BWTAR) of the last material movements (MM)
Hi people,
My requirement is to create a program to make negative adjustments to material stocks (using BAPI_GOODSMVT_CREATE). As incoming data I have the material along with the quantity to be adjusted. Plant (WERKS) and Storage location (LGORT) are fixed. If the adjustment quantity is inferior to the total stocks on all the batches (I'll get the values from MCHB table and sum them up - Batch and Valuation type in this cases are considered the same, so field CHARG = BWTAR), then I need to know which where the lastly adjusted valuation types, and then make the adjustments on that valuation types.
Which leads me to my question: How do I know which were the latest valuation types for a given movement (101 or 311 in this case) and material? Is the only option to search in tables MSEG/MKPF ordering by date (getting the latest material documents? Do I have other options?
Thanks for your help.
Hi Sai, many thanks for your reply.
But don't think your suggestion would work, because this batches are already created. Besides if I enter to MSEG table only with movement and batch as keys, i'll get thousands of records since this batches are not unique as in other cases.
I don't only need the latest batch, i need the latest batches till the quantity is
covered. Because the quantity to adjust can be greater than that of the latest batch.
I'll give you an example: suppose the actual stocks for a given material in a plant/stge.Loc. are like this:
Batch1 = 30,0
Batch2 = 30,0
Batch3 = 30,0
and they were entered in that order. So my program receives a negative adjustment of 45,0: I need to adjust Batch3 to 0,0 and Batch2 to 15,0.
The problem lies in: how do i know i need to adjust Batch3 first, then Batch2 (and go on till there's nothing to adjust)?
I've been thinking in doing something like this (after verifying that MCHB stocks are greater):
DATA:
BEGIN OF i_movs OCCURS 0,
mblnr LIKE mkpf-mblnr,
mjahr LIKE mkpf-mjahr,
bldat LIKE mkpf-bldat,
cputm LIKE mkpf-cputm,
bwtar LIKE mseg-bwtar,
menge LIKE mseg-menge,
meins LIKE mseg-meins,
END OF i_movs.
SELECT
a~mblnr a~mjahr a~bldat a~cputm
b~bwtar b~menge b~meins
INTO TABLE i_movs
FROM mseg AS b
INNER JOIN mkpf AS a ON
a~mjahr = b~mjahr AND
a~mblnr = b~mblnr
WHERE
*-There's an index to this four fields so access should be quick
b~matnr = 'A1111111111' AND
b~werks = k_werks AND
b~lgort = k_lgort AND
b~bwart IN ('101', '311') AND
NOT bwtar = ' '.
SORT i_movs DESCENDING BY mblnr mjahr bldat cputm.
And then loop and take the valuation types from my internal table...but i'm not quite satisfied with that because i'll get ALL movements for the material, so the program will grow slower with time as new GM documents are created...
Any other ideas?
Thanks again.
Similar Messages
-
I accidentally deleted an Application on my iphone 5 and with it lost important files. How do i get back these files. The last iphone backup sync was after this so I cant even access an older back up as I cannot find them. How do I get back my Lost files.
On your iMac launch iTunes and at the top next to the Apple symbol click iTunes > Preferences > Devices and tell me what you see. You last sync should be there showing only a device name. If you have an older backup it will be there as well the difference is it will be the device name with a date and time stamp. Sync and backups are two different things and there is a chance iTunes made a backup the first time you hooked up your iPhone 5.
-
I have an iPad that is now over twelve months old, it doesn't get over used, however in the last few days, it has started to get very hot after only a few minutes use, is this a fixable issue
Is it getting hot only when charging?
Not normal. Take it to an Apple Store for evaluation.
Make a Genius Bar Reservation
http://www.apple.com/retail/geniusbar/
Cheers, Tom -
When watching a movie every 7 seconds there is a very short freeze or shutter. The last 5 movies have had this problem. Iam unsure what to do.
Welcome to the Apple Community.
Check that no special effect or enhancement feature has been turned on on the TV itself. -
How do I get email to display only the last 50 or 100 emails ?
How do I get email to display only my last 50 or 100 emails?
I think I figured it out. I downloaded all the email in my wife's hotmail account(500) to the iphone and then deleted 350 of the emails on the iphone. then I set the iphone to look for the 200 most recent messages. When I did this the iphone updates all the new emails and the old ones that I deleted on the iphone are still in hotmail.
Mike -
Get results from database for the last one week ?
Hi All,
I have to make a query for retrieving the data for the last one week from a table say "Orderdata".
So can anybody please tell me how to retrieve date of last weak from the current date. I mean if current date is 12/08/2004 (mm/dd/yyyy) then I would be needing date as :--
12/01/2004 (mm/dd/yyyy) to 12/07/2004 (mm/dd/yyyy).
To more clear, here is the query that am using :
select * from orderdata where orderdate between 12/01/2004 AND 12/07/2004
I know I would be needing java.sql.timestamp class to set date . but it is the last thing to do .
First I have to get date of last weak...........
Here is the code----------that i have just start to write ..
Calendar cal;
TimeZone tz;
String estTimezone="GMT-05:00";
tz=TimeZone.getTimeZone(estTimezone);
cal=new GregorianCalendar(tz);
cal.setTimeZone(tz);
String currentdate=String.valueOf(cal.get(Calendar.MONTH)+1);
currentdate+="/"+String.valueOf(cal.get(Calendar.DAY_OF_MONTH)-1);
currentdate+="/"+String.valueOf(cal.get(Calendar.YEAR));
out.println(currentdate);And assume if current date is 12/1/2004 (mm/dd/yyyy) then subtracting -1 form the current date will give 12/00/2004 so not getting the correct result .
Hope it is clear to all................
Please Help !
amitindiahttp://forum.java.sun.com/thread.jspa?threadID=577953&tstart=0
-
I was burning an audo book to CD. It was six CDs long. After the fitth CD I inserted one that was defective and itunes just ended, as though
the burning had been completed. Now I have five of the six CDs.
1) Why did it do this instead of telling me I had a bad disk or something?
2) Is there any way to get it to re-burn just the last disk instead of having to re-burn all of them?sure pretty simple. make a backup of your current settings
http://support.apple.com/kb/HT1766?viewlocale=en_US
then restore device from old backup you need pics off of
then import pics to computer
http://support.apple.com/kb/HT4083
you may need to save pics to camera roll first
then restore the new backup and sync pics back to phone via itunes
Peace, Clyde -
is there anyway i can retrieve recent text messages from the last 2 days and have them printed off after they have been deleted from my phone? this is seriously important i need this for an attourney!
click here:
Re: Can I request to get the content of old text messages -
Is anyone else getting lots of popups in the last few days
the last few days I have been getting constant full page pop ups even though my popup filter is on, anyone else having this problem
Do a malware check with some malware scanning programs.<br />
You need to scan with all programs because each program detects different malware.<br />
Make sure that you update each program to get the latest version of their databases before doing a scan.<br />
* http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
* http://www.superantispyware.com/ - SuperAntispyware
* http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
* http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
* http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
See also:
* "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked -
How to get safari to open to the last page I was on and screens to enlarge automatically?
Hello, I just upgraded to the latest iMac version from my 2010 model, and whenever I close and open up safari it opens to top siotes instead of the last page I was on, and every time I open it I have to enlarge it myself by clicking the arrows in the top right. Same happens with everything else, like the app store. How do I change this so whenever I go to safari it opens to the last page I was on and has safari, app store, etc. have large screens right away? I set up my old iMac 3 years ago, and I guess I must've done something to have it do this, but I forgetn what I did. Thank you in advance
Hello there, Clumn.
The following Knowledge Base article provides some general tips for Mavericks that may address your issue:
OS X Mavericks: General preferences
http://support.apple.com/kb/ph13803
Particularly of note:
Close windows when quitting an application
If you quit apps with windows still open on your screen, selecting this checkbox prevents the windows from reopening automatically the next time you start their app.
This feature when not selected will allow the application to reopen windows automatically when you open the app.
Additionally, this article provides information on how to set windows Full Screen:
OS X Mavericks: Take apps full screen
http://support.apple.com/kb/PH14302
Thanks for reaching out to Apple Support Communities.
Cheers,
Pedro. -
<blockquote>Locking duplicate thread.<br>
Please continue here: [/questions/816789]</blockquote><br>
In Firefox 3.6 the back arrow button to go back a page also had a down arrow button that would let you jump back multiple pages. How can I get that to show in Firefox 4?The arrow to open the tab history of the Back and Forward buttons has been removed in Firefox 4.
Use one of these methods to open the tab history list:
* Right click on the Back or Forward button
* Hold down the left mouse button on the enabled Back or Forward button until the list opens
You can look at this extension:
* Backward Forward History Dropdown: https://addons.mozilla.org/firefox/addon/backforedrop/ -
Hi,
Experts,
I am able to get the subtotal text but i am not able to get the grand total text please pass some code or idea on it.
ex:
2510 gopi 10
2511 gopi 20
subtotal 30
2521 anand 20
2522 anand 10
2523 anand 50
subtotal 80
2512 vikram 30
subtotal 30
(blank----) 140.
Here i want to get text as 'COMPANY TOTAL'. by using REUSE_ALV_GRID_DISPLAY FM.
Thanks,
Shabeer ahmed.Hi,
you can get the 'COMPANY TOTAL' by using the following code:
LOOP AT i_main INTO w_main.* Storing the Total text need to be displayed in
ALV
w_final-total = 'COMPANY TOTAL'.
w_final-field1 = w_main-field1.
w_final-field2 = w_main-field2.
w_final-field3 = w_main-field3 .
APPEND w_final TO i_final. ENDLOOP.
Regards,
Santosh -
How to I get photos to show "in the last week" smart album
The images will not show in this pre-set smart album. They do show in my son's library, but not in mine. As far as I can tell all the settings are the same. What am I doing wrong?
Do you a filter set by any chance? Clear the filter of the Browser by clicking the "x" at the right side of the Search Field. The gray text in the field should say "Unrated or Better".
If that doesn't do it, check the Smart Album settings. Select the Smart Album, then click the magnifying glass. Are the settings what you expect? -
The music player always reverts back to where I started the day before at a low volume and it's driving me mad! On a previous phone with earlier IOS there was the option to play from where the track left off when stopped - how do I find this option now?
If you click on the column headings in iTunes it will sort the tracks by the column you have selected.
Try clicking on the Album column, this should then put the tracks in the right order. You probably have the Track column selected which will keep the tracks in alphabetical order by Track name.
Ian -
How to get(select) slowest selects in the last week
Hi,
i had to find the slowest select statement in my dba. It's a 9i Database no Grid Control is installed :-(
thanks
WolleYes, if you had taken the snap(statspack), then you can take statspack report for the snap ids and find out that.
Regards,
Jaggym
Maybe you are looking for
-
Is there a better way to add int arrays together?
I'm working on a project that will add arrays of integer together...all element are nonnegative integers For example A = [0 1 2 3] I need to find an algorithm to find 2A= A + A, 3A = A+A+A....., hA = A +...A ( h times) For 2A, the result array will l
-
How do I scan a photo and move it to iPhoto?
I know that I can transfer images from my printer to iPhoto because I've done it before. I guess it's been a long time and I've forgotten how. I've tried placing a photo on my HP Deskjet 4480 glass and pushing scan. I just get multiple print outs and
-
I'll never cope with the pivot. May you check this code please guys...: select * from archivebilled pivot ( sum([month charge]) for [element code] in ('august','september','october','december')) Incorrect syntax near august
-
Complete documentation of Oracle 10g
Have anyone a electronical docuemt about the functionality of Oracle 10g. my email: [email protected] Thanks
-
I already gave the details in the question.