When trying to create a script to delete a specific Partner Function in XD02, the line where the Partner Function exists may be different for each Customer Master.
The delete function in SAP is dependent on the current cursor position in the screen. Without a way to keep this position consistent, the wrong Partner Function could be deleted.
In XD02, there is a Search feature at the bottom of the screen that can be used to move a selected Partner Function to the first row.
Enter the Partner Function and Number and Press Enter to move the record to the first row.
Once the record has been moved to the first row, the row can be selected and the Delete can be done on the correct row.
When Mapping the script, there will be two fields, *KNVP-PARVW and *RF02D-KTONR which are the search fields that are used in XD02 that you can map to your Partner Function and Number respectively.