Blanca,
I would like to exclude an item category YPXX from intercompany invoicing, as it is only customer . relevant.
The "cleanest" solution could be to create a dedicated Sales document type for the Intercompany Sale process (in other words for both F2 and IV; user shall create a sales order with a different order type).
For this order type, the item category YPXX is not "applicable" or assigned (in VOV4).
Thus user can not create intercompany sales order with item category YPXX.
If you want to keep the same Sales document type, for OTC sale and for Intercompany sales; and do not want to use item category YPXX for intercompany sales, then probably coding / enhancement needs to be done.
In program MV45AFZB, in userexit USEREXIT_CHECK_VBAP, lines of code have to be written where the logic would be -
check the Company code of the sales organization with the Company code of the delivering plant,
- if same then allow item category YPXX;
- if different then do not allow item category YPXX;
in the sales order.