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: 

Change status on order

Former Member
0 Kudos
1,794

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

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos
532

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

15 REPLIES 15

ferry_lianto
Active Contributor
0 Kudos
532

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

0 Kudos
532

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

Former Member
0 Kudos
532

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.

ferry_lianto
Active Contributor
0 Kudos
533

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

0 Kudos
532

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

0 Kudos
532

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

0 Kudos
532

Hello again,

I am using internal status.

How do I use commit work?

// Tomas

0 Kudos
532

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

0 Kudos
532

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.

0 Kudos
532

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

0 Kudos
532

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?

0 Kudos
532

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

ferry_lianto
Active Contributor
0 Kudos
532

Hi Thomas,

Please add FM STATUS_UPDATE_DIALOG at the end.

It should work ...

Regards,

Ferry Lianto

0 Kudos
532

Ok thanks all. I will reward you with points.

former_member186143
Active Contributor
0 Kudos
532

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 ??