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: 

Reg : Retrieval of Archived Production Orders

Former Member
0 Kudos
285

hi Abapers pls help how to retreive the archived production orders..? Mail the steps at arthi.nagachandran@gmail.com

4 REPLIES 4

former_member156446
Active Contributor
0 Kudos
114

get the OBJNR and retrieve from AUFK table..

Former Member
0 Kudos
114

hi

hope it will help you.

Reward if help.

REPORT ZPP_PRODUCTION_SUMMARY MESSAGE-ID ZPP_MSG

NO STANDARD PAGE HEADING LINE-SIZE 255.

TABLES : IOOPER, IOHEADER, CAUFV, AFRU, AFVV.

*CONSTANTS : C_CAST TYPE ARBPL VALUE 'CCM',

  • C_CHECK TYPE ARBPL VALUE 'ZC',

  • C_CEMENT TYPE ARBPL VALUE 'CL'.

CONSTANTS : C_CAST TYPE ARBPL VALUE '12015',

C_CHECK TYPE ARBPL VALUE '12018',

C_CEMENT TYPE ARBPL VALUE '12019'.

DATA : P_AUTYP TYPE AUFTYP.

DATA:

BEGIN OF CRHD_TAB OCCURS 0,

OBJID LIKE CRHD-OBJID,

END OF CRHD_TAB.

DATA: BEGIN OF AUFNR_TAB OCCURS 0,

AUFNR LIKE AUFK-AUFNR,

PLNBEZ LIKE CAUFV-PLNBEZ,

MAKTX LIKE MAKT-MAKTX,

END OF AUFNR_TAB.

DATA:

BEGIN OF LTS_OBJNR OCCURS 0,

AUFNR TYPE AUFNR,

AUFPL TYPE CO_AUFPL,

APLFL TYPE PLNFOLGE, "

PLNFL TYPE PLNFOLGE, "

OBJNR TYPE J_OBJNR,

END OF LTS_OBJNR.

DATA :

BEGIN OF CONF_TAB OCCURS 0,

ERSDA LIKE AFRU-ERSDA,

ARBPL LIKE CRHD-ARBPL,

AUFNR LIKE AFRU-AUFNR,

RUECK LIKE AFRU-RUECK,

VORNR LIKE AFRU-VORNR,

ISDZ LIKE AFRU-ISDZ,

" iedz like afru-iedz,

LMNGA LIKE AFRU-LMNGA,

RMNGA LIKE AFRU-RMNGA,

XMNGA LIKE AFRU-XMNGA,

ISM02 LIKE AFRU-ISM02,

ILE02 LIKE AFRU-ILE02,

AUFPL LIKE AFRU-AUFPL,

VGW02 LIKE AFVV-VGW02,

VGE02 LIKE AFVV-VGE02,

END OF CONF_TAB.

DATA : BEGIN OF IT_DATA OCCURS 0,

ERSDA LIKE AFRU-ERSDA,

MATNR LIKE MARA-MATNR,

MAKTX LIKE MAKT-MAKTX,

ARBPL LIKE CRHD-ARBPL,

AUFNR LIKE AFRU-AUFNR,

LMNGA LIKE AFRU-LMNGA,

RMNGA LIKE AFRU-RMNGA,

NTGEW LIKE MARA-NTGEW,

MENGE LIKE AUFM-MENGE,

END OF IT_DATA.

DATA : BEGIN OF IT_MATNR OCCURS 0,

MATNR LIKE MARA-MATNR,

MAKTX LIKE MAKT-MAKTX,

CAST LIKE AFRU-LMNGA,

CHECK LIKE AFRU-LMNGA,

REJECT LIKE AFRU-LMNGA,

REPAIR LIKE AFRU-LMNGA,

CEMENT LIKE AFRU-LMNGA,

END OF IT_MATNR.

DATA : RECAP_TAB LIKE ZPP_PRODUCITON_RECAP OCCURS 0 WITH HEADER LINE.

DATA : V_TABIX LIKE SY-TABIX.

DATA : V_SUM1_LMNGA LIKE AFRU-LMNGA,

V_SUM1_RMNGA LIKE AFRU-RMNGA,

V_SUM1_XMNGA LIKE AFRU-XMNGA,

V_SUM2_LMNGA LIKE AFRU-LMNGA,

V_SUM2_RMNGA LIKE AFRU-RMNGA,

V_SUM2_XMNGA LIKE AFRU-XMNGA,

V_DAILY_CAST LIKE AFRU-XMNGA,

V_DAILY_CHECK LIKE AFRU-XMNGA,

V_DAILY_CEMENT LIKE AFRU-XMNGA,

V_DAILY_REPAIR LIKE AFRU-XMNGA,

V_DAILY_REJECT LIKE AFRU-XMNGA,

V_REJECTED LIKE AFRU-XMNGA,

V_TGM LIKE AFRU-XMNGA,

V_ACT_SPEED LIKE AFRU-XMNGA,

V_TM LIKE AFRU-XMNGA.

DATA : V_MONTH(185).

DATA V_FMNAME TYPE RS38L_FNAM.

RANGES: SO_ARBPL FOR IOOPER-ARBPL.

RANGES : SO_DATE FOR AFRU-ERSDA.

RANGES : SO_WERK FOR IOHEADER-WERKS.

RANGES : SO_PLNBZ FOR CAUFV-PLNBEZ.

DATA : V_DATE TYPE D.

DATA : V_MENGE LIKE AUFM-MENGE,

V_NTGEW LIKE MARA-NTGEW.

PARAMETERS P_DATE LIKE SY-DATUM DEFAULT '20010809'.

V_DATE = P_DATE.

V_DATE4(2) = V_DATE4(2) + 1.

V_DATE+6(2) = '01'.

V_DATE = V_DATE - 1.

CONCATENATE V_DATE0(4) V_DATE4(2) '01' INTO SO_DATE-LOW.

CONCATENATE V_DATE0(4) V_DATE4(2) V_DATE+6(2) INTO SO_DATE-HIGH.

SO_DATE-SIGN = 'I'.

SO_DATE-OPTION = 'BT'.

APPEND SO_DATE.

SO_ARBPL-LOW = C_CAST. " 'CCM'.

SO_ARBPL-SIGN = 'I'.

SO_ARBPL-OPTION = 'EQ'.

APPEND SO_ARBPL.

SO_ARBPL-LOW = C_CHECK. " 'ZC'.

SO_ARBPL-SIGN = 'I'.

SO_ARBPL-OPTION = 'EQ'.

APPEND SO_ARBPL.

SO_ARBPL-LOW = C_CEMENT. " 'CL'.

SO_ARBPL-SIGN = 'I'.

SO_ARBPL-OPTION = 'EQ'.

APPEND SO_ARBPL.

V_DATE = P_DATE.

SELECT OBJID

FROM CRHD

INTO TABLE CRHD_TAB[]

WHERE ARBPL IN SO_ARBPL

AND WERKS IN SO_WERK.

SELECT AUFPL OBJNR APLFL

INTO CORRESPONDING FIELDS OF TABLE LTS_OBJNR[]

FROM AFVC

FOR ALL ENTRIES IN CRHD_TAB[]

WHERE ARBID = CRHD_TAB-OBJID.

SELECT AUFNR PLNBEZ MAKTX

INTO TABLE AUFNR_TAB

FROM CAUFV

JOIN MAKT

ON PLNBEZ = MAKT~MATNR

FOR ALL ENTRIES IN LTS_OBJNR[]

WHERE AUFPL = LTS_OBJNR-AUFPL

AND AUTYP = '10' AND " P_AUTYP AND

" AND LOEKZ IN R_LOEKZ AND

PLNBEZ IN SO_PLNBZ AND

SPRAS = 'EN'.

SELECT ERSDA ARBPL AUFNR RUECK VORNR

AFRU~ISDZ " iedz

AFRULMNGA AFRURMNGA AFRUXMNGA AFRUISM02 AFRU~ILE02

AFRUAUFPL VGW02 AFVVVGE02

INTO TABLE CONF_TAB

FROM AFRU

JOIN CRHD

ON AFRUARBID = CRHDOBJID

JOIN AFVV

ON AFRUAUFPL = AFVVAUFPL

FOR ALL ENTRIES IN AUFNR_TAB

WHERE AUFNR = AUFNR_TAB-AUFNR AND

ERSDA IN SO_DATE.

DELETE CONF_TAB WHERE ARBPL NE C_CAST AND

ARBPL NE C_CHECK AND

ARBPL NE C_CEMENT.

SORT CONF_TAB.

*pERFORM PRINT_ALL.

*line.

PERFORM PRINT.

----


  • FORM PRINT_ALL *

----


  • ........ *

----


FORM PRINT_ALL.

WRITE : /2 'Date',

15 'Work Center',

25 'Order',

45 'Confirmation',

65 'Operation',

  • 85 CONF_TAB-ISDZ, SY-VLINE,

  • conf_tab-iedz,

105 'Material',

  • AUFNR_TAB-MAKTX,

125 'Yield',

145 'Rework',

165 'Scrap'.

    • conf_tab-aufpl,

  • CONF_TAB-VGW02,

  • CONF_TAB-VGE02,

  • CONF_TAB-ISM02,

  • CONF_TAB-ILE02.

LOOP AT CONF_TAB.

READ TABLE AUFNR_TAB WITH KEY AUFNR = CONF_TAB-AUFNR.

WRITE : /2 CONF_TAB-ERSDA,

15 CONF_TAB-ARBPL,

25 CONF_TAB-AUFNR,

45 CONF_TAB-RUECK,

65 CONF_TAB-VORNR,

85 CONF_TAB-ISDZ,

  • conf_tab-iedz,

105 AUFNR_TAB-PLNBEZ,

  • AUFNR_TAB-MAKTX,

125 CONF_TAB-LMNGA,

145 CONF_TAB-RMNGA,

165 CONF_TAB-XMNGA.

    • conf_tab-aufpl,

  • CONF_TAB-VGW02,

  • CONF_TAB-VGE02,

  • CONF_TAB-ISM02,

  • CONF_TAB-ILE02.

ENDLOOP.

ENDFORM.

----


  • FORM print *

----


  • ........ *

----


FORM PRINT.

LOOP AT CONF_TAB.

READ TABLE AUFNR_TAB WITH KEY AUFNR = CONF_TAB-AUFNR.

MOVE-CORRESPONDING CONF_TAB TO IT_DATA.

IT_DATA-MATNR = AUFNR_TAB-PLNBEZ.

IT_DATA-MAKTX = AUFNR_TAB-MAKTX.

  • write : / conf_tab-ersda, conf_tab-arbpl, aufnr_tab-plnbez.

APPEND IT_DATA.

ENDLOOP.

IF IT_DATA[] IS INITIAL.

MESSAGE I012 WITH 'No data found'.

STOP.

ENDIF.

V_MONTH = 'PRODUCTION SUMMARY REPORT'.

WRITE : / V_MONTH CENTERED.

CASE V_DATE+4(2).

WHEN '01'.

CONCATENATE 'January' V_DATE+0(4) INTO V_MONTH

SEPARATED BY SPACE.

WHEN '02'.

CONCATENATE 'Febraury' V_DATE+0(4) INTO V_MONTH

SEPARATED BY SPACE.

WHEN '03'.

CONCATENATE 'March' V_DATE+0(4) INTO V_MONTH

SEPARATED BY SPACE.

WHEN '04'.

CONCATENATE 'April' V_DATE+0(4) INTO V_MONTH

SEPARATED BY SPACE.

WHEN '05'.

CONCATENATE 'May' V_DATE+0(4) INTO V_MONTH

SEPARATED BY SPACE.

WHEN '06'.

CONCATENATE 'June' V_DATE+0(4) INTO V_MONTH

SEPARATED BY SPACE.

WHEN '07'.

CONCATENATE 'July' V_DATE+0(4) INTO V_MONTH

SEPARATED BY SPACE.

WHEN '08'.

CONCATENATE 'August' V_DATE+0(4) INTO V_MONTH

SEPARATED BY SPACE.

WHEN '09'.

CONCATENATE 'September' V_DATE+0(4) INTO V_MONTH

SEPARATED BY SPACE.

WHEN '10'.

CONCATENATE 'October' V_DATE+0(4) INTO V_MONTH

SEPARATED BY SPACE.

WHEN '11'.

CONCATENATE 'Novemebr' V_DATE+0(4) INTO V_MONTH

SEPARATED BY SPACE.

WHEN '12'.

CONCATENATE 'Decemebr' V_DATE+0(4) INTO V_MONTH

SEPARATED BY SPACE.

ENDCASE.

WRITE : / V_MONTH CENTERED..

WRITE : /2 'Date',

15 'Material',

25(17) 'CAST' right-justified,

45(17) 'CHECKED' right-justified,

65(17) 'REJECTED' right-justified,

85(17) 'TO REPAIR' right-justified,

105(17) 'CEMENT LINED' right-justified,

125(17) 'CAST TONS' right-justified,

145(17) 'REJECTED %' right-justified,

165(17) 'REPAIR %' right-justified.

SKIP.

LOOP AT IT_DATA.

V_TABIX = SY-TABIX.

V_SUM1_LMNGA = V_SUM1_LMNGA + IT_DATA-LMNGA.

V_SUM1_RMNGA = V_SUM1_RMNGA + IT_DATA-RMNGA.

AT NEW ERSDA.

WRITE : /2 IT_DATA-ERSDA+6(2).

ENDAT.

At new MATNR.

  • READ TABLE IT_DATA INDEX V_TABIX.

WRITE : 15 IT_DATA-MATNR.

  • IT_DATA-MAKTX,

ENDAT.

AT END OF ARBPL.

READ TABLE IT_DATA INDEX V_TABIX.

CASE IT_DATA-ARBPL.

WHEN C_CAST.

WRITE : 25 V_SUM1_LMNGA decimals 2. " Cast

V_DAILY_CAST = V_SUM1_LMNGA.

CLEAR V_SUM1_LMNGA.

WHEN C_CHECK.

WRITE : 45 V_SUM1_LMNGA DECIMALS 2. " Checked

V_DAILY_CHECK = V_SUM1_LMNGA.

CLEAR V_SUM1_LMNGA.

WHEN C_CEMENT.

SELECT SINGLE AUFMMENGE MARANTGEW INTO (V_MENGE, V_NTGEW)

FROM AUFM

JOIN MARA

ON AUFMMATNR = MARAMATNR

WHERE AUFM~AUFNR = IT_DATA-AUFNR AND

MARA~MATNR = IT_DATA-MATNR.

IF NOT V_NTGEW IS INITIAL.

V_REJECTED = V_MENGE / V_NTGEW.

ENDIF.

WRITE : 65 V_REJECTED DECIMALS 2. " Rejected

WRITE : 85 V_SUM1_RMNGA DECIMALS 2. " To Repair

WRITE : 105 V_SUM1_LMNGA DECIMALS 2. " Cement

V_DAILY_CEMENT = V_SUM1_LMNGA.

CLEAR V_SUM1_LMNGA.

V_DAILY_CAST = ( V_DAILY_CAST * V_NTGEW ) / 1000.

IF NOT V_DAILY_CAST IS INITIAL.

V_DAILY_REJECT = ( V_REJECTED * 100 ) / V_DAILY_CAST.

ENDIF.

IF NOT V_SUM1_RMNGA IS INITIAL.

V_DAILY_REPAIR = ( V_REJECTED * 100 ) / V_SUM1_RMNGA.

ENDIF.

WRITE : 125 V_DAILY_CAST DECIMALS 2,

145 V_DAILY_REJECT DECIMALS 2,

165 V_DAILY_REPAIR DECIMALS 2.

ENDCASE.

READ TABLE IT_MATNR WITH KEY MATNR = IT_DATA-MATNR.

IF SY-SUBRC NE 0.

IT_MATNR-MATNR = IT_DATA-MATNR.

IT_MATNR-MAKTX = IT_DATA-MAKTX.

IT_MATNR-CAST = V_DAILY_CAST.

IT_MATNR-CHECK = V_DAILY_CHECK.

IT_MATNR-REJECT = V_REJECTED.

IT_MATNR-REPAIR = V_DAILY_REPAIR.

IT_MATNR-CEMENT = V_DAILY_CEMENT.

APPEND IT_MATNR.

ELSE.

IT_MATNR-CAST = IT_MATNR-CAST + V_DAILY_CAST.

IT_MATNR-CHECK = IT_MATNR-CHECK + V_DAILY_CHECK.

IT_MATNR-REJECT = IT_MATNR-REJECT + V_REJECTED.

IT_MATNR-REPAIR = IT_MATNR-REPAIR + V_DAILY_REPAIR.

IT_MATNR-CEMENT = IT_MATNR-CEMENT + V_DAILY_CEMENT.

MODIFY IT_MATNR INDEX SY-TABIX.

ENDIF.

CLEAR IT_MATNR.

CLEAR V_SUM1_LMNGA.

CLEAR : V_SUM1_LMNGA,

V_SUM1_RMNGA,

V_SUM1_XMNGA,

V_SUM2_LMNGA,

V_SUM2_RMNGA,

V_SUM2_XMNGA,

V_DAILY_CAST,

V_DAILY_CEMENT,

V_DAILY_REPAIR,

V_DAILY_REJECT,

V_REJECTED,

V_TGM,

V_ACT_SPEED,

V_TM.

ENDAT.

ENDLOOP.

SKIP.

WRITE : /1(185) 'Material Wise Totals' CENTERED.

SKIP.

LOOP AT IT_MATNR.

WRITE : /15 IT_MATNR-MATNR,

25 IT_MATNR-CAST DECIMALS 2,

45 IT_MATNR-CHECK DECIMALS 2,

65 IT_MATNR-REJECT DECIMALS 2,

85 IT_MATNR-REPAIR DECIMALS 2,

105 IT_MATNR-CEMENT DECIMALS 2.

ENDLOOP.

ENDFORM.

Former Member
0 Kudos
114

use standard transaction CO78 which has all the options related to archiving.

delete, archive, delete & retrieval.

try retrieval using this standard SAP transaction.

anya

0 Kudos
114

Thank u but when i am trying to do using t-code : CO78 the order is retreiving but it is not appearing in t-code : CO02.

Wat to do ...?