Tuesday, October 5, 2010

SAP ECC6.0 : Project SI

This entry is long overdue and I was busy with my job transition. Nevertheless, Project SI had took me to almost half a year to complete (with development, testing and a series of correction) and making the whole process stable. I think the development is still on-going even though the leading functional and the developer had left too. 

This process involved multiple partner sending from one purchase order IDOC (WMMBXY) and certain PO documents with certain account assignment to automatically and dynamically assign FOC, header text and update delivery address. In this entry, I will only touch on the FOC, Header Text, and updating Issuing Storage Location and the delivery address. Though, I personally developed the first and the last part, the middle process was taken over by an ex-colleague before I returned back to this project. 

The first part was so to have a BADI that could manipulate FOC (EKPO-UMSON) in the Purchase Order Creation/Change (ME21N/ME22N) and at the same time catering Header Text Change. Therefore, I'd made use of the following objects :

BADI - ME_PROCESS_PO_CUST,
  - Method : process_item
      - Z_MM01_SI01_INCO_SHIPPING, to update incoterms
      - Z_MM01_SI01_FOC_SO_PO, to update UMSON field
      - Z_MM01_SI01_SHIP_TO_PARTY_ADD, to change ship to party (SH)
  - Method : post
      - Z_MM01_SI01_MY_POST

Then at later stage, it was a requirement to be able to automatically update the line items' supplying storage location based on a customized table:

BADI - MD_EXT_SUP
  - Method : get_supplying_sl
      - Z_MM01_MY01_GET_SUPPLYING_SL, to update supplying storage location

Finally, to be able to refresh and make the changes to earlier FOC and INCOTERM more flexible even though it is automatically updated. Hence the following code allow user to be able to change those updated fields too. 

BADI - ME_PURCHDOC_POSTED
  - Method : posted
      - Z_PU01_MY01_POSTED

Apart from the above enhancements, there is another enhancement need to be taken care, which is, the 3rd Eye Program that do updates on PO based on Inbound IDOC. This is another program that requires all of the above enhancements to be running in the background.  Hence, the following programs were included in my enhancement. This is not particular to any other projects but if there is any resemblance, this can serve as a reminder to take care of external processes.

IDOC FM : Z_MM00_IDOC_OUTPUT_ORDERS_3PL
   - This function module will eventually call below FM to update

3rd Eye PO Create
   - FM : ZMMPU00_UPDATEPO_3RDEYE_EX

williamwilstroth... BADI, ME21N, and ambition!

Saturday, June 12, 2010

SAP ECC6.0 : Tracing LT1E/3/D series

Last month assignment, I had to help a colleague of mine to put a user exit to LT1E (Transfer Order Confirmation) so that it sends out an IDOC to vendors. In every standard SAP, of course, types of enhancement-points are provided like User Exit, BADI and Enhancement too. Unfortunately, LT1E had a component in USER EXIT that you can use to determine an IDOC once user confirm a TO (Transfer Order). Unfortunately, this user exit can only be detected (tracing) only if you set your debug mode as 'Update Debugging'. Below are my findings and hope it helps you in your development:

To update certain
1.Set your debug mode as Update Debugging
2.Put a break-point at your desired line.
3.Start debugging

Update_task will trigger the calling function when it reaches COMMIT_WORK. Update_Task treats itself as 1 LUW (Logical Unit of Work) after COMMIT_WORK any subsequent point it reaches.

Flow of debug for LT1E
1. Put a breakpoint in SAPLSEXE->LSEXEU21->SXE_IMPL_RELEASED_FOR_CUSTOMER->LINE 39
2. Then go to Settings/Change Debugger Setting/Tick Update Debugging
3. Then put break-point at SAPLL03T->LL03TU02->L_TA_QUITTIEREN->Line 428 (Customer-function '002').
4. Test your LT1E.

FLow of debug for LB13
1. Then put break-point at SAPLL03T->LL03TU01->L_TA_HINZUFUEGEN->LINE 182 (Customer-function '001').

Flow of debug for LT1D
1. Then put break-point at SAPLL03T->LL03TU02->L_TA_QUITTIEREN->LINE 428 (Customer-function '002').
 
Note : All your user exit to use is Customer-Function '002'/'001'. From here you will be able to know what user exit's component to use.

williamwilstroth... unfolding LT1E,1D,LB13...
 

Wednesday, April 28, 2010

SAP ECC6.0 : DEVELOPER_CHECK

Lately I had quite a number of major developments and all of them have to do UAT nearly at the same month and same time. It's heart wrenching if all developments have to be finished because you need to crack your head to organize correctly so all your developments can be finished on time. Well, I did my best for all though there cracks here and there. Okay, back to my latest contribution for this entry.

Have you (developer) ever thought of controlling certain variables, logic or feature that can be turn on by developers only? On one hand, users or functionals will not be able to see it. These kind of controlling is usually to facilitate developers to debug easier and understand problems faster. I'd always wanted one feature that the program can detect the user is a developer so I finally found one function module that can do this. This function module is 'DEVELOPER_CHECK'.

DEVELOPER_CHECK normally is activated and run when a new developer gotten his/hers user id tries to use SE38. At this point, a dialog will pop up to request for developer key. This pop up is given by DEVELOPER_CHECK function module. However, it can be use for other things.

DEVELOPER_CHECK has this parameter SUPPRESS_DIALOG which you can put an 'X' to it so the dialog requesting for Developer Key is not display. Hence, this make it a good function to be put in the program to check if the user is a developer. The effect of a developer encountering this function module is a '0' returning to SY-SUBRC. Else SY-SUBRC not equal to '0'. Hence, this function module can be use by developers to create a method to open up any additional features in customized programs.

DEVELOPER_CHECK can be use in customize reports with update to database or other concepts. This DEVELOPER_CHECK might not be usable when a report is running in background mode because it will not be raise. Another method to trace a process in background is to create Self Trace Log. Self Trace Log concept will be discuss later in another entry.

williamwilstroth... DEVELOPER_CHECK

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

Friday, January 22, 2010

SAP ECC6.0 : Classification of Batch Master

Recently, one of my last assignment to a project requires me to query classifcation batch of material for a WMMBXY outbound IDOC. This query only requires 2 fields for the extended segments. This classifcation batch of material, standard way, you can view it through MSC2N. To query it you need to have 2 function modules to get the value.



FM 01 : CLAP_DDB_UPDATE_CLASSIFICATION


FM 02 : CLFM_SELECT_AUSP

The first function module based on material and batch will produce the object number that identifies the group of characteristic of batch referrring to a material. This identification object number will be use by the second function module will produce lines of items of characteristic in an internal table. This internal table EXP_AUSP will be the result table.

Some of the tables that these two function module uses are KLAB and AUSP. AUSP is your characteristic batch transparent table that you can use it manually (programmatically) in your reporting and enhancements. However, I recommend that you use above two functions. Actually, these two SAP standard function modules are applied in MSC2N standard coding.

williamwilstroth... classification of batch by material