Application Development and Automation 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: 
Read only

How to read Process Orders

Former Member
0 Likes
1,058

Hi Experts,

I got confusion in reading process orders for the list of material numbers which is in internal table, my functional gave the following tables and wants to me perform join..

caufv,afpo and just

what is the relation between this table,if any body give code sample i appreciate it.

Regards,

babu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,026

Hi

SELECT * FROM CAUFV INTO TABLE T_CAUFV
                  FOR ALL ENTRIES IN T_ITAB
                      WHERE PLNBEZ = T_ITAB-MATNR.
IF SY-SUBRC = 0.
  SELECT * FROM AFPO INTO TABLE T_AFPO
        FOR ALL ENTRIES IN T_CAUFV
              WHERE AUFNR = T_CAUFV-AUFNR.
  
  SELECT * FROM JEST INTO TABLE T_JEST
       FOR ALL ENTRIES IN T_CAUFV
              WHERE OBJNR = T_CAUFV-OBJNR.
ENDIF.

Max

7 REPLIES 7
Read only

Former Member
0 Likes
1,026

Hi babu,

do you mean jest OR just?

If you mean jest, try SQVI with a join and insert these tables than

you get the information.

I think it's aufnr and objnr.

Regards, Dieter

Read only

Former Member
0 Likes
1,027

Hi

SELECT * FROM CAUFV INTO TABLE T_CAUFV
                  FOR ALL ENTRIES IN T_ITAB
                      WHERE PLNBEZ = T_ITAB-MATNR.
IF SY-SUBRC = 0.
  SELECT * FROM AFPO INTO TABLE T_AFPO
        FOR ALL ENTRIES IN T_CAUFV
              WHERE AUFNR = T_CAUFV-AUFNR.
  
  SELECT * FROM JEST INTO TABLE T_JEST
       FOR ALL ENTRIES IN T_CAUFV
              WHERE OBJNR = T_CAUFV-OBJNR.
ENDIF.

Max

Read only

0 Likes
1,026

Hi,

In addition to that i must read the process orders which does not have the status 'TECO' 'DLFL','CLSD' 'DLV', from where i will got these status.

Plz help me out.

Thanks and Regards

babu

Read only

0 Likes
1,026

Hi

I believe the status code is in table TJ02T, it should be the short text TXT04.

So u should check the real code ISTAT linked to your status: TECO, DLFL, CLSD, DLV:

SELECT * FROM CAUFV INTO TABLE T_CAUFV
                  FOR ALL ENTRIES IN T_ITAB
                      WHERE PLNBEZ = T_ITAB-MATNR.
IF SY-SUBRC = 0.
  SELECT * FROM AFPO INTO TABLE T_AFPO
        FOR ALL ENTRIES IN T_CAUFV
              WHERE AUFNR = T_CAUFV-AUFNR.
    
  SELECT * FROM JEST INTO TABLE T_JEST
       FOR ALL ENTRIES IN T_CAUFV
              WHERE OBJNR = T_CAUFV-OBJNR.
ENDIF.

SELECT * FROM TJ02T WHERE SPRAS = SY-LANGU
                      AND ( TXT04 = 'TECO' OR 
                            TXT04 = 'DLFL' OR 
                            TXT04 = 'CLSD' OR
                            TXT04 = 'DLV' ).  
  R_STAT(3)  = 'IEQ'.
  R_STAT-LOW = TJ02T-ISTAT.
  APPEND R_STAT.
ENDSELECT.

LOOP AT T_CAUFV.
  LOOP AT T_JEST WHERE OBJNR = T_CAUFV-OBJNR
                   AND STAT  IN R_STAT.
    EXIT.
  ENDLOOP.
  IF SY-SUBRC = 0.
    DELETE T_AUFNR.
    DELETE T_JEST WHERE OBJNR = T_CAUFV-OBJNR.
    DELETE T_AFPO WHERE AUFNR = T_CAUFV-AUFNR. 
  ENDIF.
ENDLOOP.

Max

Read only

0 Likes
1,026

SELECT * FROM CAUFV INTO TABLE T_CAUFV

FOR ALL ENTRIES IN T_ITAB

WHERE PLNBEZ = T_ITAB-MATNR.

IF SY-SUBRC = 0.

SELECT * FROM AFPO INTO TABLE T_AFPO

FOR ALL ENTRIES IN T_CAUFV

WHERE AUFNR = T_CAUFV-AUFNR.

SELECT * FROM JEST INTO TABLE T_JEST

FOR ALL ENTRIES IN T_CAUFV

<b> WHERE OBJNR = T_CAUFV-OBJNR

and stat in ('TECO' ,'DLFL','CLSD', 'DLV').</b>

ENDIF.

Read only

Former Member
0 Likes
1,026

Hi Max,

Thanks alot for the quick replies, how to join tj02t and the rest of table's i am not able to find any related fields.

Thanks and Regards,

babu

Read only

0 Likes
1,026

Hi

The link between CAUFV and JEST is field OBJNR: JEST-OBJNR = CAUFV-OBJNR.

The link between JEST and TJ02T are the fields STAT and ISTAT:

TJ02T-ISTAT = JEST-STAT.

Max