Friday, October 26, 2007

Delivery Pricing Conditions

Configure the pricing procedure at delivery with the required condition type to determine freight. Also have the copying control from delivery to billing at item level with Price source as D for Delivery. While you execute billing you would get the prices from the sales order as well as from deliveries.

If you were to look at the pricing procedure RVAA01 you will see there was a section dedicated to the various freight charges. Normally, I would use one of the available condition types and create a condition master based on the Incoterms.

Configuration path :-

IMG -> Logistics Execution -> Shipping -> Basic Shipping Functions -> Pricing

Hiding condition type VPRS - OSS note 105621

It tells you to modify userexits: USEREXIT_FIELD_MODIFICATION, USEREXIT_FIELD_MODIFIC_LEER,
USEREXIT_FIELD_MODIFIC_KZWI, USEREXIT_FIELD_MODIFIC_KOPF and USEREXIT_PRICING_CHECK.

It also tells you to create two new includes: ZZAUTH01 and ZZAUTH02, but it doesn’t tell you what changes to actually make in any of these. I am assuming that the authority checks have to be added somewhere, but what goes where?

The coding for includes ZZAUTH* are (create them in SE38 like INCLUDE, and althought note say that dev.class must be VF, I have them with own dev.class ie: Z**, and it works)

include ZZAUTH01
*&———————————————————————*
*&———————————————————————*
*& Object REPS ZZAUTH01
*& Object header PROG ZZAUTH01
*&———————————————————————*
*& This object has been generated from an advance correction *
*& attached to a R/3 note.
*
*&———————————————————————*
*&———————————————————————*
*& Title: Authority check for displaying fields *
*&———————————————————————*
***INCLUDE ZZAUTH01.
* Beim ersten Aufruf ist KOMV initial; OLD_KOMK löschen,
* damit auf jeden Fall Berechtigungsprüfung durchgeführt wird.
* Sicherheitshalber zunächst Berechtigung verweigern.
* if komv is initial.
IF SCREEN-NAME = ‘FCODE’.
CLEAR OLD_KOMK.
AUTH_SUBRC = 4.
ENDIF.

* Berechtigungsprüfung auf Kalkulationsschema und Stufen-Nr.
* Beim Wechsel der KOMV-Zeile einmalig eine Berechtigungsprüfung
* durchführen
IF KOMK-KALSM NE OLD_KOMK-KALSM OR KOMV-STUNR NE OLD_KOMV-STUNR.
AUTHORITY-CHECK OBJECT ‘Z_KONH_KLS’
ID ‘ZKALSM’ FIELD KOMK-KALSM
ID ‘ZSTUNR’ FIELD KOMV-STUNR
ID ‘ACTVT’ DUMMY.
AUTH_SUBRC = SY-SUBRC.
OLD_KOMK = KOMK.
OLD_KOMV = KOMV.
ENDIF.

IF AUTH_SUBRC NE 0 AND ( SCREEN-NAME = ‘RV61A-SELKZ’
OR SCREEN-NAME = ‘KOMV-KAWRT’
OR SCREEN-NAME = ‘RV61A-AWEIN’
OR SCREEN-NAME = ‘KOMV-KBETR’
OR SCREEN-NAME = ‘RV61A-KOEIN’
OR SCREEN-NAME = ‘KOMV-KPEIN’
OR SCREEN-NAME = ‘KOMV-KMEIN’
OR SCREEN-NAME = ‘KOMV-KWERT’ ).
SCREEN-ACTIVE = 0.
ENDIF.
MODIFY SCREEN.
* Ende Berechtigungsprüfung

for include ZZAUTH02

***INCLUDE ZZAUTH02 .
*&———————————————————————*
*&———————————————————————*
*& Object REPS ZZAUTH02
*& Object header PROG ZZAUTH02
*&———————————————————————*
*& This object has been generated from an advance correction *
*& attached to a R/3 note. *
*&———————————————————————*
*&———————————————————————*
*& Title: Authority check for creating new conditions *
*&———————————————————————*
***INCLUDE ZZAUTH02.
AUTHORITY-CHECK OBJECT ‘Z_KONH_KLS’
ID ‘ZKALSM’ FIELD KOMK-KALSM
ID ‘ZSTUNR’ FIELD KOMV-STUNR
ID ‘ACTVT’ DUMMY.
IF SY-SUBRC NE 0.
MESSAGE E609(VH).
ENDIF.
* Ende Berechtigungsprüfung

*&———————————————————————*

In my system (46B) I remember that the subroutines USEREXIT is not changed for this purpose. With SU21 (z_konh_kls I think that you don’t have problems), like with SU02.

In su02, remember that in XU180-PROFILE of first dynpro, you must populate with value ‘ZCOND_STD’ and click on create work area for profiles. Double click on zcond_std. In object populate with ‘Z_KONH_KLS’, double click and you see the parameters like in tcode PFCG (profiles and auth.)

For action you can populate ‘*’

For procedure you can populate with the procedure (see tcode V/08 ) that you use in your SD documents, or the procedure/s in where you want that the restriction will work, if you have many procedures.

For level, you must write the ranges of levels in this procedures (into V/08 ) that you want that the user can see (remember that alpha routine conversion dont works, ie: for level ‘ 1′ [in dynpro] you must write ‘001′, if not, you will have problems). The levels out of this ranges, the user with this profile when go to conditions in SD document will not see the value of these items.

Finally, in SU01, add this profile to profiles created with PFCG in ‘profiles’.

After check if it works.

Pricing Procedure in Product Hierarchy

Pricing structure for line item is KOMP. A quick look thru KOMP structure (tx SE11) shows that you have only PRODH field for all 18 digits of product hierarchy, whereas you need only the first three. So you do the following:

1. Create the new data element ZZPRODH1. Also create a domain with the length “3″ and the data type “CHAR” for the new data element. Remember that new data fields must start with the letters “ZZ” or “YY”, since SAP reserved these letters to protect them from being overwritten during a release upgrade.

2. Check whether the product hierarchy (PRODH) is found at header or at item level. In table VBAP, document field PRODH is defined as an item field.

3. Integrate the field name ZZPRODH in the communication structure KOMP using the INCLUDE KOMPAZ and allocate the data element PRODH to it.

4. Activate the structure.

5. Check in which table the field PRODH exists.
The field is in table VBAP (sales document: item data).

6. Assign a value to the new field in the FORM routines for sales order processing and billing using the appropriate user exits: In sales order processing the user exit is found in member MV45AFZZ. The complete statement is:
FORM USEREXIT_PRICING_PREPARE_TKOMP.
MOVE VBAP-PRODH(3) TO TKOMP-ZZPRODH. ENDFORM.
The routines for assigning a value to the new fields in billing are found in member RV60AFZZ. The statement is as follows:
FORM USEREXIT_PRICING_PREPARE_TKOMK MOVE
XVBRP-PRODH(3) TO TKOMP-ZZPRODH. ENDFORM.

7. Allocate the specifications A, V and 001 to the field ZZPRODH in table T681F. Use “E” has been added for fields in rebate processing.

This is a standard example from SAP Library. In this case you must tell the ABAP three things:
- that your source field is VBAP-PRODH,
- that you need to get the first three digits from that field into your pricing structure KOMP
- and that you need to specify the transfer by user exit thru MV45AFZZ

Please note that this is a very simple example. Quite often you have to dig a lot deeper.

Modifications of Copy Control routines, making output forms (thru SapScript) and such requires you to know all the necessary tables, structures and fileds.

The only advice I can give you is to use tx SE11, which will show you the organisation of a table/structure, and can also help you check the contents of a specific table in a specific sales doc.

3 comments:

Unknown said...

Take SAP SD Online Training | SAP FSCM Online Training in Hyderabad at very reasonable prices.

chitralekha said...

Well, this institute seems to be good in training SAP SD. Call them for a demo at 8122241286.
www.thecreatingexperts.com
SAP SD

Anonymous said...

Thanks for sharing this Informative content about delivery pricing conditions.Got to learn new things from your Blog as it gives the best info about Pricing Procedure in the Product hierarchy.Visit now SAP SD Online Training in Hyderabad if you are looking to learn SAP SD skills.