This website is not affiliated with, sponsored by, or approved by SAP AG.

[Resolved] User Exit for ME22N

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, Gothmog, YuriT

[Resolved] User Exit for ME22N

Postby mr » Thu Oct 07, 2004 8:38 am

Hi all,

My scenario is as follows:
After creating a purchase order (via ME21N) and release the order (via ME28), MM people wants to control that if some (defined) relevants fields of the order are changed by the user (in ME22N), the liberation strategy status assigned to the order is set automatically to 'Blocked' (B).

Searching for tables holding the liberation strategy i found EKKO (purchase document header).
Then i started the search for a user exit where i can control the relevant fields (belonging to tables EKKO and EKPO). The problems start here: looking for user exits for development class ME (the Dev. Class of trn's ME22N program) none of them seems to have a structure for EKKO as an export parameter (nor as a table). The "less bad" was FM EXIT_SAPMM06E_013 of User Exit MM06E005, that have all the relevants fields and is started when the user save the changes (exactly where MM people wants), but again, there are no export structure for EKKO.
In this last User Exit, i also tryed to update table EKKO "directly", but doesn´t seems to works neither (EKKO is updated "for a moment" but after all the procesing is finished the liberation status strategy is reset to A)

At this point my last idea is trying to modify the liberation strategy status screen field from the user exit. Is it a good idea? Is this possible? How?

Any other ideas to overcome this problem?

Thanks in advance,
mr.
Last edited by mr on Wed Oct 13, 2004 12:12 pm, edited 1 time in total.
mr
 
Posts: 285
Joined: Wed Jun 25, 2003 11:52 am
Location: Uruguay

Postby mr » Wed Oct 13, 2004 12:11 pm

Just to share with all... and eventually hear comments about...

I resolved it starting a FM in background (...IN BACKGROUND TASK addition) from the last User Exit called after the Save command in the transaction ME22N.
In the FM i do a WAIT UP TO x SECONDS (trying to assure that x is greater than the time ME22N takes to finish the DB update...) and then i do "my" DB update (only change the liberation strategy status) and record an update document entrie (FM EINKBELEG_WRITE_DOCUMENT which updates tables CDHDR and CDPOS).

Hope it helps somebody sometime.
mr.
mr
 
Posts: 285
Joined: Wed Jun 25, 2003 11:52 am
Location: Uruguay

Can you explain in detail how you resolved this - EKPO line

Postby nousername » Fri Oct 15, 2004 1:08 am

Hi there,

I exactly tried what you tried to do but then i was not able to update the EKPO. :roll: So can you please give me some more info on what you mean by liberation release flag. Is it in XEKPO structure, do I just need to check this flag and does it directly update the DB, I observed a oss note that for enjoy transactions there is a business addin that is been given from august 2004 to update tax jurisdiction code.
But it is only for enjoy tcode. I want to update the ekpo tax code, for that I am using the same exit you used, but i couldn't do that.

regards,
nousername
nousername
 

Postby RosieBrent » Fri Oct 15, 2004 3:25 am

Erm - you're both using enjoy TCodes (the N at the end of them indicates that)... so why not use the BADI???
Kind Regards

Rosie Brent

Please remember to search the forum and check the FAQ before posting questions, thank you.

Tuly Idiot most of the time, part-time Guru Image
RosieBrent
 
Posts: 6197
Joined: Mon Oct 21, 2002 3:04 am
Location: Darlington

Re: Can you explain in detail how you resolved this - EKPO l

Postby mr » Fri Oct 15, 2004 6:16 am

nousername wrote:Hi there,

I exactly tried what you tried to do but then i was not able to update the EKPO. :roll: So can you please give me some more info on what you mean by liberation release flag. Is it in XEKPO structure, do I just need to check this flag and does it directly update the DB, I observed a oss note that for enjoy transactions there is a business addin that is been given from august 2004 to update tax jurisdiction code.
But it is only for enjoy tcode. I want to update the ekpo tax code, for that I am using the same exit you used, but i couldn't do that.

regards,
nousername


My updates are only in EKKO table.
Field FRGKE is liberation status for the purchase order. As i want to set it to 'Blocked' (value 'B') i also have to clear FRGZU and mark the 'Incomplete liberation' flag FRGRL. All this can be easily done using FM ME_UPDATE_RELEASE.

BTW, if you want to update EKPO i think there are other user exits that allows you that...

But if you are starting your development, perhaps the better option is to follow Rosie's suggestion and look for a BADI...

Hope it helps,
mr.
mr
 
Posts: 285
Joined: Wed Jun 25, 2003 11:52 am
Location: Uruguay

Badi's can be used but......

Postby nousername » Fri Oct 15, 2004 1:42 pm

Hi rosie & Mr,

I know we can use Badi's but this is for only enjoy transactions. I have the oss note numbers 625819 and 493515 and 389059 where some info about the badi to use for using taxcode for tac calculation in me21n and me22n is given. but we dont have any business rule that only enjoy transactions can be used and also I want to update taxcode even while doing data uploads, so i cant depend on enjoy tcodes.

So only option for me as i can see is call the function in back ground as Mr did and check if i can update ekpo, but
Mr, I want to know did you use change pointers in the function module you used to call the program to update ekko table.?.

I understand your program in this way, you wrote a z function in which you are updating the ekko table and calling that in background and waiting until the me21 is updated in DB. But I want to know did you use any change pointers in that z function module.


thanks,
sunil
nousername
 

Postby RosieBrent » Fri Oct 15, 2004 1:56 pm

If you want to update change pointers/documents there are standard FMs to do so - have a look in SE37
Kind Regards

Rosie Brent

Please remember to search the forum and check the FAQ before posting questions, thank you.

Tuly Idiot most of the time, part-time Guru Image
RosieBrent
 
Posts: 6197
Joined: Mon Oct 21, 2002 3:04 am
Location: Darlington

Postby nousername » Sat Oct 16, 2004 10:43 pm

Hi rosie,

Do you think there is any function module that can update the P.O line item detail.
I saw there is a me_update_document for purchase order and I also used it both in foregrund and background in the function module caled in userexit but my purpose is not solved as it didn't update P.O.
Is there any catch while i call this in background task.

mr,
Do you remember how many seconds did you wait when you called your functional module in background. I waited for 3 seconds, but it didnt help.
To give a more detailed idea I created a "z" functional module and i called this in the user exit and in this one i passed all the xekko and xekko structures then i waited for 3 seconds and called me_update_document ,

but it didn't work. looks like i have no otehr option except for badis but i need to tell the business they can only use me21n for p.o creation.

thanks,
nousername.
nousername
 

Postby mr » Tue Oct 19, 2004 2:06 pm

Hi,

Sorry for the late reply nousername, i've been out of works these days...

About your question, i use a 10 seconds wait time, but this value is completly arbitrary.

To give a more detailed idea I created a "z" functional module and i called this in the user exit and in this one i passed all the xekko and xekko structures then i waited for 3 seconds and called me_update_document ,


I did exactly the same, just used ME_UPDATE_RELEASE instead of ME_UPDATE_DOCUMENT but this is OK if you want to update other fields than the liberation strategy.

Another point is that i put a COMMIT WORK after the call to the FM in background. As far as i understand, this will produce the execution of the FM in background in another work process.

Let me know if you could solve your problem...

Hope it helps,
mr.
mr
 
Posts: 285
Joined: Wed Jun 25, 2003 11:52 am
Location: Uruguay


Return to ABAP

Who is online

Users browsing this forum: No registered users and 6 guests





This website is not affiliated with, sponsored by, or approved by SAP AG.