Skip to Content
0

Production order status

Apr 16 at 08:46 AM

51

avatar image

Dear All,

We have insert one field in zva05n report

1 : If production order created mode then status showing "Created"

2 : If production order Released mode then status showing " Released"

3 : If production order clsoed mode then status showing " Ready"

Our report is working fine but If production order created mode then report status showing "Released" please check our code and give me idea how to get proper status.

READ TABLE IT_AUFK INTO WA_AUFK WITH KEY KDAUF = ITAB-VBELN KDPOS = ITAB-POSNR.
IF SY-SUBRC = 0.
READ TABLE IT_JEST INTO WA_JEST WITH KEY OBJNR = WA_AUFK-OBJNR.

IF SY-SUBRC = 0.
ITAB-AUFNR = WA_AUFK-AUFNR.
ITAB-STATS = 'Ready To Dispatch'.

ELSEIF SY-SUBRC NE 0.
ITAB-AUFNR = WA_AUFK-AUFNR.
ITAB-STATS = 'RELEASED'.

ELSEIF SY-SUBRC NE 0.
ELSEIF SY-SUBRC NE 0.
READ TABLE IT_JEST INTO WA_JEST WITH KEY STAT = 'I0001'.
ITAB-AUFNR = WA_AUFK-AUFNR.
ITAB-STATS = 'CREATED'.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Simone Milesi Apr 16 at 09:19 AM
0

Hello there!
As first thing, please, use the "CODE" option so your code is formatted and we can understand what your are doing.

In second step, you are reading JEST table, but an object can have multiple states active and you should skim the one with INACT = X


Secondly, by customizing, you can say to the system to release an order during the creation.


jest.png (11.1 kB)
Show 6 Share
10 |10000 characters needed characters left characters exceeded

Hi Simone,

Thanks for the reply.

as per our logic report working fine but if Production order Status " CRTD Mdoe" then our report showing Released mode.. can you correct my query or give me idea how can get correct Status

0

Again, your code isn't really readable as you posted it and you do not tell us how you fill the IT_JEST table

0
 
Hi Simone,

Please check our code and give me idea how to get proper status


IF ITAB-VGBEL IS NOT INITIAL.
      ITAB-STATS = 'Partial delivered '.
     ELSEIF ITAB-VGBEL IS INITIAL.
     READ TABLE IT_PLAF INTO WA_PLAF WITH KEY KDAUF = ITAB-VBELN KDPOS = ITAB-POSNR.

     IF SY-SUBRC = 0.
     ITAB-PLNUM = WA_PLAF-PLNUM.
     ITAB-STATS = 'Open'.
     ELSEIF SY-SUBRC NE 0.
     READ TABLE IT_AUFK INTO WA_AUFK WITH KEY KDAUF = ITAB-VBELN KDPOS = ITAB-POSNR.
     IF SY-SUBRC = 0.
     READ TABLE IT_JEST INTO WA_JEST WITH KEY OBJNR = WA_AUFK-OBJNR.
     IF SY-SUBRC = 0.
     ITAB-AUFNR = WA_AUFK-AUFNR.
     ITAB-STATS = 'Ready To Dispatch'.
     ELSEIF SY-SUBRC NE 0.
     ITAB-AUFNR = WA_AUFK-AUFNR.
     ITAB-STATS = 'RELEASED'.
     READ TABLE IT_JEST INTO WA_JEST WITH KEY OBJNR = WA_AUFK-OBJNR INACT = 'X' STAT = 'I0001'.
     ELSEIF SY-SUBRC =  0.
     ITAB-AUFNR = WA_AUFK-AUFNR.
     ITAB-STATS = 'CREATED'.<br>
0

You skipped all the closes of your IF, so i cannot understand which elseif is about which one.
The code isn't idented at all.

And, again, we do not know how you fill IT_JEST (you skip records with INACT = X?)

0
Hi Simone,
Please check our code with Select statement 

IF ITAB[] IS NOT INITIAL.
 SELECT PLNUM KDAUF KDPOS
   FROM PLAF
   INTO TABLE IT_PLAF
   FOR ALL ENTRIES IN ITAB
   WHERE KDAUF = ITAB-VBELN AND
        KDPOS = ITAB-POSNR.
   SELECT AUFNR OBJNR KDAUF KDPOS
   FROM AUFK
   INTO TABLE IT_AUFK
   FOR ALL ENTRIES IN ITAB
   WHERE KDAUF = ITAB-VBELN AND
         KDPOS = ITAB-POSNR.

IF IT_AUFK[] IS NOT INITIAL.
SELECT *
  FROM JEST
  INTO TABLE IT_JEST
  FOR ALL ENTRIES IN IT_AUFK
  WHERE OBJNR = IT_AUFK-OBJNR AND
        STAT = 'I0046''I0001'  AND
        INACT = SPACE.
ENDIF.
 ENDIF.

******************************************
IF ITAB-VGBEL IS NOT INITIAL.
      ITAB-STATS = 'Partial delivered '.
     ELSEIF ITAB-VGBEL IS INITIAL.
     READ TABLE IT_PLAF INTO WA_PLAF WITH KEY KDAUF = ITAB-VBELN KDPOS = ITAB-POSNR.

     IF SY-SUBRC = 0.
     ITAB-PLNUM = WA_PLAF-PLNUM.
     ITAB-STATS = 'Open'.
     ELSEIF SY-SUBRC NE 0.
     READ TABLE IT_AUFK INTO WA_AUFK WITH KEY KDAUF = ITAB-VBELN KDPOS = ITAB-POSNR.
     IF SY-SUBRC = 0.
     READ TABLE IT_JEST INTO WA_JEST WITH KEY OBJNR = WA_AUFK-OBJNR.
     IF SY-SUBRC = 0.
     ITAB-AUFNR = WA_AUFK-AUFNR.
     ITAB-STATS = 'Ready To Dispatch'.
     ELSEIF SY-SUBRC NE 0.
     ITAB-AUFNR = WA_AUFK-AUFNR.
     ITAB-STATS = 'RELEASED'.
     READ TABLE IT_JEST INTO WA_JEST WITH KEY OBJNR = WA_AUFK-OBJNR INACT = 'X' STAT = 'I0001'.
     ELSEIF SY-SUBRC =  0.
     ITAB-AUFNR = WA_AUFK-AUFNR.
     ITAB-STATS = 'CREATED'.
*******************************************


0

Dear All,

Please check our code and give me idea how to get proper statu

Regards,

Richa

0
Raymond Giuseppi
Apr 17 at 11:18 AM
0

You code wont never get past first lines of code

IF SY-SUBRC = 0. " sy-subrc value = 0
ITAB-AUFNR = WA_AUFK-AUFNR.
ITAB-STATS = 'Ready To Dispatch'.
ELSEIF SY-SUBRC NE 0. " " sy-subrc value <> 0 so always if not first case
ITAB-AUFNR = WA_AUFK-AUFNR.
ITAB-STATS = 'RELEASED'.
ELSEIF SY-SUBRC NE 0. " " from there til ENDIF ureachable/deac code
ELSEIF SY-SUBRC NE 0.
READ TABLE IT_JEST INTO WA_JEST WITH KEY STAT = 'I0001'.
ITAB-AUFNR = WA_AUFK-AUFNR.
ITAB-STATS = 'CREATED'.
Share
10 |10000 characters needed characters left characters exceeded