Delete a customer table automatically when deleting an address in BP
First, I have added a customer table for BUPA object from trx EEWB and the system has created an additional tab in BP transaction and within the tab has drawn a table control with the structure I have defined for my customer table. Then, I have moved this table control to the screen sequence BUA130(Address Details - Address Data) from trx. BUCO. Thus, each time I create a new address for a business partner I can populate my customer table. I have the following requirement: When I delete an address from Address Overview tab I want to delete automatically all the entries from my customer table which belong to this address. The system have created a FM ZZG00_BUPA_EVENT_FCODE in EEWB. So I have added this entry to the event FCODE from trx. BUS7 for application BUA. However when I try to delete an adress the system run FM BUA_BUPA_EVENT_FCODE but not my FM ZZG00_BUPA_EVENT_FCODE. Anybody knows Why? There is another method to achieve this (Badi....)?
Thanks in Advance.
Kaushal Trivedi replied
Function modules *_FCODE that are attached to FCODE event operate as follows:
Whenever you click on a button field sy-ucomm is populated with the FCODE. This FCODE propogates through these *_FCODE function modules until some function module consumes this FCODE.
As address delete button is a standard button, the FCODE event generated by clicking on this button is standard and is consumed(or handled) by standard FM BUA_BUPA_EVENT_FCODE. Once this event is handled it no longer propogates. Thus your FM doesnt get called.
Following is what you can do:
There is a call sequence for function modules BUS7.
All you have to do is to assign earlier call sequence to ZZG00_BUPA_EVENT_FCODE than that of BUA_BUPA_EVENT_FCODE.
ZZG00_BUPA_EVENT_FCODE - seq 1
BUA_BUPA_EVENT_FCODE - seq 2
But be sure that you let the event propogate further so that even BUA_BUPA_EVENT_FCODE can handle this. (dont set the 'x_handled' parameter).
This should solve your problem.
Please get back if you need any further clarifications regarding BDT events.
Please reward points if this helps you.