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: 

problem in FM STATUS_TEXT_EDIT

Former Member
0 Kudos

Gud mornin ppl,

I am facing a problem while calling the function module

STATUS_TEXT_EDIT. This function module is used to

get the status of the production order, for which we require

to pass the object no OBJNR of tat production order.

I had called the FM in my user exit as follows

CALL FUNCTION 'STATUS_TEXT_EDIT'

EXPORTING

CLIENT = SY-MANDT

*FLG_USER_STAT = ' '

objnr = objnr

ONLY_ACTIVE = 'X'

spras = EN

  • BYPASS_BUFFER = ' '

IMPORTING

*ANW_STAT_EXISTING =

*E_STSMA =

line = status.

*USER_LINE =

*STONR =

STAT = STATUS.

IF stat NS 'TECO'.

MESSAGE 'Production order cannot be processed' TYPE 'E'.

ENDIF.

In the above code OBJNR = OR000010006509

and the result is STATUS = TABG FMAT VOKL ABRV CHPF PLOS

But when i execute the FM thru se37

I pass CLIENT = 777

OBJNR = OR000010006509

ONLY_ACTIVE = X

SPRAS = en

and the result i get is

LINE = TECO MSPT PRC BCRQ ILAS SETC

I am not able to understand why both results are different.

Kindly help me out wid it ..........

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi ,

try to make use of FM STATUS_READ, bcos u will get data from JEST table itself for PP orders.

let me know if not , i will give sample code .

regards

PP

3 REPLIES 3

Former Member
0 Kudos

Hi ,

try to make use of FM STATUS_READ, bcos u will get data from JEST table itself for PP orders.

let me know if not , i will give sample code .

regards

PP

0 Kudos

Hi,

use the function module as given below.

CALL FUNCTION 'STATUS_READ'

EXPORTING

client = gv_mandt

objnr = lv_objnr

only_active = 'X'

IMPORTING

obtyp = lv_obtyp

stsma = lv_stsma

stonr = lv_stonr

TABLES

status = lit_stat

EXCEPTIONS

object_not_found = 1.

IF sy-subrc EQ 0.

READ TABLE lit_stat INTO lwa_stat "#EC *

WITH KEY stat = gc_delstat.

IF sy-subrc EQ 0.

MOVE gc_flg TO gwa_final-flg.

MODIFY git_final FROM gwa_final.

CONTINUE.

ENDIF.

SELECT SINGLE estat INTO lv_estat "#EC *

FROM tj30

WHERE stsma EQ lv_stsma AND

stonr EQ lv_stonr.

IF sy-subrc EQ 0.

SELECT SINGLE txt30

FROM tj30t INTO lv_apst

WHERE stsma EQ lv_stsma AND

estat EQ lv_estat AND

spras EQ gv_langu AND

txt04 IN s_nstat.

IF sy-subrc EQ 0.

MOVE lv_apst TO gwa_final-astat.

ENDIF.

ENDIF.

MOVE lv_estat TO gwa_final-temp_stat.

ENDIF.

Former Member
0 Kudos

Hi,

I had the same problem like u and its due to the FM did not automatically refresh by itself as the commit function was not included in the script. All you need is to include the script below at the bottom of the FM.

IF sy-subrc <> 0.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

MESSAGE 'Failed To Delete the Production Order ' TYPE 'E'.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.

Hope this will solve your problem as it did to me.

Regards

Adis