Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

SAP S4 HANA SD

practice scenarios and Errors


1) While creating sales order with reference to quotation, in quotation and order if payment term
is different then system should give error message. PG.123
Sol:-
Take XVBKD- ZTERM (K030)
Take XVBAK-VGBEL (Reference doc.)
Pass XVBAK-VGBEL to VBKD-VBELN
Take VBKD-ZTERM (K020)
If XVBKD-ZTERM # VBKD-ZTERM
Give error message.

2) While creating sales order with reference to quotation, if PR00 amount is different from
quotation to order, then system should give error message.
Sol:-
Check XKONV- KSCHL=PR00
Take XKONV-KBETR
Take XVBAK-VGBEL
Pass XVBAK-VGBEL to VBAK-VBLEN
Take VBAK-KNUMV
Pass VBAK-KNUMV to KNOV-KNUMV
Pass Item No to KONV-KPOSN
Check KONV-KSCHL=PR00 (12000)
Take KONV-KBETR
If XKONV-KBETR # KONV-KBETR
Give error message.

3) While creating sales order, I want to know line item PR00 Value?
Sol:-
Check XKONV-KSCHL=PR00
Take XKONV-KWERT

4) While creating sales order if profit margin is less than (<) 150%, then system should give error.
Sol:-
Profit Margin = Net Value Cost * 100
Cost
Take XVBAK-NETWR (x) 200000
Cumulate XVBAP-WAVWR (y) 90000
If (x-y) *100 >150 give error.
Y
5) While creating SO with reference to quotation, if customer number is difference in order and
quotation, the system should give warning message.
Take XVBAK-KUNNR
Take XVBAK-VGBEL
Pass XVBAK-VGBEL to VBAK-VBELN
Take VBAK-KUNNR, If XVBAK-KUNNR # VBAK-KUNNR give warning message.
6) While creating delivery, if delivery qty exceeds order qty then system should give error
message.(P.N. 129)
Take XLIPS-LFING(120)=X
Take XLIPS-VGBEL(14595)
Take XLIPS-VGPOS (10)
Pass XLIPS-VGBEL to VBAP-VBLEN
Pass XLIPS-VGPOS to VBAP-POSNR
Take VBAP-KWMNG(100)=Y
If X > Y give error message.

7) While doing delivery if order is blocked for credit, than system should give error message(P.N.-
131)
Take XLIPS-VGBEL
Pass XLIPS-VGBEL to VBAK-VBLEN
Check if VBUK-CMGST=B
Give error message.

8) While doing delivery with reference to purchase order if delivery qty is greater than PO qty. then
system should give error msg.
Take XLIPS-LFIMG=X
Take XLIPS-VGBEL
Take XLIPS-VGPOS
Pass XLIPS-VGBEL to EKET-EBELN
Pass XLIPS-VGPOS to EKET-EBELP
Take EKET-WAMNG(75)=Y
Take EKET-MENGE(100)=Z
If (x-y)>Z then give error msg.

9) Client requirement is they want to determine plant based on ship to party state.(PN 144)
Part C- Program information.
i. General Description of the program logic.
Plant should be determine based on Z table.
Region Plant
01 I100
02 I200

1. Create New Z Table


Region Bhav 3
Plant Char 4
Here region is Primary Key.

2. Develop new User Exits


Tcode VA01
User Exit- USER EXIT_SOURCE_DETERMINATION
Program- MV45AFZB
(click on display in SE38 if you want to find user exits)
Determine plant (VBAP-WERKS) based on above Z table and below logic.
Take Logic-
Check XVBAP-PARVW=SH
Take XVBAP-KUNNR
Pass XVBAP –KUNNR TO KNA1-KUNNR
Take KNA1-REGIO and pass it to Z table and determine Plant (VBAP-WERKS)

10) Client requirement is while doing return order.(PN 145)


a. If return order is based on damage than system should take the stock in to return stock.
b. If the return is due to defective, then system should take the stock into quality stock.
c. If the return is due to over deliver than system should take the stock into unrestricted stock.

I. General description of the program logics- Schedule line category should be determined
based on Z table
Order Reason Schedule Line Category
I01(Damaged) DN (M.Type 651)
I02(Defective) D2 (655)
I03(blocked) D3(657)
I04(over delivery) D4(653)

1. Create new Z table-


Order reason Char 3
Schedule line Category Char 2
Here primary key is order reason

2. Develop new User Exit-


User Exit: USEREXIT_SOURCE_DETERMINATION
Program: MV45AFZB
Determine schedule line category ( VBEP-ETTYP) based on above Z table and below
logic.
Take order reason VBAK-AUGRU
And pass it to Z table and determine schedule line category.
This logic should work only for Return Order.

11) Client requirement is they want to maintain discounts based on customer classification (PN 146)
The customer classification field is not available in field catalogue.
If the field is not available in field catalogue, then we have to go to allowed fields and try to add
the field in allowed fields and some fields system will accept and same fields system will not
accept. If system is not accepting the field then we have to go for enhancement.
In our scenario system will not accept customer classification in allowed field so to add
the customer classification in allowed filed. We have to go for enhancement.
When you try to add the eiled KUKLA in allowed filed then you will get error message i.e. Filed
KUKLA does not exist in table KOMG,KOMK or KOMP.
Add Filed KUKLA in Include KOMKAZ (if you are adding Header field) & KOMPAZ (if you are
adding item field)

After adding the filed KUKLA in INCLUDE KOMKAZ. We go to allowed filed and add the field
KUKLA in allowed field. Then if you create condition table you will find the field customer
classification in filed catalogue. Then we have to create condition table with the combination of
customer classification and create access sequence, condition tape and place the condition type
in pricing procedure and maintain condition record.
When you create sales order system could not able to determine the condition record of
customer classification into sales document pricing. Because the newly added field will not be
identified by sales document pricing.
To make system identify the newly added field in sales document pricing you have to go for
USER EXITS.

• Develop New USER EXITS:-


Tcode : VA01
User Exits: USEREXIT_PRICING_PREPARE_TKOMK(HEADER FILED)
USEREXIT_PRICING_PREPARE_TKOMP(ITEM FILED)
Program:- HV45AFZZ

Logic:
Move Field KNA1-KUKLA to TKOMK-KUKLA

• Develop New User Exit ( to determine the condition type in billing)


Tcode _ VF01
User exit – USEREXIT_PRICING_PREPARE_TKOMK
Program – RAV60AFZZ
Logic:
Move field KNA1-KUKLA to TKOMK-KUKLA

12) Client requirement is the billing document number range should be different for each and every
plant. (PN 147)
It’s a legal requirement for indian client and this requirement is for only indian clients.

Z table
Plant No Interval
I100 Z1
I200 Z2
I300 Z3
I400 Z4
Number Interval Number Range
Z1 -7000000-755555
Z2 -5000000-566666
Z3 -3000000-322222
Z4 -1000000-188888

I. General description of the program logic-


1. Create New Z table
Plant CHAR 4
Nubr Interval CHAR 2

Here primary key is plant

2. Develop new User exit-


Tcode – VF01
Userexit- USEREXIT_NUMBER-RANGE
Program : RV60AFZZ

Determine number interval ( TVFK-NUMKI) base on above Z table and below Logic.
Plant→ take it from billing item (VBRP-WERKS) and pass it to Z table and determine number
interval (TVFK-NUMKI)
Pass TVFK-NUMKI to US_RANGE_INTER
US_RANGE_INTER will take the number interval and propose the current number.

13) Clients requirement is while doing return process, in return delivery system should determine
return storage location.( PN 148)
Plant Storage Location
I100 I105
I200 I205

i. Create new Z table Plant ( Char 4) Storage Location (Char 4)


Here primary key is plant
ii. Develop new User Exits-
Tcode: VL01N
Enhancement: V02V0002
Function Module: EXIT_SAPLV02V_002
iii. Determine storage Location (LIPS-LGORT) based on above Z table and below Logic:
Plant → take it from delivery item (LIPS-WERKS) and pass it to Z table and determine
storage location (LIPS-LGORT) this logic should work only for delivery type LR (LIKP-
LFART).
14) Clients requirement is while doing STO delivery system should not allow to increase the quantity
in delivery more than PO quantity. (PN 150)
i. Develop New Userexit-
Tcode : VL10D or VL02N
User Exit: USEREXIT_READ_DOCUMENT
Program : MV50AFZ1

Loigc:
TAKE XLIPS-LFIMG (40)=X
TAKE XLIPS-VGBEL
TAKE XLIPS-VGPOS
PASS LIPS-VGBEL TO EKET-EBELN
PASS LIPS-VGPOS TO EKET-EBELP
TAKE EKET-MENGE=Z
TAKE EKET-WAMNG=X
If (x+y)<Z give error message.

15) Client requirement is if customer is returning the goods after six months from date of invoice
then system should inactive the sales tax condition type. (this is only for Indian clients)
*any pricing enhancement the program is LV69AFZZ
*Develop new Userexit:
Tcode : VA01
Userexits: (USEREXIT_FIELD_MODIFICATION) userexit_field_modification
Program: LV69AFZZ
Logic:
TAKE XVBAK-ERDAT ( sep 16)
TAKE XVBAK-VGBEL
NOT VISIBLE
TAKE VBRK-FKDAT (mach10)
If ( XVBAK-ERDAT) – (VBRK-FKDAT)> 180 days
CHECK XKOMV-KSCHAL=JCST JVAT
Then make XKOMV-KINAK=X
This logic should work only for return order (RE) (VBAK-AUART)
16) Client requirement is after creating quotation the quotation will be sent to authorize people to
cross check and release. The authorize people will cross check the quotation and some time
they change the price in quotation and after that they release the quotation. If quotation is
released then only system will allow to create order. Then in order system should not allow to
change the price.( system should allow to change the PR00 condition type quotation but system
should not allow to change the PR00 condition type in order) (PN 151)
*Develop new User exit:
Tcode VA01
Userexit: userexit_field_modification
Program: LV69AFZZ
Logic:
If XKOMK-VBTYP =B (Quotation)
Then Make XKOMV-KMANU= BLANCE OR C
If XKOMK-VBTYP=C
Then Make XKOMV-KMANU=D
*In Pricing Enhancement any information we need to search in below structure
KOMK (Pricing Header Structure)
KOMP (Pricing Item Structure)
KOMP

17) Client requirement is there is a manual condition type which user enters manually into sales
document. But by mistake user is entering the same condition type multiple times and system
will accept. But clients want to restrict that.
*Develop New Userexit-
Tcode VA01
Userexit- userexit_pricing_check
Program- LV69AFZZ
Logic-
Count=0
Loop at XKOMV-KSCHL=IDIS
Count=count +1
End loop
If count >1 give error message.

18) Client requirement is for any line item if system determines free goods, then system should
inactive IDIS condition type for that line itme.(PN 152)
Most IMP( in pricing enhancement we cannot use sales document table)
Table VA01
User exit: userexit_field_modification.
Program: LV69AFZZ
Logic: CHECK XKOMP-PSTYV=TANN MAKE XKOMV-KINAK=X
If Yes XKOMP-UEPOS Then
Pass XKOMP-UEPOS TO XKOMV-KPOSN
19) Client requirement is for dealers and distributors system should determine new price while
creating invoice. For institution customer system should copy the price as it is sales order to
invoice.(PN 153)
*Develop New Userexit.
Tcode- VF01
Userexit: userexit_pricing_rule
Program: RV61AFZA
*The table name and field name for pricing type TVEPF-KNPRS
Logic:
If XVBAK-VTWEG=I1 or I2
Then Make FVCPF-KNPRS=C
If VBAK-VTWEG=I3
Then Make TVCPF-KNPRS=G

20) Client requirement is they have status profile in sales order, but if final release has been made
then system should not allow to change the sale order.
Tcode VA01
Userexit: userexit_change_sales_order
Program: FV45EFZ1
Logic:
TAKE XVBAK-OBJNR
PASS XVBAK-OBHNR TO JEST-OBJNR
CHECK JEST-INACT= “__”
If JEST-STAT=E0004
Don’t allow to change.

21) Client requirement is they have some group of material Exp: X Y Z if those material stock is not
confirmed then system should process automatically third party of those materials. (PN 154)
Tcode: VA01
Userexit: userexit_source_determination
Program: MV45AFZB

CHECK If XVBAP-MATKL=001
Then CHECK XVBUP-BESTA=A
Then XVBAP-PSTYV=TAS.

22) Client requirement is while creating sales order if profit margin is less then 100% then system
should give error message.
Tcode _VA01
Userexit_ userexit_save_document
Program- MV45AFZZ
TAKE XVBAK
23) Client requirement is while creating order with reference to quotation some time they change
customer in order then system should check the customer group of both the customers. If
customer, customer group is same then only system should allow. Otherwise give error
message (PN 155) .
*Part C
*develop New userexit-
Tcode- VA01
User Exit- userexit_read_document
Program- MV45AFZZ
Logic:
TAKE XVBAP-VGBEL
TAKE XVBKD-JDGRP0 (Z3)
PASS XVBAK-VGBEL TO VBKO-VBELN
TAKE VBKD-KDGRP (Z1)
IF XVBKD-KDGRP # (VBKD-KOGRP) give error message.

24) Client requirement is while creating credit memo invoice and debit memo invoice system should
copy the billing date as it is from original invoice.
PartC
TCode VF01
Userexit- userexit_nubmer_range_invoice_date
Program- RV60AFZZ
Logic:
TAKE XVBRK-VGBEL
PASS XVBRK-VGBEL TO VBAK O VBLEN
TAKE VBAK-VGBEL
PASS VBAK-VGBEL TO VBRK-VBELN
TAKE VBRK-FKDAT
PASS VBRK-FKDAT TO XVBRK-FKDAT

25) Client requirement is while creating credit memo & debit memo with reference to invoice
system should copy invoice date from original invoice to credit memo and debit memo invoice.
Tcode- VF01
Userexit- userexit_number_range_invoice_date
Program- RV60AFZZ
Logic-
TAKE XVBRP-VGBEL
PASS XVBRP-VGBEL TO VBAK-VBELN
TAKE VBAK-VGBEL
PASS VBAK-VBGEL TO VBRK-VBELN
TAKE VBRK-FKDAT
PASS VBRK-FKDAT TO XVBRK-FKDAT
This logic should apply only for billing type G2 and L2 (VBRK-FKART)
COPY REQUIREMENTS
26) Copy requirement is a condition which system will check every time while creating a document
with reference to another document. If the requirement fulfill then only system will allow to
create a document with reference to another document.(PN 158)
if the requirement is not fulfil then system will not allow to create a documents with reference
to another documents.
*Tcode to develop new copy requirement is VOFM
*User defined copy requirement number should be 900 and above.
*whenever we are developing new copy requirement first copy the standard and include the
new logic in that.

Issue:-
1. Clients requirement is system should not allow to create return invoice if return delivery and
PGR not made.
Logic:
TAKE XVBAK-VBLEN
PASS XVBAK-VBELN TO LIPS-VGBEL
If no entries
Give error message
If entries exits
TAKE LIKP-VBELN
PASS LIKP-VBELN TO VBUK-VBELN
CHECK IF VBUK-WBSTK#C
Give error message

27) Client requirement is like order combination field, they want delivery combination field in
customer master. If that field is checks in customer master then only system should allow
combining multiple deliveries into single order. (PN 159)
Add New Z Field in customer master sales area data billing Tab: Table KNVV
Field Name Should be ZDEL, Length 1 CHAR
Check MOX in Nature
Field Description is Delivery combination

Develop new Copy Requirement between delivery to invoice

Copy the standard requirement 003 and include the new logic
Logic:
Count =0
Loop at XLIKP-VBELN
Count=Count+1
End loop
If count>1 then go inside the logic
TAKE XLIKP-KUNAG
PASS XLIKP-KINAG TO KNVV-KUNNR
Then if KNVV-ZDEL# X give error message.

28) Client requirement is system should not allow to create invoice in future date
We can do this delivery-Invoice copy control In VBRK/VBRP routine.
TAKE XVBRK-FKDAT
TAKE XVBRK-ERDAT
If XVBRK-FKDAT>XVBRK-ERDAT
Then give error message.

PRICING REQUIREMENT

29) Client requirement is there is a product which they manufacture but some time if stock is not
available then they will send it to third party if client is doing standard process, then system
should determine PR00 condition type, if it is third party process then system should determine
IR00 condition type (PN 160)

OUTPUT REQUIREMENT

30) Client requirement is they have status profile in quotation. After creating quotation then they
will send this quotation to authorized people to cross check and release. After releasing the
quotation by final release then only system should send a mail. But in the present process while
saving the quotation to customer, itself system is sending the mail to customer.
TAKE XVBAK-OBJNR
PASS XVBAK-OBJNR TO JEST-OBJNR
THEN CHECK JEST-INACT= “___”
CEHCK JEST-STAT=E0004
GAPS

*Any client requirement for which there is no solution from SAP then we call it as GAP.
*Examples for GAPS:-
1. Adding new fields to SAP
2. Adding new screen in SAP
3. Adding New tabs
4. Changing the standard program

*We find GAP in BBP Phase while preparing TO-BE documents whenever we find GAP we have
to prepare GAP analysis document.
*GAP Analysis document consists of
*Clear description of gap
*alternate solution
*NOT VISIBLE
*After preparing GAP analysis document we will send this document to core user for approval

GAPS:-
1. Client requirement is they want to determine free goods in quotation if you want to
determine free goods in quotation you have to do changes in standard program. Then we
call it as GAP.
With the help of Debugging we to the program area where system determine free goods
and there we add document category “B” also.
2. Client want to offer multiple free goods.
3. Client requirement is like order combination field in customer master they want delivery
combination field if that is check then only system should allow to combine multiple
deliveries into single invoice.
4. Client requirement is they want to offer discount for first 100 order.
5. Client requirement is they want to track C Form

You might also like