2006 Feb 23 2:55 PM
Hello,
I´m writing a printprogram for printing productionsorders to smartforms. I´m trying to change the systemstatus on the productionorder by calling a functionmodule. Does anybody know wich functionmodule that will work for this purpose?
I have tested STATUS_CHANGE_FOR_ACTIVITY with objnr as a parameter but it doesnt work.
Regards
Tomas
2006 Feb 23 7:26 PM
Hi Thomas,
Here is an example ...
DATA: BEGIN OF IT_STAT OCCURS 0.
INCLUDE STRUCTURE JSTAT.
DATA: END OF IT_STAT.
MOVE 'OR000010000000' TO V_OBJNR.
MOVE 'I0001' TO SET_STAT-STAT.
MOVE 'X' TO SET_STAT-INACT.
APPEND IT_STAT.
CALL FUNCTION 'STATUS_CHANGE_INTERN'
EXPORTING
CHECK_ONLY = SPACE
OBJNR = V_OBJNR
TABLES
STATUS = IT_STAT.
...
If the standard SAP status is not applicable for your condition i.e. printed, you may need to ask the functional folk to configure for you.
Hope this will help.
Regards,
Ferry Lianto
2006 Feb 23 3:25 PM
Hi Thomas,
Please try the following FM:
FM STATUS_READ is to read status.
FM STATUS_CHANGE_INTERN is to change status.
The key is always OBJNR - you'll get that one from field AUFK-OBJNR.
Hope this will help.
Regards,
Ferry Lianto
2006 Feb 23 4:35 PM
Hello again,
Thanks for the answer but Im not sure how to use this FM.
CALL FUNCTION 'STATUS_CHANGE_INTERN'
EXPORTING
CHECK_ONLY = ' '
CLIENT = SY-MANDT
OBJNR = 'OR000000011018'
ZEILE = ' '
SET_CHGKZ =
IMPORTING
ERROR_OCCURRED =
OBJECT_NOT_FOUND =
STATUS_INCONSISTENT =
STATUS_NOT_ALLOWED =
TABLES
STATUS =
EXCEPTIONS
OBJECT_NOT_FOUND = 1
STATUS_INCONSISTENT = 2
STATUS_NOT_ALLOWED = 3
OTHERS = 4
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
What I want is to update the systemstatus print so that the system status says that the order has been printed.
Can I use this FM for this and how?
Regards
Tomas
2006 Feb 23 7:10 PM
One thing that you can try is, change the status to printed ( somehow ) and see what entry is getting created in JEST table. Use this internal number ( for status PRINTED ) and pass it to function module STATUS_CHANGE_INTERN.
2006 Feb 23 7:26 PM
Hi Thomas,
Here is an example ...
DATA: BEGIN OF IT_STAT OCCURS 0.
INCLUDE STRUCTURE JSTAT.
DATA: END OF IT_STAT.
MOVE 'OR000010000000' TO V_OBJNR.
MOVE 'I0001' TO SET_STAT-STAT.
MOVE 'X' TO SET_STAT-INACT.
APPEND IT_STAT.
CALL FUNCTION 'STATUS_CHANGE_INTERN'
EXPORTING
CHECK_ONLY = SPACE
OBJNR = V_OBJNR
TABLES
STATUS = IT_STAT.
...
If the standard SAP status is not applicable for your condition i.e. printed, you may need to ask the functional folk to configure for you.
Hope this will help.
Regards,
Ferry Lianto
2006 Feb 23 9:05 PM
Hello,
When i test this code nothing happens when I look at systemstatus via COR3. Nothing is written in jest-table either.
Data: V_OBJNR Like CAUFV-OBJNR.
DATA: BEGIN OF IT_STAT OCCURS 0.
INCLUDE STRUCTURE JSTAT.
DATA: END OF IT_STAT.
MOVE 'OR000000011018' TO V_OBJNR.
MOVE 'I0007' TO IT_STAT-STAT.
MOVE 'X' TO IT_STAT-INACT.
APPEND IT_STAT.
Break-point.
CALL FUNCTION 'STATUS_CHANGE_INTERN'
EXPORTING
CHECK_ONLY = SPACE
OBJNR = V_OBJNR
TABLES
STATUS = IT_STAT.
Regards
2006 Feb 23 9:11 PM
Hi Thomas,
First of all please let me know are you changing internal or External status .
If external then:
CALL FUNCTION 'STATUS_CHANGE_EXTERN'
EXPORTING
CHECK_ONLY = ' '
CLIENT = SY-MANDT
OBJNR = LT_OUTTAB-OBJNR1
USER_STATUS = ZSTATUS
SET_INACT = ' '
EXCEPTIONS
OBJECT_NOT_FOUND = 1
STATUS_INCONSISTENT = 2
STATUS_NOT_ALLOWED = 3
OTHERS = 4.
IF SY-SUBRC = 0.
COMMIT WORK.
WAIT UP TO 1 SECONDS.
ELSE.
ZSTATUS_CHANGE = 'X'.
MESSAGE S933(ZM) WITH LT_OUTTAB-AUFNR LT_OUTTAB-VORNR.
ENDIF.
For <u>internal status</u> then your code is OK and Please remove/Comment this line
MOVE 'X' TO IT_STAT-INACT.
Regards,
Lanka
2006 Feb 23 9:13 PM
Hello again,
I am using internal status.
How do I use commit work?
// Tomas
2006 Feb 23 9:14 PM
Hi Thomas,
I forgot Please just add the following lines after your function call:
CALL FUNCTION 'STATUS_UPDATE_DIALOG'.
COMMIT WORK.
This will update the ststus to your order.
Regards,
Lanka
Message was edited by: Lanka Murthy
2006 Feb 23 9:23 PM
Ok, I changed the code according to your changes but the processorder still doesnt update systemstatus after running the FM. Do I have to do some commit or something, and how do I do that.
2006 Feb 23 9:24 PM
Hi Tomas,
Please try this and this working for me:
Data: V_OBJNR Like CAUFV-OBJNR.
DATA: BEGIN OF IT_STAT OCCURS 0.
INCLUDE STRUCTURE JSTAT.
DATA: END OF IT_STAT.
MOVE 'OR000000011018' TO V_OBJNR.
MOVE 'I0007' TO IT_STAT-STAT.
MOVE 'X' TO IT_STAT-INACT.
APPEND IT_STAT.
Break-point.
CALL FUNCTION 'STATUS_CHANGE_INTERN'
EXPORTING
CHECK_ONLY = SPACE
OBJNR = V_OBJNR
TABLES
STATUS = IT_STAT.
<b> CALL FUNCTION 'STATUS_UPDATE_DIALOG'.
COMMIT WORK</b>.
Regards,
Lanka
2006 Feb 23 9:28 PM
Alright! Not it works fine.
It was the commit that did the job.
Thanks alot! You guys are great.
One question though, what does the 'X' in the inact-field do?
2006 Feb 23 9:30 PM
Hi Tomas,
If Set IN_ACT flag as 'X then it inserts the status as inactive status.
Please reward points to all the useful answers and close the post.
Cheers,
Lanka
2006 Feb 23 9:33 PM
Hi Thomas,
Please add FM STATUS_UPDATE_DIALOG at the end.
It should work ...
Regards,
Ferry Lianto
2006 Feb 23 9:34 PM
2006 Mar 31 2:50 PM
Sorry to ask, I'm trying to implement something the same, only I want to change the userstatus when using the printing from a serviceorder which uses ZIPRJT00.
The only problem I have is that I can't use commit work since it's still busy on the background process.
any ideas on how to solve that ??