โ2007 Aug 02 10:05 AM
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?
โ2007 Aug 02 10:18 AM
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
โ2007 Aug 02 10:33 AM
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...
โ2007 Aug 08 1:41 PM
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
โ2007 Aug 08 2:49 PM
โ2007 Aug 08 4:11 PM