Showing posts with label MV45AFZZ. Show all posts
Showing posts with label MV45AFZZ. Show all posts

Tuesday, January 22, 2013

SAP ECC6.0 : Consignment Issue Custom Schedule Dates Auto Update

Six months ago, I had the task to do a custom implementation on the consignment issue document that it could automatically update the line item's schedule dates. Schedule dates like Goods Issue Date, Loading Date, Material Available Date and Transportation Plan Date. All these dates by requirement is to be updated according to Line Item's Delivery Date. The Delivery Date will determine all the Schedule Dates according to the Route's Transit Days. So to speak, we need to ensure that this change is only for consignment issue and no other document will be affected. 

Let's identified all those Schedule Dates that we need to modify or automatically update : 
  • VBEP-WADAT (Goods Issue Date)
  • VBEP-LDDAT  (Loading Date)
  • VBEP-MBDAT (Material Availability Date)
  • VBEP-TDDAT  (Transportation Date) 
Now, here's the challenge, how do I make sure the change takes place and it shows on Shipping Screen. There are two places of Shipping Screen that need to display the updated values. So, I identified two screens :
  • SAPMV45A - SCREEN 4552 (Line Item - Schedule Lines - Shipping Tab)
  • SAPMV45A - SCREEN 4921 (First Screen - Shipping Tab)
Modification for above screens requires 2 enhancement points and 1 user exit. 

1. SAPMV45A - SCREEN 4552 (Schedule Line - Shipping)
There will be one enhancement point here just to ensure the automatic calculation of those schedule dates are display at the screen. The enhancement point will be right after MODULE VBEP-EDATU_AUSGEBEN. That will be where the screen start to fill the schedule dates.

Inside the enhancement point, you should take into consideration of WORK DAYS and NON-WORK DAYS. The day, after Delivery Date minus Transit Days, falls on NON-WORK DAYS, then it should push back one day until it is a WORK DAY. 

In order to get the Transit Days, you need to query TVRO (SAP Table). The field that shows number of days is TRAZTD. This value is in hours and you will need to convert it to days. The function to do the conversion is 'CONVERSION_EXIT_TSTRG_OUTPUT'. 

After you have determine the number of Transit Days and WORK DAY/NON-WORK DAY, you will use the new date as your schedule dates. These schedule dates will be updated to XVBEP. 

2. SAPMV45A - SCREEN 4921 (Overview - TC - Shipping Default)
There is no modification here. The result is a result of calculation in MV45AFZZ. 

3. MV45AFZZ (User Exit)
The logic in SAPMV45A - SCREEN 4552 is applied here too. Same logic.

williamwilstroth... consignment issue, mv45afzz, tvro, traztd, route.

Tuesday, December 11, 2012

SCN RANT : My work and SCN is complicated to use!

The world's coming to an end. Serious? The Mayan calendar ended there meaning world ending on that day or their finance fiscal calendar ends on that period? :) Anyway, if SAP even existed that time, I guess they forget to maintain their factory calendar, SCAL, and let's hope we are able to celebrate 2012 Christmas. 

Working with ABAP has always been challenging since my training days (8 years ago!), no doubt about it. Early 2012, I had been focusing on modifying Sales Screens especially Shipping and line item's shipping tab. Based on shipment route (VBAP-ROUTE), to determine the Loading Date, Material Availability Date, Delivery Date, Goods Movement Date and few more dates. My solution to these fixes was modifying in program SAPMV45A at screen 4552 (PBO Module). You can do some manipulation to the screen value too. Okay, enough said and you can go along and play with it. 

On another hand, I have NOT used SDN since it, well, became SCN. I find it complicated and the original forum's topic has been moved and changed to somewhere unknown. Why did you guys, SAP, have to move it?? The original design was way much better to navigate and easier to find stuffs than the new one, duh! SCN just makes it complicated and the hopelessness hung there whenever you have to go to the guide to see where the ABAP forum has been changed to which page. The wholesome of using SDN as a forum is no longer as great as it used to be. Can the guys who are responsible for this SCN project give something better? I can neither ditch SCN nor ignore it because it is every SAP professionals life stream! Looking for ABAP resources was fun with the good old SDN until it became SCN... it is sucks, all the way...

Okay, enough ranting of SCN. Back to some of my current assignments which involve heavy modification of MV45AFZZ's routine (USEREXIT_SAVED_DOCUMENT) and IDOC outbound process (IDOC_OUTPUT_ORDRSP) was the longest enhancement of all projects. Not to say it is difficult but it requires the functional to spend hours of testing in order to get a thumbs up. The nature of the change was complex as it requires to listen to the slightest change in VA01 and VA02 screens e.g. change of order quantity, change of first date, or even change of header's info will trigger an IDOC Order Response. Of course, it is taken care now but the amount of energy and time spent in that room with two functionals to verify all the functionality is working and non original process is affected - is humungous!. Anyway, all is done and ended well. 

Now my next task is to determine why there is an error pop up when one line item gets firmed for consignment order. Talk about errors and bugs, Christmas is coming and I hope things goes well when I am not around. Merry Christmas to all readers who have come here to get some ideas and I thank you very much. Have a good Christmas and may the end of the world is just another merry day to you!


williamwilstroth... SCAL, IDOC, MV45AFZZ and end of world???

Thursday, February 11, 2010

SAP ECC6.0 : Auto Create SO (with ref Invoice)

A month more ago, I had undertook an assignment to modify a 3rd Party Commission report to be more dynamic and with the help of a functional along the way. That 3rd Party Commission had originally one type of reporting layout only. With the latest change, it has 4 types of reporting layout. One being able to automatic create Sales Order with reference to Invoice. The other 3 types of reporting will be just reporting only.  

What is more important in this entry that I had finally managed to full this assignment is the overall dynamics of automatic create Sales Order (SO) with reference to invoice. In order for this automatic creation of SO to work it requires a few implementation of User Exit, 2 routines (VOFM) and one customized table to control copy to procedure. The reason behind this requirement ie SO created with reference to Invoice must overwrite the Distribution Channel (VTWEG) checking in VA01; during the creation, SOLD-TO partner must be overwrite; line items in SO will be overwrite, MATNR, ARKTX and PSTYV (item category); and clearing the batch.
Therefore, the 3rd Party Commission report having the automatic SO creation is just a catalyst to fire-up a string of events in the process. The 3rd Party Commission's BDC just enter selected data in first screen, copy with reference is clicked, select first line item, and then clicked the save button. As I'd wrote 3rd Party Commission is just a catalyst so we will proceed to deeper discussion on the User Exits and Routines that will further fulfill this requirement.

Customize Table for copy-to-procedure control
Fields to consider control are VKORG, VTWEG, SPART, KUNNR, ICTP, MATNR, PSTYV, FKARV, and AUARN. Take special consideration on ICTP, IC meaning 2000 inter-company customers and TP meaning 1000 3rd party.

Routine : (VOFM-Copying Req-Orders)
In this part, I need to copy requirement Orders, routine 021, to modify the Distribution Channel (VTWEG) checking. Per standard, if SO being created with reference to Invoice have conflicting of VTWEG, it will display an error message. Therefore, routine 21 will be copied over and make the required changes to cater for Distribution Channel (VTWEG) checking. For a start, the customized table will be query against the VBRK's VKORG, VTWEG and SPART.

Routine : (VOFM-Data Transfer-Orders)
In this part, I need to copy requirement Orders, routine 003, to modify and update SOLD TO partners. As partners being copied SOLD TO, the SHIP TO and the rest will be deleted. Therefore, this routine is to control copying of partners of SO. Condition checking is similar Copying requirements of Orders.

User Exit : MV45AFZZ
1. USEREXIT_MOVE_FIELD_TO_VBAK
The purpose of this user exit is to update Distribution Channel (VTWEG) and update line item's Item Category (PSTYV). During this process, I looped XVBAP so its' line item's item category can be updated. However, there's one consideration to this point, customized table's KUNNR need to be check against KNA1 so to further validate ICTP field and KNA1's KTOKD. For example, if customized table's ICTP field is 'IC' and KNA1's KTOKD is '2000' meaning, PSTYV and VTWEG can be updated.

The above condition I wrote is only validated if VBAK-AUART and VVBRK-FKART matches customized tables' AUARN and FKARV. More important, I found out that for all this updates to be activated, there's this field called SVBAK-TABIX must be updated with a value '1'.

2. USEREXIT_MOVE_FIELD_TO_VBAP
The purpose of this user exit is to update MATNR, ARKTX, KWMENG, ZMENG, FKIMG, VTWEG_AUFT, and update item's position if Invoice is batch-split, and clear CHARG.

Condition for this user exit is similarly to USEREXIT_MOVE_FIELD_TO_VBAK.

There you have it, an automatic creation of SO with extra conditions in the background process. This implementation requires thorough understanding of SO creation. This is just one big part of the development.

You will need help from an SD functional who knows the whole concept of this implementation because there is a need to configure certain items especially allocation of certain item category that can be only use in this application. Therefore, functional and developer should work close with each other.

williamwilstroth... Invoice to SO in automation