Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

User Exit when save purchase requisition

Former Member
0 Kudos

Hi

I'm french and sorry for my bad english.

I have a problem.

I search a user exit when you save a new purchase requisition (ME51N).

In this user exit, I need Purchase requisition Number.

I have found the Enhancement MEREQ001 and the user exit EXIT_SAPLMEREQ_010.

I go in this User Exit when saving PR. But, the number is not yet created.

So, I have seen that SAP use a function 'NUMBER_GET_NEXT' to create the new number of PR. But this function is launch after the user exit EXIT_SAPLMEREQ_010. So I don't have the number in my user exit.

Do you know if another USER EXIT exist when you saving a PR?

PS: In transaction ME22N, no problem because this number already exist.

Thank you very much.

See you.

Seb

13 REPLIES 13

Former Member
0 Kudos

Hello Ler,

enter the following code in your system. When you execute it you can enter a transaction code and in return you get the possible exits / enhancements.


report zuserexit no standard page heading.

tables : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.
         tables : tstct.
data : jtab like tadir occurs 0 with header line.
data : field1(30).
data : v_devclass like tadir-devclass.

parameters : p_tcode like tstc-tcode obligatory.

select single * from tstc where tcode eq p_tcode.
if sy-subrc eq 0.
   select single * from tadir where pgmid = 'R3TR'
                    and object = 'PROG'
                    and obj_name = tstc-pgmna.
   move : tadir-devclass to v_devclass.
      if sy-subrc ne 0.
         select single * from trdir where name = tstc-pgmna.
         if trdir-subc eq 'F'.
            select single * from tfdir where pname = tstc-pgmna.
            select single * from enlfdir where funcname =
            tfdir-funcname.
            select single * from tadir where pgmid = 'R3TR'
                               and object = 'FUGR'
                               and obj_name eq enlfdir-area.

            move : tadir-devclass to v_devclass.
          endif.
       endif.
       select * from tadir into table jtab
                     where pgmid = 'R3TR'
                       and object = 'SMOD'
                       and devclass = v_devclass.
        select single * from tstct where sprsl eq sy-langu and
                                         tcode eq p_tcode.
        format color col_positive intensified off.
        write:/(19) 'Transaction Code - ',
             20(20) p_tcode,
             45(50) tstct-ttext.
                    skip.
        if not jtab[] is initial.
           write:/(95) sy-uline.
           format color col_heading intensified on.
           write:/1 sy-vline,
                  2 'Exit Name',
                 21 sy-vline ,
                 22 'Description',
                 95 sy-vline.
           write:/(95) sy-uline.
           loop at jtab.
              select single * from modsapt
                     where sprsl = sy-langu and
                            name = jtab-obj_name.
                   format color col_normal intensified off.
                   write:/1 sy-vline,
                          2 jtab-obj_name hotspot on,
                         21 sy-vline ,
                         22 modsapt-modtext,
                         95 sy-vline.
           endloop.
           write:/(95) sy-uline.
           describe table jtab.
           skip.
           format color col_total intensified on.
           write:/ 'No of Exits:' , sy-tfill.
        else.
           format color col_negative intensified on.
           write:/(95) 'No User Exit exists'.
        endif.
      else.
          format color col_negative intensified on.
          write:/(95) 'Transaction Code Does Not Exist'.
      endif.

at line-selection.
   get cursor field field1.
   check field1(4) eq 'JTAB'.
   set parameter id 'MON' field sy-lisel+1(10).
   call transaction 'SMOD' and skip first   screen.

Good luck,

Ronald Groennou.

0 Kudos

Hi,

SUper your code.

I have launch it and the enhancement for Create PR (ME51N) is only MEREQ001.

But I have tested all User Exit in this enhancement and only the EXIT_SAPLMEREQ_010 is called.

I think that all user exit are not activated.

Thank you very very much.

Former Member
0 Kudos

Hi Ler,

You can try user exit EXIT_SAPLMEREQ_008 in the same enhancement. This user exit has the new PR number in

parameter IM_BANFN_NEW. Hope this helps.

Dont forget to reward points if answers were helpful.

Cheers

0 Kudos

Hi sanjay,

Thank you for your response.

I have tested this EXIT_SAPLMEREQ_008.

And SAP don't go in it when I save my purchase.

Two solutions:

- It's a another enhancement.

- The user exit is not actived

I have try all User Exit in enhancement MEREQ001 and only the EXIT_SAPLMEREQ_010 is called.

So, I must find a another enhancement.

See you

Sebastien

Former Member
0 Kudos

Hi Ler Seb,

Go to the function group SE37--> utilities --> repair funtion groups --> enter 'XM02' and press Enter ..

Now u'll get the EXIT_010 in ur screen activated .

Hope this helps u ...

Regards,

R.Kripa.

0 Kudos

Hi,

Thanks but it is already activated

Former Member
0 Kudos

Hi,

Can u please tell me what have u done till now

Kripa

0 Kudos

SO:

I have coding in User Exit EXIT_SAPLMEREQ_010. This code call a function wich send a email.

This code is called when I save my PR but, I don't have the PR Number. The reason is that the function 'NUMBER_GET_NEXT' wich give you your OR Number is called after my User Exit.

See you.

Sebastien

Former Member
0 Kudos

Hi,

Can u please tell me what have u done till now

Kripa

0 Kudos

I have send you a response.

Perhaps, I don't have understand what do you said.

I'm french and my english is very limited

Thks

See you.

0 Kudos

I have Found!!!!!!

Do you know that all enhancement was rattached to a project!

So, the name of project was type YY* (specific).

And in this project, only the user exit EXIT_SAPLMEREQ_0010 was activated.

I have only actived the another.

And now, it's working perfectly.

The programm call all User Exit in enhancement MEREQ001 and so, I can use the EXIT_SAPLMEREQ_0008 because the PR number is created before this user exit and you have a PARAMETER wich named 'IM_BANFN_NEW'.

I am very happy.

Thank you to all for response very fastly. This forum is super.

See you later.

Sebastien

Former Member
0 Kudos

Hi Ler ,

I mentioned in my previous post that EXIT_SAPLMEREQ_008 is in same enhancement . You only need to activate it by creating the include. One enhancement MEREQ001 can be activated in one project but that does not mean that all the exits in it would be activated. Only the exits for which the ZX* prog is created will be active and you can see a green tick beside it . Dont forget to reward and close the thread if answers were helpful.

Cheers

0 Kudos

HI Sanjay,

I have seen your post about EXIT_SAPLMEREQ_008 but, oddly, only User Exit (EXIT_SAPLMEREQ_010) was activated in transaction CMOD. Only this User Exit has a green icon.

I have so activated the project and all User Exit has a green icon now.

However, all include was activated in SE37 and SE38

See you.