cancel
Showing results for 
Search instead for 
Did you mean: 

Delete a customer table automatically when deleting an address in BP

Former Member
0 Kudos

Hi Gurus,

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.

Regards,

Rosa

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Rosa,

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.

For example.

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.

Regards

Kaushal

Former Member
0 Kudos

Hi Kaushal,

Thanks by your quick replay.

Doing what you recommended me my problem has been solved.

But, I have another question, why doesn´t work the opposite thing?

I mean works well with this sequence:

BUA_BUPA_EVENT_FCODE-seq 1 with 'X' x_handled parameter

ZZG00_BUPA_EVENT_FCODE-seq 2 with '*' x_handled parameter

but not with this other sequence:

ZZG00_BUPA_EVENT_FCODE-seq 1 with 'X' x_handled parameter

BUA_BUPA_EVENT_FCODE-seq 2 with '*' x_handled parameter

As you have said the first is handled by default and the following must be forced without an 'X' x_handled parameter. Why is so special FM standard?

Please can you explain me that?

Regards,

Rosa

Former Member
0 Kudos

Hi KT,

forget my last reply. I have yet understood what do you mean with x_handled parameter. That is the reference parameter in FM, not the call parameter in trax. BUS7 that it is what I had understood at the begining.

Now all has sense. Thank you very much.

Regards,

Rosa

Former Member
0 Kudos

Hi KT,

I have another question about addresses. From FM standard BUA_BUPA_EVENT_FCODE you can obtain wich address is marked to delete because there is an internal table gt_addr_new that contain this data, because belongs to GF BUA0. But in my customer FM ZZG00_BUPA_EVENT_FCODE doesn´t appear. There is any bapi (FM) to obtain this information? I have tried with FM BUA_BUPA_MEMORY* but don´t show me which address is marked to delet only the data of all addresses for a BP.

Can you help me, please?

Thanks in Advance.

Rosa

Former Member
0 Kudos

Hi Rosa,

Just realised one thing.

When you click on delete button, its the FM BUA_BUPA_EVENT_FCODE that processes this task.

Now when we call ZZG00_BUPA_EVENT_FCODE before BUA_BUPA_EVENT_FCODE, the address is still not deleted. i.e. its still in the address internal table.

Try this alternate solution:

Use event DCHCK (please check the exact event code as I am not out of office at the moment).

Create new FM (in line with ZZG00_BUPA_EVENT_FCODE) and assign this to event DCHCK. This event is called just before BP is saved.

In this FM, memory FMs should show you addresses marked for deletion.

This should solve your problem.

Regards,

Kaushal

Former Member
0 Kudos

Hi KT,

The event DCHCK is a good candidate, but I have found another better, the event ADDEL (not in BUS7 but in BUPA_EVENTS transaction). This event is called in Business Partner Addresses - Check Before Deleting, and give us as import parameter the address marked to be deleted.

Thank you for all.

Regards,

Rosa

Answers (0)