SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

List of Internal Orders with Planed & Actual Amounts



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> CO
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Mon Sep 08, 2008 4:15 pm    Post subject: List of Internal Orders with Planed & Actual Amounts Reply with quote

List of Internal Orders with Planed & Actual Amounts

Code:
* Source Name is  ZCOORD1
REPORT ZCOORD1  MESSAGE-ID ZZ NO STANDARD PAGE HEADING
                LINE-SIZE 255
                LINE-COUNT 65.
TABLES: COAS, COVP, EKKO, LFA1, COEP, COSS, COSP.
DATA: SEL-DATE LIKE COVP-BUDAT.
DATA: SEL-PERI(7).                     "YYYYPPP - Year and Period
DATA: DO-SELECT.
DATA: BEGIN OF TAB OCCURS 500,
      USER0 LIKE COAS-USER0,
      USER2 LIKE COAS-USER2,
      BUKRS LIKE COAS-BUKRS,
      KSTAR LIKE COVP-KSTAR,
      WRTTP LIKE COVP-WRTTP,
      AUFNR LIKE COAS-AUFNR,
      OBJNR LIKE COAS-OBJNR,
      AUART LIKE COAS-AUART,
      KTEXT LIKE COAS-KTEXT,
      AUFEX LIKE COAS-AUFEX,
      USER6 LIKE COAS-USER6,
      EBELN LIKE COVP-EBELN,
      LIFNR LIKE EKKO-LIFNR,
      NAME1 LIKE LFA1-NAME1,
      AUFNR2 LIKE COAS-AUFNR,
      BELNR LIKE COVP-BELNR,
      OBJNR2 LIKE COVP-OBJNR,
      BLDAT LIKE COVP-BLDAT,
      BUDAT LIKE COVP-BUDAT,
      PERIO LIKE COVP-PERIO,
      GJAHR LIKE COVP-GJAHR,
      LABOR-HRS-PLAN    LIKE COVP-MEGBTR,
      LABOR-HRS-ACTUAL  LIKE COVP-MEGBTR,
      LABOR-DLR-PLAN    LIKE COVP-WKGBTR,
      LABOR-DLR-ACTUAL  LIKE COVP-WKGBTR,
      MATERIAL-DLR-PLAN    LIKE COVP-WKGBTR,
      MATERIAL-DLR-ACTUAL  LIKE COVP-WKGBTR,
      OVERHEAD-DLR-PLAN    LIKE COVP-WKGBTR,
      OVERHEAD-DLR-ACTUAL  LIKE COVP-WKGBTR,
      TOTAL-DLR-PLAN       LIKE COVP-WKGBTR,
      TOTAL-DLR-ACTUAL     LIKE COVP-WKGBTR,
      END OF TAB.
DATA: DUMMT-WRT(16).
DATA: BEGIN OF WRT,
      LABOR-HRS-PLAN    LIKE DUMMT-WRT,
      LABOR-HRS-ACTUAL  LIKE DUMMT-WRT,
      LABOR-DLR-PLAN    LIKE DUMMT-WRT,
      LABOR-DLR-ACTUAL  LIKE DUMMT-WRT,
      MATERIAL-DLR-PLAN    LIKE DUMMT-WRT,
      MATERIAL-DLR-ACTUAL  LIKE DUMMT-WRT,
      OVERHEAD-DLR-PLAN    LIKE DUMMT-WRT,
      OVERHEAD-DLR-ACTUAL  LIKE DUMMT-WRT,
      TOTAL-DLR-PLAN       LIKE DUMMT-WRT,
      TOTAL-DLR-ACTUAL     LIKE DUMMT-WRT,
      END OF WRT.
DATA: BEGIN OF PREV,
      AUFNR LIKE COAS-AUFNR,
      USER6 LIKE COAS-USER6,
      KTEXT LIKE COAS-KTEXT,
      AUFEX LIKE COAS-AUFEX,
      USER2 LIKE COAS-USER2,
      USER0 LIKE COAS-USER0,
      BUKRS LIKE COAS-BUKRS,
      END   OF PREV.
DATA: BEGIN OF GRANDTTL,
      LABOR-HRS-PLAN    LIKE COVP-MEGBTR,
      LABOR-HRS-ACTUAL  LIKE COVP-MEGBTR,
      LABOR-DLR-PLAN    LIKE COVP-WKGBTR,
      LABOR-DLR-ACTUAL  LIKE COVP-WKGBTR,
      MATERIAL-DLR-PLAN    LIKE COVP-WKGBTR,
      MATERIAL-DLR-ACTUAL  LIKE COVP-WKGBTR,
      OVERHEAD-DLR-PLAN    LIKE COVP-WKGBTR,
      OVERHEAD-DLR-ACTUAL  LIKE COVP-WKGBTR,
      TOTAL-DLR-PLAN       LIKE COVP-WKGBTR,
      TOTAL-DLR-ACTUAL     LIKE COVP-WKGBTR,
      END OF GRANDTTL.
DATA: BEGIN OF ORDEPTTL.
        INCLUDE STRUCTURE GRANDTTL.
DATA: END OF ORDEPTTL.
DATA: BEGIN OF ORDERTTL.
        INCLUDE STRUCTURE GRANDTTL.
DATA: END OF ORDERTTL.
DATA: BEGIN OF SETVALUES OCCURS 500.
        INCLUDE STRUCTURE SETVALUES.
DATA:   END OF SETVALUES.
DATA: BEGIN OF SETHIER OCCURS 500.
        INCLUDE STRUCTURE SETHIER.
DATA:   END OF SETHIER.
DATA: BEGIN OF COST-ELEM-XREF OCCURS 500,
      FROM LIKE COVP-KSTAR,
      IDTYPE(20),
        END OF COST-ELEM-XREF.
DATA: TEMP-FROM(10) TYPE N.
DATA: TEMP-TO(10) TYPE N.
DATA: TEMP-PERI(03) TYPE N.
DATA: TABNAME LIKE RGSMH-TABLE VALUE   'CCSS'.
DATA: SETID   LIKE SETHDR-SETID.
DATA: WKG     LIKE COSS-WKG001.
DATA: MEG     LIKE COSS-MEG001.
SELECTION-SCREEN BEGIN OF BLOCK FRAME1 WITH FRAME TITLE TEXT-001.
*SEL-TEXT  "Specify Criteria to Select an Internal Order
SELECT-OPTIONS: AUFNR FOR COAS-AUFNR.
*SEL-TEXT         "Orders(s) to Select.
SELECT-OPTIONS: BUKRS FOR COAS-BUKRS DEFAULT '0010'.
*SEL-TEXT         "Company(s) to Select.
SELECT-OPTIONS: AUFEX FOR COAS-AUFEX.
*SEL-TEXT         "External Order(s) Selection
SELECT-OPTIONS: USER2 FOR COAS-USER2.
*SEL-TEXT         "Person(s) Responsible
SELECT-OPTIONS: KTEXT FOR COAS-KTEXT.
*SEL-TEXT         "Description(s) on Order
SELECT-OPTIONS: USER6 FOR COAS-USER6.
*SEL-TEXT         "Requesting Department(s)
SELECT-OPTIONS: USER0 FOR COAS-USER0.
*SEL-TEXT         "Applicant(s) Selection
PARAMETERS:     ZACTIV AS CHECKBOX   DEFAULT 'X'.
*SEL-TEXT         "Show Zero Activity
SELECTION-SCREEN END OF BLOCK FRAME1.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF BLOCK FRAME2 WITH FRAME TITLE TEXT-002.
*SEL-TEXT  "Specify Time Frame Type on Which Selection is Based
PARAMETERS: OPT-DATE RADIOBUTTON GROUP TMOD,
*SEL-TEXT         "Selection Date Based
            OPT-PERI RADIOBUTTON GROUP TMOD DEFAULT 'X'.
*SEL-TEXT         "Selection Period Based
SELECT-OPTIONS: SELDATE FOR SEL-DATE.
*SEL-TEXT         "Date(s) to Select ON.
SELECT-OPTIONS: SELPERI FOR SEL-PERI.
*SEL-TEXT         "Period(s) to Select ON.
SELECTION-SCREEN END OF BLOCK FRAME2.
DATA: R1 VALUE 'X'.
DATA: BEGIN OF COUNT,
      COAS(8) TYPE P,
      PROC(8) TYPE P,
      END OF COUNT.

AT SELECTION-SCREEN OUTPUT.
  IF OPT-DATE IS INITIAL.
    LOOP AT SCREEN.
      IF SCREEN-NAME CS 'SELDATE'.
        SCREEN-INVISIBLE    =   1.
        SCREEN-INPUT        =   0.
        SCREEN-OUTPUT       =   0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.
  IF OPT-PERI IS INITIAL.
    LOOP AT SCREEN.
      IF SCREEN-NAME CS 'SELPERI'.
        SCREEN-INVISIBLE    =   1.
        SCREEN-INPUT        =   0.
        SCREEN-OUTPUT       =   0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

START-OF-SELECTION.
  CLEAR COUNT.
  CLEAR GRANDTTL.
  CLEAR ORDEPTTL.
  CLEAR ORDERTTL.
  CLEAR PREV.
  REFRESH TAB.
  MOVE '0HALABOR'          TO SETID.
  PERFORM GET-COST-ELEM-XREF USING SETID TABNAME.
  MOVE '0HAMATERIAL'       TO SETID.
  PERFORM GET-COST-ELEM-XREF USING SETID TABNAME.
  MOVE '0HAOVERHEAD'       TO SETID.
  PERFORM GET-COST-ELEM-XREF USING SETID TABNAME.
  SORT COST-ELEM-XREF BY FROM.
  COMMIT WORK.
  SELECT * FROM COAS WHERE AUFNR IN AUFNR
                       AND BUKRS IN BUKRS
                       AND USER2 IN USER2
                       AND AUFEX IN AUFEX
                       AND USER6 IN USER6
                       AND USER0 IN USER0
                       AND KTEXT IN KTEXT.
    ADD 1 TO COUNT-COAS.
    SELECT * FROM COEP WHERE LEDNR EQ '00'
*   Uses Index on Table COEP to Limit Records to be Read
                         AND OBJNR EQ COAS-OBJNR.
      CLEAR COVP.
      SELECT SINGLE * FROM COVP WHERE KOKRS EQ COEP-KOKRS
*   Read COVP  from COEP Record Read
                                  AND BELNR EQ COEP-BELNR
                                  AND BUZEI EQ COEP-BUZEI.
      CLEAR TAB.
      PERFORM POPULATE-FROM-COAS.
      CLEAR DO-SELECT.
      IF NOT OPT-DATE IS INITIAL.
        IF COVP-BUDAT IN SELDATE.
          MOVE 'Y' TO DO-SELECT.
        ENDIF.
      ENDIF.
      IF NOT OPT-PERI IS INITIAL.
        MOVE COVP-GJAHR TO SEL-PERI(4).
        MOVE COVP-PERIO TO SEL-PERI+4(3).
        IF SEL-PERI   IN SELPERI.
          MOVE 'Y' TO DO-SELECT.
        ENDIF.
      ENDIF.
      IF DO-SELECT IS INITIAL.
        IF NOT ZACTIV IS INITIAL.
          COLLECT TAB.
        ENDIF.
      ENDIF.
      CHECK DO-SELECT EQ 'Y'.
      MOVE COVP-KSTAR       TO TAB-KSTAR.
      MOVE COVP-WRTTP       TO TAB-WRTTP.
      MOVE COVP-EBELN       TO TAB-EBELN.
      CLEAR TAB-LIFNR.
      CLEAR TAB-NAME1.
      IF NOT TAB-EBELN IS INITIAL.
        CLEAR EKKO.
        SELECT SINGLE * FROM EKKO WHERE EBELN EQ TAB-EBELN.
        MOVE EKKO-LIFNR      TO TAB-LIFNR.
        IF NOT EKKO-LIFNR IS INITIAL.
          CLEAR LFA1.
          SELECT SINGLE * FROM LFA1 WHERE LIFNR EQ EKKO-LIFNR.
          MOVE LFA1-NAME1 TO TAB-NAME1.
        ENDIF.
      ENDIF.
      MOVE COVP-BELNR       TO TAB-BELNR.
      MOVE COVP-OBJNR       TO TAB-OBJNR2.
      MOVE COVP-BLDAT       TO TAB-BLDAT.
      MOVE COVP-BUDAT       TO TAB-BUDAT.
      MOVE COVP-PERIO       TO TAB-PERIO.
      MOVE COVP-GJAHR       TO TAB-GJAHR.
      READ TABLE COST-ELEM-XREF WITH KEY  FROM = COVP-KSTAR
                                      BINARY SEARCH.
      IF SY-SUBRC EQ 0.
        IF COST-ELEM-XREF-IDTYPE CS 'LABOR'.
          IF COVP-WRTTP GE '04'
             AND COVP-WRTTP LE '12'.
            ADD COVP-MEGBTR       TO  TAB-LABOR-HRS-ACTUAL.
            ADD COVP-WKGBTR       TO  TAB-LABOR-DLR-ACTUAL.
          ENDIF.
        ENDIF.
        IF COST-ELEM-XREF-IDTYPE CS 'MATERIAL'.
          IF COVP-WRTTP GE '04'
             AND COVP-WRTTP LE '12'.
            ADD COVP-WKGBTR       TO  TAB-MATERIAL-DLR-ACTUAL.
          ENDIF.
        ENDIF.
        IF COST-ELEM-XREF-IDTYPE CS 'OVERHEAD'.
          IF COVP-WRTTP GE '04'
             AND COVP-WRTTP LE '12'.
            ADD COVP-WKGBTR       TO  TAB-OVERHEAD-DLR-ACTUAL.
          ENDIF.
        ENDIF.
      ENDIF.
      TAB-TOTAL-DLR-ACTUAL = TAB-OVERHEAD-DLR-ACTUAL
                           + TAB-MATERIAL-DLR-ACTUAL
                           + TAB-LABOR-DLR-ACTUAL.
      TAB-TOTAL-DLR-PLAN   = TAB-OVERHEAD-DLR-PLAN
                           + TAB-MATERIAL-DLR-PLAN
                           + TAB-LABOR-DLR-PLAN.
      COLLECT TAB.
    ENDSELECT.
    IF SY-SUBRC NE 0.                  "No Activity for an Order
      CLEAR TAB.
      PERFORM POPULATE-FROM-COAS.
      IF NOT ZACTIV IS INITIAL.
        COLLECT TAB.
      ENDIF.
    ENDIF.
    IF NOT OPT-PERI IS INITIAL.
      SELECT * FROM COSS WHERE LEDNR EQ '00'
                           AND OBJNR EQ COAS-OBJNR.
        CLEAR TAB.
        PERFORM POPULATE-FROM-COAS.
        MOVE 001 TO TEMP-PERI.
        WHILE TEMP-PERI LT 13.
          MOVE COSS-GJAHR TO SEL-PERI(4).
          MOVE TEMP-PERI  TO SEL-PERI+4(3).
          IF SEL-PERI   IN SELPERI.
            DO 13 TIMES VARYING WKG FROM COSS-WKG001
                                    NEXT COSS-WKG002
                        VARYING MEG FROM COSS-MEG001
                                    NEXT COSS-MEG002.
              CHECK SY-INDEX EQ TEMP-PERI.
              READ TABLE COST-ELEM-XREF WITH KEY  FROM = COSS-KSTAR
                                              BINARY SEARCH.
              IF SY-SUBRC EQ 0.
                IF COST-ELEM-XREF-IDTYPE CS 'LABOR'.
                  IF COSS-WRTTP EQ '01'.
                    ADD MEG               TO  TAB-LABOR-HRS-PLAN.
                    ADD WKG               TO  TAB-LABOR-DLR-PLAN.
                  ENDIF.
                ENDIF.
                IF COST-ELEM-XREF-IDTYPE CS 'OVERHEAD'.
                  IF COSS-WRTTP GE '01'.
                    ADD WKG               TO  TAB-OVERHEAD-DLR-PLAN.
                  ENDIF.
                ENDIF.
              ENDIF.
            ENDDO.
          ENDIF.
          ADD 1 TO TEMP-PERI.
        ENDWHILE.
        TAB-TOTAL-DLR-ACTUAL = TAB-OVERHEAD-DLR-ACTUAL
                             + TAB-MATERIAL-DLR-ACTUAL
                             + TAB-LABOR-DLR-ACTUAL.
        TAB-TOTAL-DLR-PLAN   = TAB-OVERHEAD-DLR-PLAN
                             + TAB-MATERIAL-DLR-PLAN
                             + TAB-LABOR-DLR-PLAN.
        COLLECT TAB.
      ENDSELECT.
    ENDIF.
    IF NOT OPT-PERI IS INITIAL.
      SELECT * FROM COSP WHERE LEDNR EQ '00'
                           AND OBJNR EQ COAS-OBJNR.
        CLEAR TAB.
        PERFORM POPULATE-FROM-COAS.
        MOVE 001 TO TEMP-PERI.
        WHILE TEMP-PERI LT 13.
          MOVE COSP-GJAHR TO SEL-PERI(4).
          MOVE TEMP-PERI  TO SEL-PERI+4(3).
          IF SEL-PERI   IN SELPERI.
            DO 13 TIMES VARYING WKG FROM COSP-WKG001
                                    NEXT COSP-WKG002
                        VARYING MEG FROM COSP-MEG001
                                    NEXT COSP-MEG002.
              CHECK SY-INDEX EQ TEMP-PERI.
              READ TABLE COST-ELEM-XREF WITH KEY  FROM = COSP-KSTAR
                                              BINARY SEARCH.
              IF SY-SUBRC EQ 0.
                IF COST-ELEM-XREF-IDTYPE CS 'MATERIAL'.
                  IF COSP-WRTTP EQ '01'.
                    ADD WKG               TO  TAB-MATERIAL-DLR-PLAN.
                  ENDIF.
                ENDIF.
              ENDIF.
            ENDDO.
          ENDIF.
          ADD 1 TO TEMP-PERI.
        ENDWHILE.
        TAB-TOTAL-DLR-ACTUAL = TAB-OVERHEAD-DLR-ACTUAL
                             + TAB-MATERIAL-DLR-ACTUAL
                             + TAB-LABOR-DLR-ACTUAL.
        TAB-TOTAL-DLR-PLAN   = TAB-OVERHEAD-DLR-PLAN
                             + TAB-MATERIAL-DLR-PLAN
                             + TAB-LABOR-DLR-PLAN.
        COLLECT TAB.
      ENDSELECT.
    ENDIF.
  ENDSELECT.

END-OF-SELECTION.
  COMMIT WORK.

  LOOP AT TAB WHERE LABOR-HRS-PLAN EQ 0
      AND LABOR-HRS-ACTUAL EQ 0
      AND LABOR-DLR-PLAN EQ 0
      AND LABOR-DLR-ACTUAL EQ 0
      AND MATERIAL-DLR-PLAN EQ 0
      AND MATERIAL-DLR-ACTUAL EQ 0
      AND OVERHEAD-DLR-PLAN EQ 0
      AND OVERHEAD-DLR-ACTUAL EQ 0.
    IF  ZACTIV IS INITIAL.
      DELETE TAB INDEX SY-TABIX..
    ENDIF.
  ENDLOOP.
  COMMIT WORK.
  IF NOT R1 IS INITIAL.
    SORT TAB BY AUFNR USER6.
    LOOP AT TAB.
      IF  ( PREV-AUFNR NE TAB-AUFNR
            OR  PREV-USER6 NE PREV-USER6 ).
        IF  SY-TABIX NE 1.
          PERFORM R1-DO-ORDEP-TOTAL.
          MOVE TAB-USER6 TO PREV-USER6.
        ENDIF.
      ENDIF.
      IF  PREV-AUFNR NE TAB-AUFNR.
        ADD 1 TO COUNT-PROC.
        IF  SY-TABIX NE 1.
          PERFORM R1-DO-ORDER-TOTAL.
          MOVE TAB-AUFNR TO PREV-AUFNR.
        ENDIF.
      ENDIF.
      WRITE  TAB-LABOR-HRS-PLAN        TO WRT-LABOR-HRS-PLAN.
      WRITE  TAB-LABOR-HRS-ACTUAL      TO WRT-LABOR-HRS-ACTUAL.
      WRITE  TAB-LABOR-DLR-PLAN        TO WRT-LABOR-DLR-PLAN.
      WRITE  TAB-LABOR-DLR-ACTUAL      TO WRT-LABOR-DLR-ACTUAL.
      WRITE  TAB-MATERIAL-DLR-PLAN     TO WRT-MATERIAL-DLR-PLAN.
      WRITE  TAB-MATERIAL-DLR-ACTUAL   TO WRT-MATERIAL-DLR-ACTUAL.
      WRITE  TAB-OVERHEAD-DLR-PLAN     TO WRT-OVERHEAD-DLR-PLAN.
      WRITE  TAB-OVERHEAD-DLR-ACTUAL   TO WRT-OVERHEAD-DLR-ACTUAL.
      WRITE  TAB-TOTAL-DLR-PLAN        TO WRT-TOTAL-DLR-PLAN.
      WRITE  TAB-TOTAL-DLR-ACTUAL      TO WRT-TOTAL-DLR-ACTUAL.
      PERFORM CHECK-FOR-NA.
      WRITE: /01 TAB-AUFNR,
            12 TAB-USER6,
            30 TAB-EBELN,
            41 TAB-LIFNR,
            52 WRT-LABOR-HRS-PLAN,
            69 WRT-LABOR-HRS-ACTUAL,
            86 WRT-LABOR-DLR-PLAN,
           103 WRT-LABOR-DLR-ACTUAL,
           120 WRT-MATERIAL-DLR-PLAN,
           137 WRT-MATERIAL-DLR-ACTUAL,
           154 WRT-OVERHEAD-DLR-PLAN,
           171 WRT-OVERHEAD-DLR-ACTUAL,
           188 WRT-TOTAL-DLR-PLAN,
           205 WRT-TOTAL-DLR-ACTUAL.
      ADD-CORRESPONDING TAB TO GRANDTTL.
      ADD-CORRESPONDING TAB TO ORDERTTL.
      ADD-CORRESPONDING TAB TO ORDEPTTL.
      MOVE-CORRESPONDING TAB TO PREV.
    ENDLOOP.
    PERFORM R1-DO-ORDEP-TOTAL.
    PERFORM R1-DO-ORDER-TOTAL.
    WRITE  GRANDTTL-LABOR-HRS-PLAN        TO WRT-LABOR-HRS-PLAN.
    WRITE  GRANDTTL-LABOR-HRS-ACTUAL      TO WRT-LABOR-HRS-ACTUAL.
    WRITE  GRANDTTL-LABOR-DLR-PLAN        TO WRT-LABOR-DLR-PLAN.
    WRITE  GRANDTTL-LABOR-DLR-ACTUAL      TO WRT-LABOR-DLR-ACTUAL.
    WRITE  GRANDTTL-MATERIAL-DLR-PLAN     TO WRT-MATERIAL-DLR-PLAN.
    WRITE  GRANDTTL-MATERIAL-DLR-ACTUAL   TO WRT-MATERIAL-DLR-ACTUAL.
    WRITE  GRANDTTL-OVERHEAD-DLR-PLAN     TO WRT-OVERHEAD-DLR-PLAN.
    WRITE  GRANDTTL-OVERHEAD-DLR-ACTUAL   TO WRT-OVERHEAD-DLR-ACTUAL.
    WRITE  GRANDTTL-TOTAL-DLR-PLAN        TO WRT-TOTAL-DLR-PLAN.
    WRITE  GRANDTTL-TOTAL-DLR-ACTUAL      TO WRT-TOTAL-DLR-ACTUAL.
    PERFORM CHECK-FOR-NA.
    PERFORM R1-WRITE-TOTAL USING '     GRAND TOTAL'.
  ENDIF.
  WRITE: / '***********************************************'.
  WRITE: / 'Total Orders  Meeting Selection =', COUNT-COAS.
  WRITE: / 'Total Orders  Reported          =', COUNT-PROC.
  WRITE: / '***********************************************'.
  WRITE: / 'SPECIFIED DATA SELECTIONS'.
  LOOP AT AUFNR.
    IF SY-TABIX EQ 1.
      WRITE: / 'Order Number Selections'.
    ENDIF.
    WRITE: / AUFNR-OPTION, AUFNR-LOW, AUFNR-HIGH, AUFNR-SIGN.
  ENDLOOP.
  LOOP AT BUKRS.
    IF SY-TABIX EQ 1.
      WRITE: / 'Company(s) Selection'.
    ENDIF.
    WRITE: / BUKRS-OPTION, BUKRS-LOW, BUKRS-HIGH, BUKRS-SIGN.
  ENDLOOP.
  LOOP AT USER2.
    IF SY-TABIX EQ 1.
      WRITE: / 'Person(s) Responsible Selections'.
    ENDIF.
    WRITE: / USER2-OPTION, USER2-LOW, USER2-HIGH, USER2-SIGN.
  ENDLOOP.
  LOOP AT AUFEX.
    IF SY-TABIX EQ 1.
      WRITE: / 'External Order(s) Selection'.
    ENDIF.
    WRITE: / AUFEX-OPTION, AUFEX-LOW, AUFEX-HIGH, AUFEX-SIGN.
  ENDLOOP.
  LOOP AT USER0.
    IF SY-TABIX EQ 1.
      WRITE: / 'Applicant(s) Selection'.
    ENDIF.
    WRITE: / USER0-OPTION, USER0-LOW, USER0-HIGH, USER0-SIGN.
  ENDLOOP.
  LOOP AT KTEXT.
    IF SY-TABIX EQ 1.
      WRITE: / 'Description(s) of Order Selections'.
    ENDIF.
    WRITE: / KTEXT-OPTION, KTEXT-LOW, KTEXT-HIGH, KTEXT-SIGN.
  ENDLOOP.
  LOOP AT USER6.
    IF SY-TABIX EQ 1.
      WRITE: / 'Requesting Department(s) Selection'.
    ENDIF.
    WRITE: / USER6-OPTION, USER6-LOW, USER6-HIGH, USER6-SIGN.
  ENDLOOP.
  IF NOT OPT-DATE IS INITIAL.
    LOOP AT SELDATE.
      IF SY-TABIX EQ 1.
        WRITE: / 'Date Selection Options'.
      ENDIF.
      WRITE: / SELDATE-OPTION, SELDATE-LOW, SELDATE-HIGH, SELDATE-SIGN.
    ENDLOOP.
  ELSE.
    LOOP AT SELPERI.
      IF SY-TABIX EQ 1.
        WRITE: / 'Period Selection Options'.
      ENDIF.
      WRITE: / SELPERI-OPTION, SELPERI-LOW, SELPERI-HIGH, SELPERI-SIGN.
    ENDLOOP.
  ENDIF.
  WRITE: / '***********************************************'.

*---------------------------------------------------------------------*
*       FORM R1-DO-ORDER-TOTAL                                        *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM R1-DO-ORDER-TOTAL.
  WRITE  ORDERTTL-LABOR-HRS-PLAN        TO WRT-LABOR-HRS-PLAN.
  WRITE  ORDERTTL-LABOR-HRS-ACTUAL      TO WRT-LABOR-HRS-ACTUAL.
  WRITE  ORDERTTL-LABOR-DLR-PLAN        TO WRT-LABOR-DLR-PLAN.
  WRITE  ORDERTTL-LABOR-DLR-ACTUAL      TO WRT-LABOR-DLR-ACTUAL.
  WRITE  ORDERTTL-MATERIAL-DLR-PLAN     TO WRT-MATERIAL-DLR-PLAN.
  WRITE  ORDERTTL-MATERIAL-DLR-ACTUAL   TO WRT-MATERIAL-DLR-ACTUAL.
  WRITE  ORDERTTL-OVERHEAD-DLR-PLAN     TO WRT-OVERHEAD-DLR-PLAN.
  WRITE  ORDERTTL-OVERHEAD-DLR-ACTUAL   TO WRT-OVERHEAD-DLR-ACTUAL.
  WRITE  ORDERTTL-TOTAL-DLR-PLAN        TO WRT-TOTAL-DLR-PLAN.
  WRITE  ORDERTTL-TOTAL-DLR-ACTUAL      TO WRT-TOTAL-DLR-ACTUAL.
  PERFORM CHECK-FOR-NA.
  PERFORM R1-WRITE-TOTAL USING '     ORDER TOTAL'.
  WRITE: /  '  Description       =', PREV-KTEXT.
  WRITE: /  '  External Order No =', PREV-AUFEX.
  WRITE: /  '  Company           =', PREV-BUKRS.
  WRITE: /  '  Responsible Person=', PREV-USER2.
  WRITE: /  '  Applicant         =', PREV-USER0.
  CLEAR ORDERTTL.
  NEW-PAGE.
ENDFORM.
*---------------------------------------------------------------------*
*       FORM R1-DO-ORDEP-TOTAL                                        *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM R1-DO-ORDEP-TOTAL.
  WRITE  ORDEPTTL-LABOR-HRS-PLAN        TO WRT-LABOR-HRS-PLAN.
  WRITE  ORDEPTTL-LABOR-HRS-ACTUAL      TO WRT-LABOR-HRS-ACTUAL.
  WRITE  ORDEPTTL-LABOR-DLR-PLAN        TO WRT-LABOR-DLR-PLAN.
  WRITE  ORDEPTTL-LABOR-DLR-ACTUAL      TO WRT-LABOR-DLR-ACTUAL.
  WRITE  ORDEPTTL-MATERIAL-DLR-PLAN     TO WRT-MATERIAL-DLR-PLAN.
  WRITE  ORDEPTTL-MATERIAL-DLR-ACTUAL   TO WRT-MATERIAL-DLR-ACTUAL.
  WRITE  ORDEPTTL-OVERHEAD-DLR-PLAN     TO WRT-OVERHEAD-DLR-PLAN.
  WRITE  ORDEPTTL-OVERHEAD-DLR-ACTUAL   TO WRT-OVERHEAD-DLR-ACTUAL.
  WRITE  ORDEPTTL-TOTAL-DLR-PLAN        TO WRT-TOTAL-DLR-PLAN.
  WRITE  ORDEPTTL-TOTAL-DLR-ACTUAL      TO WRT-TOTAL-DLR-ACTUAL.
  PERFORM CHECK-FOR-NA.
  PERFORM R1-WRITE-TOTAL USING '     ORDER - Department TOTAL'.
  CLEAR ORDEPTTL.
ENDFORM.
*---------------------------------------------------------------------*
*       FORM R1-WRITE-TOTAL                                           *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM R1-WRITE-TOTAL USING TYPE.
  WRITE: /  TYPE,
          52 WRT-LABOR-HRS-PLAN,
          69 WRT-LABOR-HRS-ACTUAL,
          86 WRT-LABOR-DLR-PLAN,
         103 WRT-LABOR-DLR-ACTUAL,
         120 WRT-MATERIAL-DLR-PLAN,
         137 WRT-MATERIAL-DLR-ACTUAL,
         154 WRT-OVERHEAD-DLR-PLAN,
         171 WRT-OVERHEAD-DLR-ACTUAL,
         188 WRT-TOTAL-DLR-PLAN,
         205 WRT-TOTAL-DLR-ACTUAL.
ENDFORM.
*---------------------------------------------------------------------*
*       FORM POPULATE-FROM-COAS                                       *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM POPULATE-FROM-COAS.
  MOVE COAS-BUKRS       TO TAB-BUKRS.
  MOVE COAS-AUFNR       TO TAB-AUFNR.
  MOVE COAS-OBJNR       TO TAB-OBJNR.
  MOVE COAS-AUART       TO TAB-AUART.
  MOVE COAS-KTEXT       TO TAB-KTEXT.
  MOVE COAS-AUFEX       TO TAB-AUFEX.
  MOVE COAS-USER6       TO TAB-USER6.
  MOVE COAS-USER2       TO TAB-USER2.
  MOVE COAS-USER0       TO TAB-USER0.
  MOVE COAS-AUFNR       TO TAB-AUFNR2.
ENDFORM.
*---------------------------------------------------------------------*
*       FORM GET-COST-ELEM-XREF                                       *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  SETID                                                         *
*  -->  TABNAME                                                       *
*---------------------------------------------------------------------*
FORM GET-COST-ELEM-XREF USING SETID TABNAME.
  REFRESH SETVALUES.
  REFRESH SETHIER.
  CALL FUNCTION 'G_SET_TREE_IMPORT_OLD'
       EXPORTING
          CLIENT               = SY-MANDT
          LANGU                = SY-LANGU
*         NO_DESCRIPTIONS      = ' '
            SETID                = SETID
            TABNAME              = TABNAME
*         ROOT_HEADER_ONLY     = ' '
*         READ_DIRECTORY_ENTRY = ' '
*         NO_TABLE_BUFFERING   = 'X'
       TABLES
          SET_HIERARCHY        = SETHIER
            SET_VALUES           = SETVALUES
       EXCEPTIONS
            SET_NOT_FOUND        = 1
            OTHERS               = 2.
  LOOP AT SETVALUES.
    CLEAR COST-ELEM-XREF.
    MOVE SETID+2 TO COST-ELEM-XREF-IDTYPE.
    MOVE SETVALUES-FROM(10) TO TEMP-FROM.
    MOVE SETVALUES-TO(10) TO TEMP-TO.
    WHILE TEMP-FROM LE TEMP-TO.
      MOVE TEMP-FROM  TO COST-ELEM-XREF-FROM.
      APPEND COST-ELEM-XREF.
      ADD 1 TO TEMP-FROM.
    ENDWHILE.
  ENDLOOP.
ENDFORM.
*---------------------------------------------------------------------*
*       FORM CHECK-FOR-NA                                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM CHECK-FOR-NA.
  IF OPT-PERI IS INITIAL.
    MOVE '          N/A ' TO:  WRT-LABOR-HRS-PLAN,
                          WRT-LABOR-DLR-PLAN,
                          WRT-MATERIAL-DLR-PLAN,
                          WRT-OVERHEAD-DLR-PLAN,
                          WRT-TOTAL-DLR-PLAN.
  ENDIF.
ENDFORM.
INCLUDE ZCONINC3.
FORMAT INTENSIFIED OFF.
IF NOT R1 IS INITIAL.
  WRITE: /01 '     ',
        12 'Requesting  ',
        30 'Purchase ',
        41 'Vendor  ',
        67 '    Labor Hours ',
        99 '   Labor Amount ',
       133 ' Material Amount',
       167 ' Overhead Amount',
       201 '    Total Amount'.
  WRITE: /01 'Order',
        12 'Department  ',
        30 'Order No ',
        41 'Number  ',
        52 '            Plan',
        69 '          Actual',
        86 '            Plan',
       103 '          Actual',
       120 '            Plan',
       137 '          Actual',
       154 '            Plan',
       171 '          Actual',
       188 '            Plan',
       205 '          Actual'.
ENDIF.
FORMAT INTENSIFIED ON.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> CO All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.