Skip to Content
0
Former Member
Oct 15, 2006 at 06:09 PM

user exit

99 Views

hi all

can any one send the code for the following logic in the user exit.

1. If SAP transaction is equal to ’VA01, VA02, VA21, VA22’ then EXIT (Exit function only).

2. If Material Type is not ZKMT, then EXIT (Exit function only).

3. Check if Sales Order Number and Line Item exist, if not, Display an Error Message “Sales Order Number and Line Item Number are required”, then EXIT. End the program, the transactions is not allowed.

4. If Sales Order Cost exist in SAP Table KEKO, then EXIT. Use the following parameters:

4.1. Reference Object = “k”

4.2. Costing Type = ‘17’

4.3. Costing Status = “VO”

4.4. Sales Order Number

4.5. Line Item Number

4.6. Material

4.7. Receiving Plant

5. If Sales Order Cost exist in SAP Table EBEW for any other plant, copy that cost to the Receiving Plant and EXIT. Use the following parameters:

5.1. From:

5.1.1. Sales Order Number

5.1.2. Line Item Number

5.1.3. Material

5.1.4. Special Stock = “f”

5.2. Data to be copied:

5.2.1. Standard Cost = EBEW-STPRS

5.2.2. Price Unit = EBEW-PEINH

5.3. Pass copied Data

5.4. Exit Function

6. If there is not cost in table EBEW, get the Sales Order Standard Cost number from SAP Tables KEKO and KEPH from any other plant. Use the following parameters:

6.1. Read table KEKO

6.1.1. Reference Object = “g”

6.1.2. Costing Type = ‘18’

6.1.3. Sales Order Number

6.1.4. Line Item Number

6.1.5. Material

6.2. Get the Product Cost Estimate Number = KEKO-KALNR

6.3. Get the costing lot size = KEKO-LOSAU and populate EBEW-PEINH

6.4. If not record exist, Display the message “There is not Sales Order Cost for &material in &plant for & SalesOrder and &LineItem”, then EXIT the Program, transaction is not allowed.

6.5. Read table KEPH

6.5.1. Reference Object = “B”

6.5.2. Costing Type = ‘18’

6.5.3. Product Cost Estimate Number = KEKO-KALNR

6.5.4. Costing Version ‘ “01” (Zero and one)

6.6. Get the Cost Components Value

6.6.1. KEPH-KST001 to KEPH-KST040 (40 values)

6.7. Get Cost Components Value Index from table TCKH3. Use the following parameters:

6.7.1. Structure (ELEHK) = “LS”

6.7.2. Get Data : Store the value in field Full Cost (EL_HV) for all records in the table. These values will be used as index in the formula to calculate the Total Standard Cost.

6.8. Calculate Sales Order Cost Estimate to populate filed EBEW-STPRS.

6.8.1. Add value stored in the fields KEPH-KSTnnn. Find nnn in table TCKH3 where nnn equals EL_HV.

6.8.2. If total is equal to ZERO display the message “Standard Cost is ZERO, transaction is not allowed”. Exit the Program.

6.8.3. Return the Values:

6.8.3.1. Standard Cost (EBEW-STPRS)

6.8.3.2. Price Unit (EBEW-PEINH)