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: 

finding status

Former Member
0 Kudos
240

Hi :

I am finding status of work orders( aufnr ) using FM status_text_edit.

CALL FUNCTION 'STATUS_TEXT_EDIT'

EXPORTING

flg_user_stat = 'X'

objnr = v_objnr

only_active = 'X'

spras = sy-langu

IMPORTING

line = v_status.

  • exceptions

  • object_not_found = 01.

I need the orders with status including REL, PCNF,CRTD and excluding CNF,TECO,CLSD,DLFL.

so i am the if conditions like this.

IF ( v_status NS 'CNF' OR v_status NS 'TECO' OR v_status NS 'CLSD' OR v_status NS 'DLFL' )

AND ( v_status CS 'PCNF' OR v_status CS 'CRTD' OR v_status CS 'REL' )

  • AND ( v_status CS 'REL' AND V_STATUS CS 'PCNF' )

AND ( v_status NS 'REL' OR v_status NS 'CNF' OR V_STATUS NS 'NMAT' OR V_STATUS NS 'PRC' OR V_STATUS NS 'SETC' )

AND ( v_status NS 'TECO' OR v_status NS 'CNF' ).

the above condition is excluding the orders with status PCNF if i exclude orders with status CNF, but i need the orders with status PCNF and exclude with status CNF.

Any help is appreciated with full points.

Thx

Raghu

6 REPLIES 6

Pawan_Kesari
Active Contributor
0 Kudos
160

Prepare and range and use that range in IF condition.. that will simplify the coding..

0 Kudos
160

can i replace the status string if it has PCNF with ABCD

and after the validations, again replce ABCD with PCNF, so that i can exclude the v_status containing CNF.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
160

I think this will work for you. First, put the positive condition, and also, if the first condition is passed, the status having PCNF, there is no reason to check for NS CNF, why? because you will never see a production order with both PCNF and CNF in the status. Make sense?


IF  ( v_status CS 'PCNF' 
   OR v_status CS 'CRTD' 
   OR v_status CS 'REL' ) 
 and ( v_status NS 'TECO' 
   and v_status NS 'CLSD' 
   and v_status NS 'DLFL' )

endif.

Regards,

RIch Heilman

0 Kudos
160

you are correct Rich , there is no status with PCNF and CNF together.

since this is Backlog Report, we need orders which are REL and PCNF and exclude CNF , TECO , CLSD , DLFL.

IF ( v_status CS 'PCNF'

OR v_status CS 'CRTD'

OR v_status CS 'REL' )

in the above condition we are including PCNF , because of this i am geting orders with CNF also since PCNF string has CNF , and if i exclude CNF , the program is excluding orders with status PCNF.

EXAMPLE :

i have some status with REL PCNF NMAT PRC SETC which i need , and

i want to exclude status REL CNF NMAT PRC SETC.

thx.

Raghu

Former Member
0 Kudos
160

Hi Raghu,

CO

Contains Only

CN

Contains Not only

CA

Contains Any

NA

contains Not Any

CS

Contains String

NS

contains No String

CP

Matches pattern

NP

Does not match pattern

so change the if conditions like :

IF ( v_status NS 'PCNF' OR v_status NS 'TECO' OR v_status NS 'CLSD' OR v_status NS 'DLFL' )
AND ( v_status CS 'CNF' OR v_status CS 'CRTD' OR v_status CS 'REL' )
* AND ( v_status CS 'REL' AND V_STATUS CS 'CNF' )
AND ( v_status NS 'REL' OR v_status NS 'PCNF' OR V_STATUS NS 'NMAT' OR V_STATUS NS 'PRC' OR V_STATUS NS 'SETC' )
AND ( v_status NS 'TECO' OR v_status NS 'PCNF' ).

Reward pts if found usefull :

Regards

Sathish

Former Member
0 Kudos
160

The problem was solved.

i used

IF v_status CS 'PCNF'.

REPLACE 'PCNF' IN v_status WITH 'ABCD'.

ENDIF.

IF ( v_status NS 'CNF' OR v_status NS 'TECO' OR v_status NS 'CLSD' OR v_status NS 'DLFL' )

AND ( v_status CS 'ABCD' OR v_status CS 'CRTD' OR v_status CS 'REL' )

AND ( V_STATUS NS 'CNF' )

AND ( v_status NS 'TECO' OR v_status NS 'ABCD' ).

IF v_status CS 'ABCD'.

REPLACE 'ABCD' IN v_status WITH 'PCNF'.

ENDIF.

thanks.

Rgahu