Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Restrict Item Category Item Creation using Reference Only

Former Member
0 Likes
476

Hi All

Here is the scenario, I want "Restrict Item Category Item Creation using Reference Only"

a.Retrieve document number VBELN from sales order header table VBAK for the current order. Check if the sales order is of type ‘ZAB’ referencing field AUART in table VBAK.

note : Any changes to existing sales order "ZAB" will be performed in thesame sales order type(ZAB) in VA02 transaction.

b.If step a is passed, check internal table structure for sales order item level as XVBAP-PSTYV for possible item category values of 'ZDEF' for the entered line item and document number (XVBAP-VBELN).

c.If the cancel/change item category values are found on the line item, check internal table structure for document flow (XVBFA) if the cancel/change item category was created as reference:

i.Check if entry exists in XVBFA for the preceding document number field VBELV with value equal to value in the subsequent document number field VBELN. This value must equal the current sales document number VBELN in table VBAK.

ii.The above check must be done in conjunction with the following check:

1.Check if entry exists in XVBFA for the preceding document type field VBTYP_V with value ‘C’ equals subsequent document type field VBTYP_N with value of ‘C’.

d.Once the above checks are passed, collect the item number from internal table XVBAP (Field: POSNR) for the change/cancel item category line item added to the sales order.

e.Check if the item number retrieved in the previous step exists in table VBAP (Field: POSNR) with an item category that is not part of the list of cancel/change item category defined in step b.

f. Check if the item number collected in the previous step exists in the subsequent item number (Field : POSNN) in internal table XVBFA for the row that passed checks in steps b and c.

g.If item number exists, check if this subsequent item number field equals the preceding item number field value (Field: POSNV) in table XVBFA.

h.If step g fails, generate an error message stating that the user needs to the create the cancel/change item category line item with reference to the original line item and do not allow the user to proceed with the transaction.

i.If step g succeeds, allow the user to proceed with the transaction.

can any one send me the logic for this scenario.

Rgds

Chinna

Hi All

Here is the scenario, I want "Restrict Item Category Item Creation using Reference Only"

a.Retrieve document number VBELN from sales order header table VBAK for the current order. Check if the sales order is of type ‘ZAB’ referencing field AUART in table VBAK.

note : Any changes to existing sales order "ZAB" will be performed in thesame sales order type(ZAB) in VA02 transaction.

b.If step a is passed, check internal table structure for sales order item level as XVBAP-PSTYV for possible item category values of 'ZDEF' for the entered line item and document number (XVBAP-VBELN).

c.If the cancel/change item category values are found on the line item, check internal table structure for document flow (XVBFA) if the cancel/change item category was created as reference:

i.Check if entry exists in XVBFA for the preceding document number field VBELV with value equal to value in the subsequent document number field VBELN. This value must equal the current sales document number VBELN in table VBAK.

ii.The above check must be done in conjunction with the following check:

1.Check if entry exists in XVBFA for the preceding document type field VBTYP_V with value ‘C’ equals subsequent document type field VBTYP_N with value of ‘C’.

d.Once the above checks are passed, collect the item number from internal table XVBAP (Field: POSNR) for the change/cancel item category line item added to the sales order.

e.Check if the item number retrieved in the previous step exists in table VBAP (Field: POSNR) with an item category that is not part of the list of cancel/change item category defined in step b.

f. Check if the item number collected in the previous step exists in the subsequent item number (Field : POSNN) in internal table XVBFA for the row that passed checks in steps b and c.

g.If item number exists, check if this subsequent item number field equals the preceding item number field value (Field: POSNV) in table XVBFA.

h.If step g fails, generate an error message stating that the user needs to the create the cancel/change item category line item with reference to the original line item and do not allow the user to proceed with the transaction.

i.If step g succeeds, allow the user to proceed with the transaction.

can any one send me the logic for this scenario.

Rgds

Chinna

1 REPLY 1
Read only

Former Member
0 Likes
415

Hi Chinna,

Please use BADI "BADI_SD_SALES_ITEM" to achieve your requirement..

Let me know if you have further questions..

BR

Rakesh