LSMW for PO change

I stumbled upon the following links for changing purchase orders via LSMW. It uses idoc method which uses message type PORDCH

http://www.saptechnical.com/Tutorials/LSMW/BAPIinLSMW/BL1.htm  (nicely explained with screenshots)

http://help-sap.blogspot.com/2012/07/po-re-price-issue-in-bapipochange.html (a problem I faced with repricing)

http://www.sapfunctional.com/MM/Automatic/Adjustment.htm

Interestingly, if you need to reprice the PO, you cannot set the price date and allow the system to take over. I have found that the only way to reprice the POs is by passing:

– Price date control 3 (current date)

– Calculation type to B

It does work very well!!

Most consultants prefer the recording option since it is more intuitive. Anyone would agree that it is definitely not the most optimal. Thankfully SAP has provided a large number of tools to make it work. All you need is to pass the appropriate parameters from the input file and it actually works!

We have used standard LSMW objects for the following (there are a lot more)

  • Material Master
  • Vendor Master
  • Purchase Order
  • Info Records
  • Condition records
  • Customer Master

Internal price condition in purchase orders

In SAP MM, we have the concept of internal price which can be used in various places.

The internal price is defined a condition category G. An example is below (I have copied from PB00 and removed the access sequence)

condtyp
The magic of the Internal price works in the following manner:

In STOs containing supplying plant (EKKO-RESWK), the price (Standard or Moving average as the case may be), the price at the supplying plant is considered.

Where the supplying plant does not exist, the material’s price at the receiving plant is considered.

The condition type is useful for situations where cost + mark-up strategies are used for transfer pricing.

Valuated stock in transit

The link below explains the concept of valuated stock in transit a feature in SAP since ECC 6 EHP 5.

http://wiki.scn.sap.com/wiki/display/ERPSCM/Valuated+Stock+is+Transit

 

It is also possible to have goods issued to customer without immediate ownership transfer.

The technique is mentioned in the link below.

http://scn.sap.com/docs/DOC-48809

Key takeaways:

– When a delivery is PGI’ed the stock moves to in transit and can be viewed using MB5SIT (This a new Tcode). The movement type in question is 687 instead of 601.

– A POD transaction (VLPOD) is run which transfers the ownership to the customer and hits COGS.

 

This should be useful while handling client requirements.

Determining cost center automatically for DIF line items

Consider the scenario: During invoice verification, it is found that a vendor invoice amount is often a ’rounded’ form of the expected amount (from PO/GR). The small differences are passed into a GL account which is defined in OBYC against the key DIF. Check the following link for more.

https://aroopsnotepad.wordpress.com/2013/09/27/rounding-off-in-invoice-verification/

If the GL account assigned to DIF is a P&L item and it has a cost element assigned to it, it longs for a CO object resulting in an error Account xxxx requires assignment to a CO object.

The general technique is to assign a default cost center against the company code and cost element in OKB9. But what to do when the cost center needs to be derived from the profit center (or plant)? The OKB9 configuration does not work since neither the profit center not the plant gets passed into the line item for rounding differences.

You can ‘push’ the profit center or the plant to the line item by means of an enhancement.

In the include LMRMPF09, form accit_dif_aufbauen, the system generates the difference line item.
At the end of the form, use the enhancement point to update the profit center.

ptx_accit[] is an internal table which contains all the FI line items.
The enhancement can identify the row containing DIF and then change profit center / plant.

dif

In the screenshot above, the profit center is forced into ptx_accit internal table in the line item containing DIF.

Once the profit center is found, the system can derive the cost center automatically using the standard OKB9 configuration.

The above subroutine is called both during simulation as well as posting. It is also called during MR8M (cancellation of invoices).
ERS would not have this issue, since the vendor invoices are not physically entered.

A sample code is below.

Lets assume the requirement is that

a) Tcode is MIRO or MR8M

b) A DIF line item exists (implies there is a value to be rounded off)

c) The profit center of the difference line item must be the same as that of the WRX line item (ie the GRIR clearing account)

*** enhancement starts

field-symbols: <lf_accit_dif> type accit, <lf_accit_wrx> type accit.

if sy-tcode = ‘MIRO’ or sy-tcode = ‘MR8M’.

read table ptx_accit assigning <lf_accit> with key ktosl = ‘DIF’.

if sy-subrc = 0.

read table ptx_accit assigning <lf_accit_wrx> with key ktosk = ‘WRX’.

if sy-subrc = 0.

<lf_accit_dif>-prctr = <lf_accit_wrx>-prctr.

endif.

endif.

endif.

 

Rounding off during invoice verification

One of the issues faced during invoice verification is the case of ’rounding’ where the vendor’s invoice amount is ’rounded’ off to the nearest integer or 10 (depending on the currency).

To take care of this issue, the solution is to enter the total invoice amount at the top, even though the balance is not zero.

The system would allow posting if the difference is within the tolerance limits configured.

Capture

The difference hits MM differences GL account.

The tolerance can be configured in the following node:

IMG > Materials Management > Logistics Invoice Verification > Invoice Block > Set Tolerance Limits

Enter the tolerance amount in local currency against the company code and tolerance key BD.

The GL account can be configured in OBYC against transaction DIF.

Changing exchange rate in MIRO

A friend asked me how to set exchange rate manually in MIRO. Of course this is applicable only for foreign currency purchase orders. The technique goes like this:

1) Go to MIRO
2) Enter Invoice Date, posting date, reference number and the foreign currency.
3) Go to Details tab page & enter the desired exchange rate.
4) Enter the PO No & Press Enter

It does work!

Thanks to my friend and the one who gave me the answer in the following link.

http://scn.sap.com/thread/3202199

Material document custom number range

The number range of material documents is maintained at transaction/event type level, and there is no control for the same.

Normally, there is no exit / BADI to have custom defined number ranges for material documents. The following FM can be enhanced for this purpose

MB_CREATE_MATERIAL_DOCUMENT

An enhancement can be made using xmkpf and xmseg to generate and use a custom number. This number can to be stored in save_mblnr.

I have seen it working in one of our clients. This does not work with MB1* goods movements. This works with MIGO and movements created from deliveries etc (haven’t checked the others)

For the older goods movement transactions (like MB1*), an enhancement spot needs to be created at the beginning of the include MM07MFF0_FCODE_BEARBEITEN. Like in MIGO, store the material document number in save_mblnr.

The attached document gives further detail.

Material document customer number range

Service PR with non local currency

If you have ever tried creating a service purchase requisition using ME51 / ME51N, you will realize that the services or the limits tab will not allow you to change the currency. Now this currency may be defaulted either from the company code, or from personal settings. I realized that this is a bug, but there is a workaround. The steps are in the attached pdf.

A summary:

  1. Create PR with account assignment category (F, K or whatever you want to use) and NO item category (make sure the item category is blank).
  2. In the valuation tab, enter the currency you want to use and then press Enter.
  3. Now type the item category D; and voila you have Services and Limits tab with the new currency!!

Service PR in non local currency