Application Development and Automation 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: 
Read only

Process Order, Statuts and commit

Former Member
0 Likes
783

Hi Experts,

I have got an important problem with process order printing. Let me explain :

I have to check if my OPR have one special status, I write this code :


  CONSTANTS : c_ouv  TYPE j_status VALUE 'I0001', " OUV. : ouvert
              c_lanc TYPE j_status VALUE 'I0002'. " LANC : lancé

COMMIT WORK AND WAIT.



  CONCATENATE 'OR' caufvd-aufnr INTO l_objnr.
  CALL FUNCTION 'STATUS_CHECK'
       EXPORTING
            objnr             = l_objnr
            status            = c_lanc
       EXCEPTIONS
            object_not_found  = 1
            status_not_active = 2
            OTHERS            = 3.

  CASE sy-subrc.
*   Statut lancé actif
    WHEN 0.
      w_lance = 'X'.
      PERFORM add_texte_statut USING c_lanc.

*   Statut lancé inactif (=> ouvert)
    WHEN 2.
      w_lance = space.
      PERFORM add_texte_statut USING c_ouv.

*   Erreur
    WHEN OTHERS.
      MESSAGE e202(zpp).
  ENDCASE.

But I have a problem creating my process order (COR1) and printing it in the same time. When we pass it this peace of code, the object doesn't exist, and I've got my E202(ZPP) message.

And if I stop in DEBUG before the STATUS_CHECK, I have got the success message Your process Order XXXXXXX has been created, and everything is OK.

So I put my

COMMIT WORK AND WAIT

before my STATUS CHECK, but without any success....

Have you got any suggestion for this problem?

5 REPLIES 5
Read only

Former Member
0 Likes
716

Hi Mathieu,

This is happening due to the time (in microscenods) at the time of update, and it is typical problem happens in SAP. i faced this kind of problem in function module.

use this code:

COMMIT WORK.

MESSAGE I00 WITH TEXT-I01. "DATABASE IS GOING TO UPDATE SOMETHING LIKE THIS

(or you can try with success message)

Regards

Krishnendu

Read only

0 Likes
716

This is exactly it !

3 solutions are working :

WAIT UP TO 1 SECONDS.

MESSAGE I00 .....

MESSAGE S00 .......

But my client don't accept any of them.

I will have to get the current data in the buffer...

Read only

Former Member
0 Likes
716

Hi again,

I have push forward my analysis of this problem, without being able to find a solution.

There is an asynchronous process which update the database with the correct values, and the printing process.

I need a status information, which is not in parameter of the printing code.

I tried :

¤ WAIT 1 second : ok in developpement system, but not in others => instable solution

¤ TYPE S message : too quick

¤ TYPE I message : it depends of the user's click => instable

¤ COMMIT WORK AND WAIT, and BYPASSING_BUFFER : don't work

Some way of analysis :

¤ The updating asynchronous process end with a success message. It is possible to wait until this message start ? (How to capture this event?)

¤ Is there a flag at the end of this asynchronous process in order to make a WAIT UNTIL .... = 'X'

I sincerely hope you will be able to help me.

Mathieu

Read only

0 Likes
716

Any idea ?

Read only

0 Likes
716

Help ! I need somebody help !

Nobody ?