Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata


************************************************************************

* 1/ Report Name: UPDATE NETWORK FROM ORDER

************************************************************************

* REPORT ZMROB_UPDATE_NETWORK.

************************************************************************

* 2/ Description/ Program functions:

* This program will sum up the planned work, actual work of the orders

* under activity and update the Network - Activity data with that value.

* The Network - Activity data will also be updated with the earliest

* start date and latest finish date of the the orders of Network -

* Activity.

************************************************************************REPORT ZMROB_UPDATE_NETWORK MESSAGE-ID ZGEN_EWS_MESSAGES

NO STANDARD PAGE HEADING.************************************************************************

* Table Declarations *

************************************************************************TABLES : AUFK, "Order master data

AFVC, "Operation within an order

PROJ. "Project definition************************************************************************

*INCLUDE PROGRAM

************************************************************************

*INCLUDE ZIF_ROUTINES.************************************************************************

*CONSTANTS

************************************************************************CONSTANTS: C_AUTYP_20 LIKE AUFK-AUTYP VALUE '20', "Order Cat for Network

C_AUTYP_30 LIKE AUFK-AUTYP VALUE '30', "Order Cat for Order

C_ONLY_ACTIVE TYPE XFELD VALUE 'X', "Only Active flag

C_SPRAS LIKE SY-LANGU VALUE 'E', "Logon Language

C_REL(3) VALUE 'REL', "Released Network

C_CNF(3) VALUE 'CNF', "Status Confirmed

C_X(1) VALUE 'X', "Flag

C_UPDATE VALUE 'A', "Update in Call transaction

C_TCODE LIKE TSTC-TCODE VALUE 'CN22', "Transaction code

C_A LIKE CRHD-OBJTY VALUE 'A', "Object type

C_CONV_FACT(4) TYPE P DECIMALS 2 VALUE '1.00', "Conv. factor

C_COMMA(1) VALUE ',', "Comma

C_SPACE(1) VALUE ' '. "Space

************************************************************************

*PROGRAM VARIABLES

************************************************************************

DATA: V_LINE LIKE BSVX-STTXT, "Line

V_MODE VALUE 'N', "Mode in Call transaction

V_TEXT(50), "Error Text

V_NETWRK TYPE I, "Number of network

V_NETWRK_UPD TYPE I, "Number of network updated

V_REPID LIKE SY-REPID, "Current program ID

V_TITLE LIKE SY-TITLE. "Current program name

************************************************************************

*INTERNAL TABLES

************************************************************************

* To store valid networks retrieved according to the values entered in

* the selection screen as search criteria

DATA: BEGIN OF I_NETWORK OCCURS 0,

AUFNR LIKE AUFK-AUFNR, "Network Number

OBJNR LIKE AUFK-OBJNR, "Object Number

VAPLZ LIKE AUFK-VAPLZ, "Work center

WAWRK LIKE AUFK-WAWRK, "Plant

AUFPL LIKE AFKO-AUFPL, "Routing Number

AUFNT LIKE AFKO-AUFNT, "Super network

END OF I_NETWORK.

* To store networks entered in the selection screen

DATA: BEGIN OF I_SEL_NETWORK OCCURS 0,

AUFNR LIKE AUFK-AUFNR, "Network number

END OF I_SEL_NETWORK.

* To store valid activity retrieved according to the values entered in

* the selection screen as per search criteria

DATA: BEGIN OF I_SEL_ACTIVITY OCCURS 0,

VORNR LIKE AFVC-VORNR, "Operation number

END OF I_SEL_ACTIVITY.

* To store activity entered in the selection screen

DATA: BEGIN OF I_SEL_ACTVT OCCURS 0,

VORNR LIKE AFVC-VORNR, "Operation number

END OF I_SEL_ACTVT.

* To store valid orders retrieved according to the values entered in

* the selection screen as per search criteria

DATA: BEGIN OF I_SEL_ORDER OCCURS 0,

AUFNR LIKE AUFK-AUFNR, "Order Number

END OF I_SEL_ORDER.

* To store orders entered in the selection screen

DATA: BEGIN OF I_SEL_ORD OCCURS 0,

AUFNR LIKE AUFK-AUFNR, "Order Number

END OF I_SEL_ORD.

* To store valid plant retrieved according to the values entered in

* the selection screen as per search criteria

DATA: BEGIN OF I_SEL_PLANT OCCURS 0,

WERKS LIKE T001W-WERKS, "Plant

END OF I_SEL_PLANT.

* To store plant entered in the selection screen

DATA: BEGIN OF I_SEL_PLNT OCCURS 0,

WERKS LIKE T001W-WERKS, "Plant

END OF I_SEL_PLNT.

* To store valid control key retrieved according to the values

* entered in the selection screen as per search criteria

DATA: BEGIN OF I_SEL_CTLKY OCCURS 0,

STEUS LIKE T430-STEUS, "Control key

END OF I_SEL_CTLKY.

* To store control key entered in the selection screen

DATA: BEGIN OF I_SEL_CTRLKEY OCCURS 0,

STEUS LIKE T430-STEUS, "Control key

END OF I_SEL_CTRLKEY.

* To store valid sub networks with plants, work center

DATA: BEGIN OF I_SUB_NETWORK OCCURS 0,

AUFNR LIKE AUFK-AUFNR, "Network

OBJNR LIKE AUFK-OBJNR, "Object Number

VAPLZ LIKE AUFK-VAPLZ, "Work center

WAWRK LIKE AUFK-WAWRK, "Plant

AUFPL LIKE AFKO-AUFPL, "Routing Number

AUFNT LIKE AFKO-AUFNT, "Super Network

END OF I_SUB_NETWORK.

* To store valid super networks

DATA: BEGIN OF I_SUP_NETWORK OCCURS 0,

AUFNR LIKE AUFK-AUFNR, "Network

OBJNR LIKE AUFK-OBJNR, "Object Number

VAPLZ LIKE AUFK-VAPLZ, "Work Center

WAWRK LIKE AUFK-WAWRK, "Plant

AUFPL LIKE AFKO-AUFPL, "Routing Number

AUFNT LIKE AFKO-AUFNT, "Super network

END OF I_SUP_NETWORK.

* To store valid plants

DATA: BEGIN OF I_PLANT OCCURS 0,

AUFNR LIKE AUFK-AUFNR, "Network

VAPLZ LIKE AUFK-VAPLZ, "Work Center

WAWRK LIKE AUFK-WAWRK, "Plant

END OF I_PLANT.

*To store sub networks of super networks entered in selection screen

DATA: BEGIN OF I_TEMP_SUBNET OCCURS 0,

AUFNR LIKE AFKO-AUFNR, "Network

AUFPL LIKE AFKO-AUFPL, "Routing Number

AUFNT LIKE AFKO-AUFNT, "Super Network

OBJNR LIKE AUFK-OBJNR, "Object Number

END OF I_TEMP_SUBNET.

*To store activities of the selected netwroks

DATA: BEGIN OF I_ACTIVITY OCCURS 0,

AUFPL LIKE AFVC-AUFPL, "Routing Number

APLZL LIKE AFVC-APLZL, "Counter for Order

VORNR LIKE AFVC-VORNR, "Operation Number

ARBID LIKE AFVC-ARBID, "Object ID of the resource

END OF I_ACTIVITY.

*To store activities under the networks

DATA: BEGIN OF I_NET_ACTIVITY OCCURS 0,

AUFNR LIKE AFKO-AUFNR, "Network

AUFPL LIKE AFVC-AUFPL, "Routing Number

APLZL LIKE AFVC-APLZL, "Counter for Order

VORNR LIKE AFVC-VORNR, "Operation Number

END OF I_NET_ACTIVITY.

*To store orders of the selected netwroks - activities

DATA : BEGIN OF I_ORDER OCCURS 0,

AUFNR LIKE AFKO-AUFNR, "Order Number

AUFPL LIKE AFKO-AUFPL, "Routing Number

AUFNT LIKE AFKO-AUFNT, "Super Network

AUFPT LIKE AFKO-AUFPT, "Routing no of operations

APLZT LIKE AFKO-APLZT, "General counter for Order

END OF I_ORDER.

*To store orders under network - activities

DATA : BEGIN OF I_NET_ACT_ORDER OCCURS 0,

AUFNR LIKE AFKO-AUFNT, "Network

AUFPT LIKE AFKO-AUFPT, "Routing Number for Network

APLZT LIKE AFKO-APLZT, "General Counter for Order

VORNR LIKE AFVC-VORNR, "Activity

ORDNO LIKE AFKO-AUFNR, "Order Number

AUFPL LIKE AFKO-AUFPL, "Routing number for Order Operation

END OF I_NET_ACT_ORDER.

*To store planned work, actual work, start date and finish date of

*operations under orders

DATA : BEGIN OF I_PLANNED_WORK OCCURS 0,

AUFPL LIKE AFVV-AUFPL, "Routing Number for Order Operation

APLZL LIKE AFVV-APLZL, "General counter for Order

ARBEI LIKE AFVV-ARBEI, "Planned work

ISMNW LIKE AFVV-ISMNW, "Actual work

ISDD LIKE AFVV-ISDD, "Start date

IEDD LIKE AFVV-IEDD, "End date

END OF I_PLANNED_WORK.

*To store planned work, actual work, start date and finish date of

*orders under network-activities

DATA : BEGIN OF I_NET_ACT_ORD_WORK OCCURS 0,

AUFNR LIKE AFKO-AUFNR, "Network

VORNR LIKE AFVC-VORNR, "Activity

ORDNO LIKE AFKO-AUFNR, "Order

ARBEI LIKE AFVV-ARBEI, "Planned work

ISMNW LIKE AFVV-ISMNW, "Actual work

ISDD LIKE AFVV-ISDD, "Start date

IEDD LIKE AFVV-IEDD, "End date

CNF_FLAG(1), "Confirmation flag

END OF I_NET_ACT_ORD_WORK.

*To store planned work, actual work, start date and finish date of

*activities under network

DATA : BEGIN OF I_NET_ACT_WORK OCCURS 0,

AUFNR LIKE AFKO-AUFNR, "Network

VORNR LIKE AFVC-VORNR, "Activity

ARBEI LIKE AFVV-ARBEI, "Planned work

ISMNW LIKE AFVV-ISMNW, "Actual work

ISDD LIKE AFVV-ISDD, "Start date

IEDD LIKE AFVV-IEDD, "End date

DAUNO LIKE AFVGD-DAUNO, "Normal Duration

VAPLZ LIKE AUFK-VAPLZ, "Work center

WAWRK LIKE AUFK-WAWRK, "Plant

CNF_FLAG(1), "Confirmation Flag

END OF I_NET_ACT_WORK.

*To store object numbers of operations

DATA: BEGIN OF I_OBJNR OCCURS 0,

AUFPL LIKE AFVC-AUFPL, "Routing number of operations

APLZL LIKE AFVC-APLZL, "General counter for orde

OBJNR LIKE AFVC-OBJNR, "Object number

CNF_FLAG(1), "Confirmation flag

END OF I_OBJNR.

*To store actual work, start date and end date of activities

* under network

DATA : I_NET_ACT_ACTUAL_WRK LIKE CONFCO OCCURS 0 WITH HEADER LINE.

*To store success message of the function module

*CO_RI_CONFIRMATION_CREATE

DATA : I_CONF_SUCCESS LIKE CONFCO OCCURS 0 WITH HEADER LINE.

*To store errors

DATA : I_ERROR_COST LIKE CONFER OCCURS 0 WITH HEADER LINE.

*To store object id of activities

DATA: BEGIN OF I_ARBID OCCURS 0,

OBJID LIKE CRHD-OBJID, "Object ID of resource

END OF I_ARBID.

* To store Actual work for activities

DATA: BEGIN OF I_ACTVT_ACT_WRK OCCURS 0,

AUFPL LIKE AFVV-AUFPL, "Routing No

APLZL LIKE AFVV-APLZL, "Counter for Order

ISMNW LIKE AFVV-ISMNW, "Actual Work

END OF I_ACTVT_ACT_WRK.

*To store Actual work for network - activities

DATA: BEGIN OF I_NET_ACTVT_ACT_WRK OCCURS 0,

AUFNR LIKE AFKO-AUFNR, "Network

AUFPL LIKE AFVC-AUFPL, "Routing Number

APLZL LIKE AFVC-APLZL, "Counter for Order

VORNR LIKE AFVC-VORNR, "Operation Number

ISMNW LIKE AFVV-ISMNW, "Actual Work

END OF I_NET_ACTVT_ACT_WRK.

*To store BDC data

DATA : I_BDC_TAB LIKE STANDARD TABLE OF BDCDATA

INITIAL SIZE 6 WITH HEADER LINE.

*To store messages of Call transaction of a particular network

DATA: I_MSG_TAB LIKE STANDARD TABLE OF BDCMSGCOLL WITH HEADER LINE.

*To store messages of Call transaction of all networks

DATA: I_TEMP_MSG_TAB LIKE I_MSG_TAB OCCURS 0 WITH HEADER LINE.

*To store errors of the function module CO_RI_CONFIRMATION_CREATE

DATA: I_FUNC_ERROR LIKE CONFER OCCURS 0 WITH HEADER LINE.

*To Display the errors

DATA: BEGIN OF I_ERR_REPORT OCCURS 0,

AUFNR LIKE AUFK-AUFNR, "Network Number

VORNR LIKE AFVC-VORNR, "Activity

MSGTXT(100), "Error message text

END OF I_ERR_REPORT.

************************************************************************

*SELECTION SCREEN

************************************************************************

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001. "Selection

"screen

"for

"Updating

"Network

"from

"Orders

SELECTION-SCREEN SKIP.

* Network

SELECT-OPTIONS S_NETWRK FOR AUFK-AUFNR OBLIGATORY MATCHCODE OBJECT AUKO.

SELECTION-SCREEN SKIP.

* Activity

SELECT-OPTIONS S_ACTVT FOR AFVC-VORNR MATCHCODE OBJECT VGN.

SELECTION-SCREEN SKIP.

* Order

SELECT-OPTIONS S_ORDER FOR AUFK-AUFNR MATCHCODE OBJECT ORDE.

SELECTION-SCREEN SKIP.

* Plant

SELECT-OPTIONS S_PLANT FOR PROJ-WERKS.

SELECTION-SCREEN SKIP.

* Control key

SELECT-OPTIONS S_CTLKY FOR AFVC-STEUS.

SELECTION-SCREEN SKIP.

* Checkbox for Planned, Actual, Update Duration

PARAMETERS : CB_PLAN AS CHECKBOX DEFAULT C_X,

CB_ACTL AS CHECKBOX,

CB_UPDUR AS CHECKBOX.

SELECTION-SCREEN SKIP.

* Conversion Factor

PARAMETERS : P_CVFACT(4) TYPE P DECIMALS 2 DEFAULT C_CONV_FACT.

SELECTION-SCREEN END OF BLOCK B1.

************************************************************************

*AT SELECTION SCREEN

************************************************************************

AT SELECTION-SCREEN.

* Validate the check boxes Planned and Actual

PERFORM SUB_VALIDATE_PLANNED.

* Validate the checkbox Update Duration and Conversion factor

PERFORM SUB_VALIDATE_CONV_FACT.

* Validate Network

AT SELECTION-SCREEN ON S_NETWRK.

PERFORM SUB_VALIDATE_NETWORK.

* Validate Activity

AT SELECTION-SCREEN ON S_ACTVT.

PERFORM SUB_VALIDATE_ACTVT.

* Validate Order

AT SELECTION-SCREEN ON S_ORDER.

PERFORM SUB_VALIDATE_ORDER.

* Validate Plant

AT SELECTION-SCREEN ON S_PLANT.

PERFORM SUB_VALIDATE_PLANT.

* Validate Control key

AT SELECTION-SCREEN ON S_CTLKY.

PERFORM SUB_VALIDATE_CTLKY.

************************************************************************

*INITIALIZATION

************************************************************************

* To clear all program variables

PERFORM SUB_CLEAR_ALL_VARIABLES.

* To clear all internal tables

PERFORM SUB_CLEAR_ALL_INT_TABLES.

* To refresh all internal tables

PERFORM SUB_REFRESH_ALL_INT_TABLES.

************************************************************************

*TOP OF PAGE

************************************************************************

TOP-OF-PAGE.

V_REPID = SY-REPID. "Report ID

V_TITLE = SY-TITLE. "Report Title

* To display report header

* PERFORM REPORT_HEADER USING V_REPID V_TITLE.

************************************************************************

*START OF SELECTION

************************************************************************

START-OF-SELECTION.

* Retrieve Planned work, Actual Work data for Network-Activity

PERFORM SUB_EXTRACT_DATA.

* Fill BDC table and do Call transaction CN22 when planned checkbox is

* checked

IF NOT CB_PLAN IS INITIAL.

PERFORM SUB_FILL_BDC_TAB.

ENDIF.

* Update actual work, earliest start date, latest finish date

* and confirmation flag when actual checkbox is checked

IF NOT CB_ACTL IS INITIAL.

PERFORM SUB_UPDATE_ACT_WORK.

ENDIF.

************************************************************************

*END OF SELECTION

************************************************************************

END-OF-SELECTION.

*write selection screen details in output report

* PERFORM SELECTION_SCREEN_REPORT .

* Display Audit report

PERFORM SUB_AUDIT_REPORT.

* Display Error report

PERFORM SUB_ERROR_REPORT.

*write report footer

* PERFORM REPORT_FOOTER.

************************************************************************

* FORM SUB_VALIDATE_PLANNED

************************************************************************

* DESCRIPTION: Validate whether atleast one of the check boxes

* Planned and Actual is checked

*

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....:

************************************************************************

FORM SUB_VALIDATE_PLANNED.

IF CB_PLAN IS INITIAL AND CB_ACTL IS INITIAL.

MESSAGE E035 WITH

'At least one Planned or Actual has to be checked'(008).

ENDIF.

ENDFORM. " SUB_VALIDATE_PLANNED

************************************************************************

* ENDFORM SUB_VALIDATE_PLANNED

************************************************************************

************************************************************************

* FORM SUB_VALIDATE_CONV_FACT

************************************************************************

* DESCRIPTION: Validate field Conversion factor when the checkbox

* Update Duration is checked

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....:

************************************************************************

FORM SUB_VALIDATE_CONV_FACT.

IF NOT CB_UPDUR IS INITIAL.

IF P_CVFACT IS INITIAL.

MESSAGE E035 WITH 'Conversion factor field cannot be blank'(007).

ELSEIF P_CVFACT <= 0.

MESSAGE E035 WITH

'Conversion factor cannot be ZERO or NEGATIVE'(015).

ENDIF.

ENDIF.

ENDFORM. " SUB_VALIDATE_CONV_FACT

************************************************************************

* ENDFORM SUB_VALIDATE_CONV_FACT

************************************************************************

************************************************************************

* FORM SUB_VALIDATE_NETWORK

************************************************************************

* DESCRIPTION: Validate Network

*

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....:

************************************************************************

FORM SUB_VALIDATE_NETWORK.

CLEAR I_SEL_NETWORK.

REFRESH I_SEL_NETWORK.

* Select the relevant network, Object number, Work center, Plant,

* Routing Number and Super netwok number from AUFK and AFKO based on

* the selection criteria

SELECT AUFK~AUFNR AUFK~OBJNR AUFK~VAPLZ AUFK~WAWRK

AFKO~AUFPL AFKO~AUFNT

INTO TABLE I_NETWORK

FROM AFKO INNER JOIN AUFK

ON AFKO~AUFNR = AUFK~AUFNR

WHERE AUFK~AUFNR IN S_NETWRK

AND AUFK~AUTYP = C_AUTYP_20.

READ TABLE S_NETWRK INDEX 1.

IF SY-SUBRC = 0.

IF S_NETWRK-HIGH IS INITIAL.

LOOP AT S_NETWRK.

I_SEL_NETWORK-AUFNR = S_NETWRK-LOW.

APPEND I_SEL_NETWORK.

CLEAR I_SEL_NETWORK.

ENDLOOP.

ELSE.

I_SEL_NETWORK-AUFNR = S_NETWRK-LOW.

APPEND I_SEL_NETWORK.

CLEAR I_SEL_NETWORK.

I_SEL_NETWORK-AUFNR = S_NETWRK-HIGH.

APPEND I_SEL_NETWORK.

CLEAR I_SEL_NETWORK.

ENDIF.

ENDIF.

SORT I_NETWORK BY AUFNR.

LOOP AT I_SEL_NETWORK.

READ TABLE I_NETWORK WITH KEY AUFNR = I_SEL_NETWORK-AUFNR

BINARY SEARCH.

IF SY-SUBRC <> 0.

MESSAGE E035 WITH 'Invalid Network'(002).

ENDIF.

ENDLOOP.

CLEAR I_SEL_NETWORK.

REFRESH I_SEL_NETWORK.

ENDFORM. " SUB_VALIDATE_NETWORK

************************************************************************

* ENDFORM SUB_VALIDATE_NETWORK

************************************************************************

************************************************************************

* FORM SUB_VALIDATE_ACTVT

************************************************************************

* DESCRIPTION: Validate Activity

*

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....:

************************************************************************

FORM SUB_VALIDATE_ACTVT.

CLEAR I_SEL_ACTVT.

REFRESH I_SEL_ACTVT.

* Select the relevant activity from AFVC based on the selection criteria

SELECT VORNR

INTO TABLE I_SEL_ACTIVITY

FROM AFVC

WHERE VORNR IN S_ACTVT.

READ TABLE S_ACTVT INDEX 1.

IF SY-SUBRC = 0.

IF S_ACTVT-HIGH IS INITIAL.

LOOP AT S_ACTVT.

I_SEL_ACTVT-VORNR = S_ACTVT-LOW.

APPEND I_SEL_ACTVT.

CLEAR I_SEL_ACTVT.

ENDLOOP.

ELSE.

I_SEL_ACTVT-VORNR = S_ACTVT-LOW.

APPEND I_SEL_ACTVT.

CLEAR I_SEL_ACTVT.

I_SEL_ACTVT-VORNR = S_ACTVT-HIGH.

APPEND I_SEL_ACTVT.

CLEAR I_SEL_ACTVT.

ENDIF.

ENDIF.

SORT I_SEL_ACTIVITY BY VORNR.

LOOP AT I_SEL_ACTVT.

READ TABLE I_SEL_ACTIVITY WITH KEY VORNR = I_SEL_ACTVT-VORNR

BINARY SEARCH.

IF SY-SUBRC <> 0.

MESSAGE E035 WITH 'Invalid Activity'(003).

ENDIF.

ENDLOOP.

CLEAR: I_SEL_ACTVT, I_SEL_ACTIVITY.

REFRESH: I_SEL_ACTVT, I_SEL_ACTIVITY.

ENDFORM. " SUB_VALIDATE_ACTVT

************************************************************************

* ENDFORM SUB_VALIDATE_ACTVT

************************************************************************

************************************************************************

* FORM SUB_VALIDATE_ORDER

************************************************************************

* DESCRIPTION: Validate Order

*

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....:

************************************************************************

FORM SUB_VALIDATE_ORDER.

CLEAR I_SEL_ORD.

REFRESH I_SEL_ORD.

* Select the relevant order from AUFK based on the selection criteria

SELECT AUFNR

INTO TABLE I_SEL_ORDER

FROM AUFK

WHERE AUFNR IN S_ORDER

AND AUTYP = C_AUTYP_30.

READ TABLE S_ORDER INDEX 1.

IF SY-SUBRC = 0.

IF S_ORDER-HIGH IS INITIAL.

LOOP AT S_ORDER.

I_SEL_ORD-AUFNR = S_ORDER-LOW.

APPEND I_SEL_ORD.

CLEAR I_SEL_ORD.

ENDLOOP.

ELSE.

I_SEL_ORD-AUFNR = S_ORDER-LOW.

APPEND I_SEL_ORD.

CLEAR I_SEL_ORD.

I_SEL_ORD-AUFNR = S_ORDER-HIGH.

APPEND I_SEL_ORD.

CLEAR I_SEL_ORD.

ENDIF.

ENDIF.

SORT I_SEL_ORDER BY AUFNR.

LOOP AT I_SEL_ORD.

READ TABLE I_SEL_ORDER WITH KEY AUFNR = I_SEL_ORD-AUFNR

BINARY SEARCH.

IF SY-SUBRC <> 0.

MESSAGE E035 WITH ' Invalid Order'(004).

ENDIF.

ENDLOOP.

CLEAR: I_SEL_ORD, I_SEL_ORDER.

REFRESH: I_SEL_ORD, I_SEL_ORDER.

ENDFORM. " SUB_VALIDATE_ORDER

************************************************************************

* ENDFORM SUB_VALIDATE_ORDER

************************************************************************

************************************************************************

* FORM SUB_VALIDATE_PLANT

************************************************************************

* DESCRIPTION: Validate Plant

*

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....:

************************************************************************

FORM SUB_VALIDATE_PLANT.

CLEAR I_SEL_PLNT.

REFRESH I_SEL_PLNT.

* Select the relevant plant from T001W based on the selection criteria

SELECT WERKS

INTO TABLE I_SEL_PLANT

FROM T001W

WHERE WERKS IN S_PLANT.

READ TABLE S_PLANT INDEX 1.

IF SY-SUBRC = 0.

IF S_PLANT-HIGH IS INITIAL.

LOOP AT S_PLANT.

I_SEL_PLNT-WERKS = S_PLANT-LOW.

APPEND I_SEL_PLNT.

CLEAR I_SEL_PLNT.

ENDLOOP.

ELSE.

I_SEL_PLNT-WERKS = S_PLANT-LOW.

APPEND I_SEL_PLNT.

CLEAR I_SEL_PLNT.

I_SEL_PLNT-WERKS = S_PLANT-HIGH.

APPEND I_SEL_PLNT.

CLEAR I_SEL_PLNT.

ENDIF.

ENDIF.

SORT I_SEL_PLANT BY WERKS.

LOOP AT I_SEL_PLNT.

READ TABLE I_SEL_PLANT WITH KEY WERKS = I_SEL_PLNT-WERKS

BINARY SEARCH.

IF SY-SUBRC <> 0.

MESSAGE E035 WITH 'Invalid Plant'(005).

ENDIF.

ENDLOOP.

CLEAR: I_SEL_PLNT, I_SEL_PLANT.

REFRESH: I_SEL_PLNT, I_SEL_PLANT.

ENDFORM. " SUB_VALIDATE_PLANT

************************************************************************

* ENDFORM SUB_VALIDATE_PLANT

************************************************************************

************************************************************************

* FORM SUB_VALIDATE_CTLKY

************************************************************************

* DESCRIPTION: Validate Control key

*

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....:

************************************************************************

FORM SUB_VALIDATE_CTLKY.

CLEAR I_SEL_CTRLKEY.

REFRESH I_SEL_CTRLKEY.

* Select the relevant control key from T430 based on the selection

* criteria

SELECT STEUS

INTO TABLE I_SEL_CTLKY

FROM T430

WHERE STEUS IN S_CTLKY.

READ TABLE S_CTLKY INDEX 1.

IF SY-SUBRC = 0.

IF S_CTLKY-HIGH IS INITIAL.

LOOP AT S_CTLKY.

I_SEL_CTRLKEY-STEUS = S_CTLKY-LOW.

APPEND I_SEL_CTRLKEY.

CLEAR I_SEL_CTRLKEY.

ENDLOOP.

ELSE.

I_SEL_CTRLKEY-STEUS = S_CTLKY-LOW.

APPEND I_SEL_CTRLKEY.

CLEAR I_SEL_CTRLKEY.

I_SEL_CTRLKEY-STEUS = S_CTLKY-HIGH.

APPEND I_SEL_CTRLKEY.

CLEAR I_SEL_CTRLKEY.

ENDIF.

ENDIF.

SORT I_SEL_CTLKY BY STEUS.

LOOP AT I_SEL_CTRLKEY.

READ TABLE I_SEL_CTLKY WITH KEY STEUS = I_SEL_CTRLKEY-STEUS

BINARY SEARCH.

IF SY-SUBRC <> 0.

MESSAGE E035 WITH 'Invalid Control key'(006).

ENDIF.

ENDLOOP.

CLEAR: I_SEL_CTRLKEY, I_SEL_CTLKY.

REFRESH: I_SEL_CTRLKEY, I_SEL_CTLKY.

ENDFORM. " SUB_VALIDATE_CTLKY

************************************************************************

* ENDFORM SUB_VALIDATE_CTLKY

************************************************************************

************************************************************************

* FORM SUB_CLEAR_ALL_VARIABLES

************************************************************************

* DESCRIPTION: To clear all program variables

*

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....:

************************************************************************

FORM SUB_CLEAR_ALL_VARIABLES.

CLEAR: V_LINE,

V_TEXT,

V_NETWRK,

V_NETWRK_UPD,

V_REPID,

V_TITLE.

ENDFORM. " SUB_CLEAR_ALL_VARIABLES

************************************************************************

* ENDFORM SUB_CLEAR_ALL_VARIABLES

************************************************************************

************************************************************************

* FORM SUB_CLEAR_ALL_INT_TABLES

************************************************************************

* DESCRIPTION: To clear all internal tables

*

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....:

************************************************************************

FORM SUB_CLEAR_ALL_INT_TABLES.

CLEAR: I_NETWORK,

I_SEL_NETWORK,

I_SEL_ACTIVITY,

I_SEL_ACTVT,

I_SEL_ORDER,

I_SEL_ORD,

I_SEL_PLANT,

I_SEL_PLNT,

I_SEL_CTLKY,

I_SEL_CTRLKEY,

I_SUB_NETWORK,

I_SUP_NETWORK,

I_PLANT,

I_TEMP_SUBNET,

I_ACTIVITY,

I_NET_ACTIVITY,

I_ORDER,

I_NET_ACT_ORDER,

I_PLANNED_WORK,

I_NET_ACT_ORD_WORK,

I_NET_ACT_WORK,

I_OBJNR,

I_NET_ACT_ACTUAL_WRK,

I_CONF_SUCCESS,

I_ERROR_COST,

I_ARBID,

I_ACTVT_ACT_WRK,

I_NET_ACTVT_ACT_WRK,

I_BDC_TAB,

I_MSG_TAB,

I_TEMP_MSG_TAB,

I_FUNC_ERROR,

I_ERR_REPORT.

ENDFORM. " SUB_CLEAR_ALL_INT_TABLES

************************************************************************

* ENDFORM SUB_CLEAR_ALL_INT_TABLES

************************************************************************

************************************************************************

* FORM SUB_REFRESH_ALL_INT_TABLES

************************************************************************

* DESCRIPTION: To refresh all internal tables

*

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....:

************************************************************************

FORM SUB_REFRESH_ALL_INT_TABLES.

REFRESH: I_SUB_NETWORK,

I_SUP_NETWORK,

I_PLANT,

I_TEMP_SUBNET,

I_ACTIVITY,

I_NET_ACTIVITY,

I_ORDER,

I_NET_ACT_ORDER,

I_PLANNED_WORK,

I_NET_ACT_ORD_WORK,

I_NET_ACT_WORK,

I_OBJNR,

I_NET_ACT_ACTUAL_WRK,

I_CONF_SUCCESS,

I_ERROR_COST,

I_ARBID,

I_ACTVT_ACT_WRK,

I_NET_ACTVT_ACT_WRK,

I_BDC_TAB,

I_MSG_TAB,

I_TEMP_MSG_TAB,

I_FUNC_ERROR,

I_ERR_REPORT.

ENDFORM. " SUB_REFRESH_ALL_INT_TABLES

************************************************************************

* ENDFORM SUB_REFRESH_ALL_INT_TABLES

************************************************************************

************************************************************************

* FORM SUB_EXTRACT_DATA

************************************************************************

* DESCRIPTION: Retrieve Planned work, Actual Work data for

* Network-Activity

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....: SUB_GET_ALL_SUB_NETWORK

* SUB_GET_REL_NETWORK

* SUB_GET_ACTIVITY

* SUB_GET_ORDER

* SUB_GET_PLANNED_WORK

* SUB_GET_ACTUAL_WORK

************************************************************************

FORM SUB_EXTRACT_DATA.

* Get all Sub Network for the chosen network

PERFORM SUB_GET_ALL_SUB_NETWORK.

* Get all released Sub Network for the chosen network

PERFORM SUB_GET_REL_NETWORK.

* Get all Activity

PERFORM SUB_GET_ACTIVITY.

* Get all Order

PERFORM SUB_GET_ORDER.

* Get Planned work, Actual work, Start Date and End Date

PERFORM SUB_GET_PLANNED_WORK.

* Get Actual work

PERFORM SUB_GET_ACTUAL_WORK.

ENDFORM. " SUB_EXTRACT_DATA

************************************************************************

* ENDFORM SUB_EXTRACT_DATA

************************************************************************

************************************************************************

* FORM SUB_GET_ALL_SUB_NETWORK

************************************************************************

* DESCRIPTION: Get all Sub Network

*

************************************************************************

* CALLED BY: SUB_EXTRACT_DATA

* CALLS....:

************************************************************************

FORM SUB_GET_ALL_SUB_NETWORK.

* Populate I_SUB_NETWORK with sub-ordinate networks

* Populate I_SUP_NETWORK with super networks

LOOP AT I_NETWORK.

IF I_NETWORK-AUFNT IS INITIAL.

I_SUP_NETWORK = I_NETWORK.

APPEND I_SUP_NETWORK.

ELSE.

I_SUB_NETWORK = I_NETWORK.

APPEND I_SUB_NETWORK.

ENDIF.

ENDLOOP.

CLEAR: I_SUB_NETWORK, I_SUP_NETWORK.

IF NOT I_SUB_NETWORK[] IS INITIAL.

* Get the Plant and Work center of the corresponding super network

* of the sub network

SELECT AUFNR VAPLZ WAWRK

INTO TABLE I_PLANT

FROM AUFK

FOR ALL ENTRIES IN I_SUB_NETWORK

WHERE AUFNR = I_SUB_NETWORK-AUFNT.

* Modity I_SUB_NETWORK with Plant and Work center of corresponding

* sub network

SORT I_PLANT BY AUFNR.

LOOP AT I_SUB_NETWORK.

READ TABLE I_PLANT WITH KEY AUFNR = I_SUB_NETWORK-AUFNT

BINARY SEARCH.

IF SY-SUBRC = 0.

I_SUB_NETWORK-VAPLZ = I_PLANT-VAPLZ.

I_SUB_NETWORK-WAWRK = I_PLANT-WAWRK.

MODIFY I_SUB_NETWORK TRANSPORTING VAPLZ WAWRK

WHERE AUFNT = I_PLANT-AUFNR.

ENDIF.

ENDLOOP.

ENDIF.

CLEAR: I_PLANT, I_SUB_NETWORK.

REFRESH I_PLANT.

* Get the sub networks of the super networks

IF NOT I_SUP_NETWORK[] IS INITIAL.

SELECT AFKO~AUFNR AFKO~AUFPL AFKO~AUFNT AUFK~OBJNR

INTO TABLE I_TEMP_SUBNET

FROM AFKO INNER JOIN AUFK

ON AFKO~AUFNR = AUFK~AUFNR

FOR ALL ENTRIES IN I_SUP_NETWORK

WHERE AFKO~AUFNT = I_SUP_NETWORK-AUFNR.

ENDIF.

SORT I_SUB_NETWORK BY AUFNR.

SORT I_SUP_NETWORK BY AUFNR.

* Append the sub network (with plant and work center) of

* super networks in I_SUB_NETWORK

LOOP AT I_TEMP_SUBNET.

READ TABLE I_SUB_NETWORK WITH KEY AUFNR = I_TEMP_SUBNET-AUFNR

BINARY SEARCH.

IF SY-SUBRC <> 0.

READ TABLE I_SUP_NETWORK WITH KEY AUFNR = I_TEMP_SUBNET-AUFNT

BINARY SEARCH.

IF SY-SUBRC = 0.

I_SUB_NETWORK-AUFNR = I_TEMP_SUBNET-AUFNR.

I_SUB_NETWORK-VAPLZ = I_SUP_NETWORK-VAPLZ.

I_SUB_NETWORK-WAWRK = I_SUP_NETWORK-WAWRK.

I_SUB_NETWORK-AUFNT = I_SUP_NETWORK-AUFNR.

I_SUB_NETWORK-AUFPL = I_TEMP_SUBNET-AUFPL.

I_SUB_NETWORK-OBJNR = I_TEMP_SUBNET-OBJNR.

APPEND I_SUB_NETWORK.

ENDIF.

ENDIF.

ENDLOOP.

CLEAR: I_TEMP_SUBNET, I_SUP_NETWORK, I_SUB_NETWORK.

REFRESH: I_TEMP_SUBNET.

IF I_SUB_NETWORK[] IS INITIAL.

MESSAGE I035 WITH 'No Subordinate network selected'(011).

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " SUB_GET_ALL_SUB_NETWORK

************************************************************************

* ENDFORM SUB_GET_ALL_SUB_NETWORK

************************************************************************

************************************************************************

* FORM SUB_GET_REL_NETWORK

************************************************************************

* DESCRIPTION: Get all released Sub-ordinate Networks

*

************************************************************************

* CALLED BY: SUB_EXTRACT_DATA

* CALLS....: FUNCTION 'STATUS_TEXT_EDIT'

************************************************************************

FORM SUB_GET_REL_NETWORK.

LOOP AT I_SUB_NETWORK.

CALL FUNCTION 'STATUS_TEXT_EDIT'

EXPORTING

* CLIENT = SY-MANDT

* FLG_USER_STAT = ' '

OBJNR = I_SUB_NETWORK-OBJNR

ONLY_ACTIVE = C_ONLY_ACTIVE

SPRAS = C_SPRAS

* BYPASS_BUFFER = ' '

IMPORTING

* ANW_STAT_EXISTING =

* E_STSMA =

LINE = V_LINE

* USER_LINE =

* STONR =

EXCEPTIONS

OBJECT_NOT_FOUND = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

MESSAGE I035 WITH 'Error in getting Status of the Network'(009).

LEAVE LIST-PROCESSING.

ELSE.

* if status released

* IF V_LINE CN C_REL.

IF V_LINE CS C_REL.

ELSE.

* if status not released

DELETE I_SUB_NETWORK WHERE AUFNR = I_SUB_NETWORK-AUFNR.

ENDIF.

CLEAR V_LINE.

ENDIF.

ENDLOOP.

IF I_SUB_NETWORK[] IS INITIAL.

MESSAGE I035 WITH 'No Released Subordinate network selected'(012).

LEAVE LIST-PROCESSING.

ENDIF.

CLEAR V_LINE.

ENDFORM. " SUB_GET_REL_NETWORK

************************************************************************

* ENDFORM SUB_GET_REL_NETWORK

************************************************************************

************************************************************************

* FORM SUB_GET_ACTIVITY

************************************************************************

* DESCRIPTION: Get all Activity

*

************************************************************************

* CALLED BY: SUB_EXTRACT_DATA

* CALLS....:

************************************************************************

FORM SUB_GET_ACTIVITY.

* Get the activity of the corresponding routing numbers

SELECT AUFPL APLZL VORNR ARBID

INTO TABLE I_ACTIVITY

FROM AFVC

FOR ALL ENTRIES IN I_SUB_NETWORK

WHERE AUFPL = I_SUB_NETWORK-AUFPL

AND VORNR IN S_ACTVT

AND WERKS IN S_PLANT

AND STEUS IN S_CTLKY.

IF NOT I_ACTIVITY[] IS INITIAL.

* Get existing Actual work for activities

SELECT AUFPL APLZL ISMNW

INTO TABLE I_ACTVT_ACT_WRK

FROM AFVV

FOR ALL ENTRIES IN I_ACTIVITY

WHERE AUFPL = I_ACTIVITY-AUFPL

AND APLZL = I_ACTIVITY-APLZL.

* Populate int. table I_NET_ACTVT_ACT_WRK with Actual work for

* Network - Activities

SORT I_SUB_NETWORK BY AUFPL.

SORT I_ACTIVITY BY AUFPL APLZL.

SORT I_ACTVT_ACT_WRK BY AUFPL APLZL.

LOOP AT I_ACTVT_ACT_WRK.

READ TABLE I_SUB_NETWORK WITH KEY AUFPL = I_ACTVT_ACT_WRK-AUFPL

BINARY SEARCH.

IF SY-SUBRC = 0.

I_NET_ACTVT_ACT_WRK-AUFNR = I_SUB_NETWORK-AUFNR.

ENDIF.

I_NET_ACTVT_ACT_WRK-AUFPL = I_ACTVT_ACT_WRK-AUFPL.

I_NET_ACTVT_ACT_WRK-APLZL = I_ACTVT_ACT_WRK-APLZL.

READ TABLE I_ACTIVITY WITH KEY AUFPL = I_ACTVT_ACT_WRK-AUFPL

APLZL = I_ACTVT_ACT_WRK-APLZL

BINARY SEARCH.

IF SY-SUBRC = 0.

I_NET_ACTVT_ACT_WRK-VORNR = I_ACTIVITY-VORNR.

ENDIF.

I_NET_ACTVT_ACT_WRK-ISMNW = I_ACTVT_ACT_WRK-ISMNW.

APPEND I_NET_ACTVT_ACT_WRK.

CLEAR I_NET_ACTVT_ACT_WRK.

ENDLOOP.

* Get the valid Object id

SELECT OBJID

INTO TABLE I_ARBID

FROM CRHD

FOR ALL ENTRIES IN I_ACTIVITY

WHERE OBJTY = C_A

AND OBJID = I_ACTIVITY-ARBID.

* Populate I_NET_ACTIVITY with Activity of corresponding Network

SORT I_SUB_NETWORK BY AUFPL.

SORT I_ACTIVITY BY AUFPL VORNR.

LOOP AT I_ACTIVITY.

READ TABLE I_SUB_NETWORK WITH KEY AUFPL = I_ACTIVITY-AUFPL

BINARY SEARCH.

IF SY-SUBRC = 0.

I_NET_ACTIVITY-AUFNR = I_SUB_NETWORK-AUFNR.

I_NET_ACTIVITY-AUFPL = I_SUB_NETWORK-AUFPL.

I_NET_ACTIVITY-APLZL = I_ACTIVITY-APLZL.

I_NET_ACTIVITY-VORNR = I_ACTIVITY-VORNR.

APPEND I_NET_ACTIVITY.

CLEAR I_NET_ACTIVITY.

ENDIF.

ENDLOOP.

ELSE.

MESSAGE I035 WITH 'No Activity found for selected networks'(013).

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " SUB_GET_ACTIVITY

************************************************************************

* ENDFORM SUB_GET_ACTIVITY

************************************************************************

************************************************************************

* FORM SUB_GET_ORDER

************************************************************************

* DESCRIPTION: Get all Order

*

************************************************************************

* CALLED BY: SUB_EXTRACT_DATA

* CALLS....:

************************************************************************

FORM SUB_GET_ORDER.

IF NOT I_NET_ACTIVITY[] IS INITIAL.

* Get all Orders

SELECT AUFNR AUFPL AUFNT AUFPT APLZT

INTO TABLE I_ORDER

FROM AFKO

FOR ALL ENTRIES IN I_NET_ACTIVITY

WHERE AUFNT = I_NET_ACTIVITY-AUFNR

AND AUFPT = I_NET_ACTIVITY-AUFPL

AND APLZT = I_NET_ACTIVITY-APLZL

AND AUFNR IN S_ORDER.

* Populate I_NET_ACT_ORDER with Orders of corresponding

* Network - Activity

SORT I_NET_ACTIVITY BY AUFNR AUFPL APLZL.

SORT I_ORDER BY AUFNT AUFPT APLZT AUFNR AUFPL.

LOOP AT I_ORDER.

READ TABLE I_NET_ACTIVITY WITH KEY AUFNR = I_ORDER-AUFNT

AUFPL = I_ORDER-AUFPT

APLZL = I_ORDER-APLZT

BINARY SEARCH.

IF SY-SUBRC = 0.

I_NET_ACT_ORDER-AUFNR = I_ORDER-AUFNT.

I_NET_ACT_ORDER-AUFPT = I_ORDER-AUFPT.

I_NET_ACT_ORDER-APLZT = I_ORDER-APLZT.

I_NET_ACT_ORDER-VORNR = I_NET_ACTIVITY-VORNR.

I_NET_ACT_ORDER-ORDNO = I_ORDER-AUFNR.

I_NET_ACT_ORDER-AUFPL = I_ORDER-AUFPL.

APPEND I_NET_ACT_ORDER.

CLEAR I_NET_ACT_ORDER.

ENDIF.

ENDLOOP.

SORT I_NET_ACT_ORDER BY AUFNR AUFPT APLZT VORNR.

LOOP AT I_NET_ACTIVITY.

READ TABLE I_NET_ACT_ORDER WITH KEY AUFNR = I_NET_ACTIVITY-AUFNR

AUFPT = I_NET_ACTIVITY-AUFPL

APLZT = I_NET_ACTIVITY-APLZL

VORNR = I_NET_ACTIVITY-VORNR

BINARY SEARCH.

IF SY-SUBRC <> 0.

CLEAR I_NET_ACT_ORDER.

I_NET_ACT_ORDER-AUFNR = I_NET_ACTIVITY-AUFNR.

I_NET_ACT_ORDER-AUFPT = I_NET_ACTIVITY-AUFPL.

I_NET_ACT_ORDER-APLZT = I_NET_ACTIVITY-APLZL.

I_NET_ACT_ORDER-VORNR = I_NET_ACTIVITY-VORNR.

APPEND I_NET_ACT_ORDER.

CLEAR I_NET_ACT_ORDER.

ENDIF.

ENDLOOP.

IF I_ORDER[] IS INITIAL.

MESSAGE I035 WITH

'No Order found for selected networks - activities'(014).

LEAVE LIST-PROCESSING.

ENDIF.

ENDIF.

ENDFORM. " SUB_GET_ORDER

************************************************************************

* ENDFORM SUB_GET_ORDER

************************************************************************

************************************************************************

* FORM SUB_GET_PLANNED_WORK

************************************************************************

* DESCRIPTION: Get Planned work, Actual work, Start Date and End Date

*

************************************************************************

* CALLED BY: SUB_EXTRACT_DATA

* CALLS....: FUNCTION 'STATUS_TEXT_EDIT'

************************************************************************

FORM SUB_GET_PLANNED_WORK.

DATA: LV_PLAN_WORK LIKE AFVV-ARBEI,

LV_NORM_DUR LIKE AFVGD-DAUNO,

LV_ACT_WORK LIKE AFVV-ISMNW,

LV_START_DATE LIKE AFVV-ISDD,

LV_END_DATE LIKE AFVV-IEDD,

LV_CNF_FLAG(1).

IF NOT I_NET_ACT_ORDER[] IS INITIAL.

* Get Planned work, Actual work, Start date and End date

* of all Order operations

SELECT AUFPL APLZL ARBEI ISMNW ISDD IEDD

INTO TABLE I_PLANNED_WORK

FROM AFVV

FOR ALL ENTRIES IN I_NET_ACT_ORDER

WHERE AUFPL = I_NET_ACT_ORDER-AUFPL.

ENDIF.

IF NOT I_PLANNED_WORK[] IS INITIAL.

* Get Object number of all Order operatins

SELECT AUFPL APLZL OBJNR

INTO TABLE I_OBJNR

FROM AFVC

FOR ALL ENTRIES IN I_PLANNED_WORK

WHERE AUFPL = I_PLANNED_WORK-AUFPL

AND APLZL = I_PLANNED_WORK-APLZL.

ENDIF.

IF NOT I_OBJNR[] IS INITIAL.

* Check Confirmation status of the object numbers

LOOP AT I_OBJNR.

CALL FUNCTION 'STATUS_TEXT_EDIT'

EXPORTING

* CLIENT = SY-MANDT

* FLG_USER_STAT = ' '

OBJNR = I_OBJNR-OBJNR

ONLY_ACTIVE = C_ONLY_ACTIVE

SPRAS = C_SPRAS

* BYPASS_BUFFER = ' '

IMPORTING

* ANW_STAT_EXISTING =

* E_STSMA =

LINE = V_LINE

* USER_LINE =

* STONR =

EXCEPTIONS

OBJECT_NOT_FOUND = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

MESSAGE I035 WITH 'Error in getting Confirmation Status'(010).

LEAVE LIST-PROCESSING.

ELSE.

IF V_LINE CS C_CNF.

* If status confirmed

I_OBJNR-CNF_FLAG = C_X.

MODIFY I_OBJNR TRANSPORTING CNF_FLAG WHERE OBJNR = I_OBJNR-OBJNR.

ENDIF.

CLEAR I_OBJNR.

CLEAR V_LINE.

ENDIF.

ENDLOOP.

ENDIF.

* Populate an internal table with Planned work, actual work, start date,

* end date at Network-Activity-Order level by summing up the planned

* work and actual work value of all operations under an

* Network-activity-order. The start date is populated with the earliest

* start date of all order operatins and end date is populated with the

* latest end date of all order operations.

SORT I_NET_ACT_ORDER BY AUFPL.

SORT I_PLANNED_WORK BY AUFPL APLZL.

SORT I_OBJNR BY AUFPL APLZL.

LOOP AT I_PLANNED_WORK.

LV_PLAN_WORK = LV_PLAN_WORK + I_PLANNED_WORK-ARBEI.

LV_ACT_WORK = LV_ACT_WORK + I_PLANNED_WORK-ISMNW.

IF LV_START_DATE IS INITIAL.

IF NOT I_PLANNED_WORK-ISDD IS INITIAL.

LV_START_DATE = I_PLANNED_WORK-ISDD.

ENDIF.

ENDIF.

IF LV_END_DATE IS INITIAL.

IF NOT I_PLANNED_WORK-IEDD IS INITIAL.

LV_END_DATE = I_PLANNED_WORK-IEDD.

ENDIF.

ENDIF.

IF NOT I_PLANNED_WORK-ISDD IS INITIAL.

IF I_PLANNED_WORK-ISDD < LV_START_DATE.

LV_START_DATE = I_PLANNED_WORK-ISDD.

ENDIF.

ENDIF.

IF NOT I_PLANNED_WORK-IEDD IS INITIAL.

IF I_PLANNED_WORK-IEDD > LV_END_DATE.

LV_END_DATE = I_PLANNED_WORK-IEDD.

ENDIF.

ENDIF.

READ TABLE I_OBJNR WITH KEY AUFPL = I_PLANNED_WORK-AUFPL

APLZL = I_PLANNED_WORK-APLZL

BINARY SEARCH.

IF I_OBJNR-CNF_FLAG IS INITIAL.

LV_CNF_FLAG = C_X.

ENDIF.

AT END OF AUFPL.

READ TABLE I_NET_ACT_ORDER WITH KEY AUFPL = I_PLANNED_WORK-AUFPL

BINARY SEARCH.

I_NET_ACT_ORD_WORK-AUFNR = I_NET_ACT_ORDER-AUFNR.

I_NET_ACT_ORD_WORK-VORNR = I_NET_ACT_ORDER-VORNR.

I_NET_ACT_ORD_WORK-ORDNO = I_NET_ACT_ORDER-ORDNO.

I_NET_ACT_ORD_WORK-ARBEI = LV_PLAN_WORK.

I_NET_ACT_ORD_WORK-ISMNW = LV_ACT_WORK.

I_NET_ACT_ORD_WORK-ISDD = LV_START_DATE.

I_NET_ACT_ORD_WORK-IEDD = LV_END_DATE.

IF LV_CNF_FLAG IS INITIAL.

I_NET_ACT_ORD_WORK-CNF_FLAG = C_X.

ENDIF.

APPEND I_NET_ACT_ORD_WORK.

CLEAR I_NET_ACT_ORD_WORK.

CLEAR: LV_PLAN_WORK, LV_ACT_WORK, LV_START_DATE,

LV_END_DATE, LV_CNF_FLAG.

ENDAT.

ENDLOOP.

SORT I_NET_ACT_ORD_WORK BY AUFNR VORNR.

LOOP AT I_NET_ACT_ORDER.

READ TABLE I_NET_ACT_ORD_WORK WITH KEY AUFNR = I_NET_ACT_ORDER-AUFNR

VORNR = I_NET_ACT_ORDER-VORNR

BINARY SEARCH.

IF SY-SUBRC <> 0.

CLEAR I_NET_ACT_ORD_WORK.

I_NET_ACT_ORD_WORK-AUFNR = I_NET_ACT_ORDER-AUFNR.

I_NET_ACT_ORD_WORK-VORNR = I_NET_ACT_ORDER-VORNR.

APPEND I_NET_ACT_ORD_WORK.

CLEAR I_NET_ACT_ORD_WORK.

ENDIF.

ENDLOOP.

* Populate an internal table with Planned work, actual work, start date,

* end date, work center, plant, normal duration and

* confirmation flag at Network-Activity level by summing up the planned

* work and actual work value of all orders under an

* Network-activity. The start date is populated with the earliest

* start date of all orders and end date is populated with the

* latest end date of all orders.

SORT I_NET_ACT_ORD_WORK BY AUFNR VORNR ORDNO.

SORT I_SUB_NETWORK BY AUFNR.

SORT I_NET_ACTIVITY BY AUFNR VORNR AUFPL APLZL.

SORT I_ACTIVITY BY AUFPL APLZL.

SORT I_ARBID BY OBJID.

LOOP AT I_NET_ACT_ORD_WORK.

LV_PLAN_WORK = LV_PLAN_WORK + I_NET_ACT_ORD_WORK-ARBEI.

LV_ACT_WORK = LV_ACT_WORK + I_NET_ACT_ORD_WORK-ISMNW.

IF LV_START_DATE IS INITIAL.

LV_START_DATE = I_NET_ACT_ORD_WORK-ISDD.

ENDIF.

IF LV_END_DATE IS INITIAL.

LV_END_DATE = I_NET_ACT_ORD_WORK-IEDD.

ENDIF.

IF I_NET_ACT_ORD_WORK-ISDD < LV_START_DATE.

LV_START_DATE = I_NET_ACT_ORD_WORK-ISDD.

ENDIF.

IF I_NET_ACT_ORD_WORK-IEDD > LV_END_DATE.

LV_END_DATE = I_NET_ACT_ORD_WORK-IEDD.

ENDIF.

IF I_NET_ACT_ORD_WORK-CNF_FLAG IS INITIAL.

LV_CNF_FLAG = C_X.

ENDIF.

AT END OF VORNR.

READ TABLE I_SUB_NETWORK WITH KEY AUFNR = I_NET_ACT_ORD_WORK-AUFNR

BINARY SEARCH.

I_NET_ACT_WORK-AUFNR = I_NET_ACT_ORD_WORK-AUFNR.

I_NET_ACT_WORK-VORNR = I_NET_ACT_ORD_WORK-VORNR.

I_NET_ACT_WORK-ARBEI = LV_PLAN_WORK.

I_NET_ACT_WORK-ISMNW = LV_ACT_WORK.

I_NET_ACT_WORK-ISDD = LV_START_DATE.

I_NET_ACT_WORK-IEDD = LV_END_DATE.

I_NET_ACT_WORK-WAWRK = I_SUB_NETWORK-WAWRK.

READ TABLE I_NET_ACTIVITY WITH KEY AUFNR = I_NET_ACT_WORK-AUFNR

VORNR = I_NET_ACT_WORK-VORNR

BINARY SEARCH.

IF SY-SUBRC = 0.

READ TABLE I_ACTIVITY WITH KEY AUFPL = I_NET_ACTIVITY-AUFPL

APLZL = I_NET_ACTIVITY-APLZL

BINARY SEARCH.

IF SY-SUBRC = 0.

READ TABLE I_ARBID WITH KEY OBJID = I_ACTIVITY-ARBID

BINARY SEARCH.

IF SY-SUBRC <> 0.

I_NET_ACT_WORK-VAPLZ = I_SUB_NETWORK-VAPLZ.

ENDIF.

ENDIF.

ENDIF.

IF LV_CNF_FLAG IS INITIAL.

I_NET_ACT_WORK-CNF_FLAG = C_X.

ENDIF.

IF NOT CB_UPDUR IS INITIAL.

LV_NORM_DUR = LV_PLAN_WORK * ( P_CVFACT / 100 ).

I_NET_ACT_WORK-DAUNO = LV_NORM_DUR..

ENDIF.

APPEND I_NET_ACT_WORK.

CLEAR I_NET_ACT_WORK.

CLEAR: LV_PLAN_WORK, LV_ACT_WORK, LV_START_DATE,

LV_END_DATE, LV_CNF_FLAG, LV_NORM_DUR.

ENDAT.

ENDLOOP.

ENDFORM. " SUB_GET_PLANNED_WORK

************************************************************************

* ENDFORM SUB_GET_PLANNED_WORK

************************************************************************

************************************************************************

* FORM SUB_GET_ACTUAL_WORK

************************************************************************

* DESCRIPTION: Get Actual work

*

************************************************************************

* CALLED BY: SUB_EXTRACT_DATA

* CALLS....:

************************************************************************

FORM SUB_GET_ACTUAL_WORK.

DATA: LV_START_DATE LIKE CONFCO-START_DATE,

LV_END_DATE LIKE CONFCO-END_DATE,

LV_ACT_WORK LIKE AFVV-ISMNW.

* Populate an internal table with actual work, start date,

* end date and Confirmation flag at Network-Activity level

* by summing up the planned

* work and actual work value of all orders under an

* Network-activity. The start date is populated with the earliest

* start date of all orders and end date is populated with the

* latest end date of all orders.

SORT I_NET_ACTVT_ACT_WRK BY AUFNR VORNR.

LOOP AT I_NET_ACT_WORK.

LV_START_DATE = I_NET_ACT_WORK-ISDD.

LV_END_DATE = I_NET_ACT_WORK-IEDD.

* Check the existing actual work value for Network - activities

READ TABLE I_NET_ACTVT_ACT_WRK WITH KEY AUFNR = I_NET_ACT_WORK-AUFNR

VORNR = I_NET_ACT_WORK-VORNR

BINARY SEARCH.

LV_ACT_WORK = I_NET_ACT_WORK-ISMNW - I_NET_ACTVT_ACT_WRK-ISMNW.

IF LV_ACT_WORK < 0.

LV_ACT_WORK = 0.

ENDIF.

I_NET_ACT_ACTUAL_WRK-ORDER = I_NET_ACT_WORK-AUFNR.

I_NET_ACT_ACTUAL_WRK-ACTIVITY = I_NET_ACT_WORK-VORNR.

I_NET_ACT_ACTUAL_WRK-FIN_CONF = I_NET_ACT_WORK-CNF_FLAG.

I_NET_ACT_ACTUAL_WRK-END_DATE = LV_END_DATE.

I_NET_ACT_ACTUAL_WRK-START_DATE = LV_START_DATE.

I_NET_ACT_ACTUAL_WRK-ACT_WORK = LV_ACT_WORK.

APPEND I_NET_ACT_ACTUAL_WRK.

CLEAR I_NET_ACT_ACTUAL_WRK.

CLEAR: LV_START_DATE, LV_END_DATE, LV_ACT_WORK.

ENDLOOP.

ENDFORM. " SUB_GET_ACTUAL_WORK

************************************************************************

* ENDFORM SUB_GET_ACTUAL_WORK

************************************************************************

************************************************************************

* FORM SUB_FILL_BDC_TAB

************************************************************************

* DESCRIPTION: Fill BDC table and do Call transaction

*

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....: SUB_POPULATE_BDC_TAB

************************************************************************

FORM SUB_FILL_BDC_TAB.

DATA: LV_NETWRK LIKE AFKO-AUFNR,

LV_ARBEI(8),

LV_DAUNO(6).

* Fill BDC table

LOOP AT I_NET_ACT_WORK.

IF LV_NETWRK IS INITIAL.

LV_NETWRK = I_NET_ACT_WORK-AUFNR.

PERFORM SUB_POPULATE_BDC_TAB USING :

'1' 'SAPLCOKO' '2000',

' ' 'BDC_CURSOR' 'CAUFVD-AUFNR',

' ' 'BDC_OKCODE' '=LIST',

' ' 'CAUFVD-AUFNR' I_NET_ACT_WORK-AUFNR.

PERFORM SUB_POPULATE_BDC_TAB USING:

'1' 'SAPLCOVG' '2000',

' ' 'BDC_CURSOR' 'VSNETEXT-NPLNR',

' ' 'BDC_OKCODE' '=POSI',

' ' 'BDC_SUBSCR' 'SAPLCOVG'.

ENDIF.

IF I_NET_ACT_WORK-AUFNR = LV_NETWRK.

LV_ARBEI = I_NET_ACT_WORK-ARBEI.

LV_DAUNO = I_NET_ACT_WORK-DAUNO.

PERFORM SUB_POPULATE_BDC_TAB USING :

'1' 'SAPLCOVG' '2200',

' ' 'BDC_OKCODE' '=ENT1',

' ' 'BDC_CURSOR' 'AFVGD-VORNR',

' ' 'AFVGD-VORNR' I_NET_ACT_WORK-VORNR.

PERFORM SUB_POPULATE_BDC_TAB USING :

'1' 'SAPLCOVG' '2000',

' ' 'BDC_SUBSCR' 'SAPLCOVG',

' ' 'BDC_CURSOR' 'AFVGD-DAUNO(01)'.

IF NOT I_NET_ACT_WORK-VAPLZ IS INITIAL.

PERFORM SUB_POPULATE_BDC_TAB USING :

' ' 'AFVGD-ARBPL(01)' I_NET_ACT_WORK-VAPLZ.

ENDIF.

PERFORM SUB_POPULATE_BDC_TAB USING :

' ' 'AFVGD-WERKS(01)' I_NET_ACT_WORK-WAWRK,

' ' 'AFVGD-ARBEI(01)' LV_ARBEI.

IF NOT CB_UPDUR IS INITIAL.

PERFORM SUB_POPULATE_BDC_TAB USING :

' ' 'AFVGD-DAUNO(01)' LV_DAUNO.

ENDIF.

PERFORM SUB_POPULATE_BDC_TAB USING :

' ' 'BDC_OKCODE' '=POSI'.

AT END OF AUFNR.

* The okcode of the last activity of a network is

* changed to save

I_BDC_TAB-FVAL = '=BU'.

MODIFY I_BDC_TAB INDEX SY-TABIX TRANSPORTING FVAL.

V_NETWRK = V_NETWRK + 1.

* Call transaction CN22

CALL TRANSACTION C_TCODE

USING I_BDC_TAB

MODE V_MODE

UPDATE C_UPDATE

MESSAGES INTO I_MSG_TAB.

IF SY-SUBRC = 0.

V_NETWRK_UPD = V_NETWRK_UPD + 1.

ELSE.

IF NOT I_MSG_TAB[] IS INITIAL.

READ TABLE I_MSG_TAB INDEX 1.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = I_MSG_TAB-MSGID

* LANG = '-D'

NO = I_MSG_TAB-MSGNR

V1 = I_MSG_TAB-MSGV1

V2 = I_MSG_TAB-MSGV2

V3 = I_MSG_TAB-MSGV3

V4 = I_MSG_TAB-MSGV4

IMPORTING

MSG = V_TEXT

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDIF.

CLEAR I_MSG_TAB.

I_ERR_REPORT-AUFNR = I_NET_ACT_WORK-AUFNR.

I_ERR_REPORT-MSGTXT = V_TEXT.

APPEND I_ERR_REPORT.

CLEAR I_ERR_REPORT.

CLEAR V_TEXT.

ENDIF.

CLEAR : I_BDC_TAB, I_MSG_TAB, LV_NETWRK.

REFRESH : I_BDC_TAB, I_MSG_TAB.

ENDAT.

ENDIF.

ENDLOOP.

ENDFORM. " SUB_FILL_BDC_TAB

************************************************************************

* ENDFORM SUB_FILL_BDC_TAB

************************************************************************

************************************************************************

* FORM SUB_POPULATE_BDC_TAB

************************************************************************

* DESCRIPTION: Populate BDC Table

*

************************************************************************

* CALLED BY: SUB_FILL_BDC_TAB

* CALLS....:

************************************************************************

* PARAMETERS: -> INPUT...: FLAG, VAR1, VAR2

* <- OUTBOUND:

************************************************************************

FORM SUB_POPULATE_BDC_TAB USING FLAG

VAR1

VAR2.

CLEAR I_BDC_TAB.

IF FLAG = '1'.

I_BDC_TAB-PROGRAM = VAR1.

I_BDC_TAB-DYNPRO = VAR2.

I_BDC_TAB-DYNBEGIN = 'X'.

ELSE.

I_BDC_TAB-FNAM = VAR1.

I_BDC_TAB-FVAL = VAR2.

ENDIF.

APPEND I_BDC_TAB.

ENDFORM. " SUB_POPULATE_BDC_TAB

************************************************************************

* ENDFORM SUB_POPULATE_BDC_TAB

************************************************************************

************************************************************************

* FORM SUB_UPDATE_ACT_WORK

************************************************************************

* DESCRIPTION: Update actual work, earliest start date, latest

* finish date and confirmation flag

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....: FUNCTION 'CO_RI_CONFIRMATION_CREATE'

* FUNCTION 'K_MESSAGE_TRANSFORM'

************************************************************************

FORM SUB_UPDATE_ACT_WORK.

* Update actual work, earliest start date, latest finish date

* and confirmation flag through the function module

* CO_RI_CONFIRMATION_CREATE

CALL FUNCTION 'CO_RI_CONFIRMATION_CREATE'

EXPORTING

CREATE_ERROR_POOL = C_X

TEST = C_SPACE

APPLICATION = C_AUTYP_20

* TASK_NUMBER = 0

NO_TRANSFER_FOR_LOCKS = C_X

* IMPORTING

* ERROR_COUNTER =

* ERROR_POOL =

* NO_ERROR_POOL_CREATED =

* RESERVE_COUNT =

TABLES

CONFIRMATIONS = I_NET_ACT_ACTUAL_WRK

ERRORS = I_FUNC_ERROR

CONFIRMATIONS_SUCCESS = I_CONF_SUCCESS

ERRORS_COST = I_ERROR_COST

* ERRORS_LOCK =

EXCEPTIONS

WRONG_APPLICATION = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

* Error message text is converted into system language

* through the function module K_MESSAGE_TRANSFORM.

* Converted message is inserted into an int. table

IF NOT I_FUNC_ERROR[] IS INITIAL.

LOOP AT I_FUNC_ERROR.

CALL FUNCTION 'K_MESSAGE_TRANSFORM'

EXPORTING

PAR_LANGU = SY-LANGU

PAR_MSGID = I_FUNC_ERROR-MESSAGE_ID

PAR_MSGNO = I_FUNC_ERROR-MESSAGE_NO

* PAR_MSGTY =

* PAR_MSGV1 =

* PAR_MSGV2 =

* PAR_MSGV3 =

* PAR_MSGV4 =

* PAR_TOTAL =

IMPORTING

PAR_MSGTX = V_TEXT

EXCEPTIONS

NO_MESSAGE_FOUND = 1

PAR_MSGID_MISSING = 2

PAR_MSGNO_MISSING = 3

PAR_MSGTY_MISSING = 4

OTHERS = 5.

IF SY-SUBRC <> 0.

EXIT.

ENDIF.

I_ERR_REPORT-AUFNR = I_FUNC_ERROR-ORDER.

I_ERR_REPORT-VORNR = I_FUNC_ERROR-ACTIVITY.

I_ERR_REPORT-MSGTXT = V_TEXT.

APPEND I_ERR_REPORT.

CLEAR I_ERR_REPORT.

CLEAR V_TEXT.

ENDLOOP.

ENDIF.

ENDFORM. " SUB_UPDATE_ACT_WORK

************************************************************************

* ENDFORM SUB_UPDATE_ACT_WORK

************************************************************************

************************************************************************

* FORM SELECTION_SCREEN_REPORT

************************************************************************

* DESCRIPTION: Write selection screen details in output report

*

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....:

************************************************************************

*FORM SELECTION_SCREEN_REPORT.

*

*DATA: LV_PARAM(58).

*

** Write Networks entered in the selection screen in output report

*CLEAR W_SELECTION_SCREEN.

*

*IF NOT S_NETWRK[] IS INITIAL.

* READ TABLE S_NETWRK INDEX 1.

* IF NOT S_NETWRK-HIGH IS INITIAL.

* CLEAR W_SELECTION_SCREEN.

* W_SELECTION_SCREEN-ZDESCR = 'Network'(016).

* W_SELECTION_SCREEN-ZLOW = S_NETWRK-LOW.

* APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

*

* CLEAR W_SELECTION_SCREEN.

* W_SELECTION_SCREEN-ZDESCR = 'Network'(016).

* W_SELECTION_SCREEN-ZLOW = S_NETWRK-HIGH.

* APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

* CLEAR W_SELECTION_SCREEN.

* ELSE.

* LOOP AT S_NETWRK.

* CONCATENATE LV_PARAM S_NETWRK-LOW INTO LV_PARAM

* SEPARATED BY C_COMMA.

* ENDLOOP.

* SHIFT LV_PARAM LEFT.

* CLEAR W_SELECTION_SCREEN.

* W_SELECTION_SCREEN-ZDESCR = 'Network'(016).

* W_SELECTION_SCREEN-ZLOW = LV_PARAM.

* APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

* CLEAR W_SELECTION_SCREEN.

* CLEAR LV_PARAM.

* ENDIF.

*ENDIF.

*

** Write Activities entered in the selection screen in output report

*CLEAR W_SELECTION_SCREEN.

*

*IF NOT S_ACTVT[] IS INITIAL.

* READ TABLE S_ACTVT INDEX 1.

* IF NOT S_ACTVT-HIGH IS INITIAL.

* CLEAR W_SELECTION_SCREEN.

* W_SELECTION_SCREEN-ZDESCR = 'Activity'(017).

* W_SELECTION_SCREEN-ZLOW = S_ACTVT-LOW.

* APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

*

* CLEAR W_SELECTION_SCREEN.

* W_SELECTION_SCREEN-ZDESCR = 'Activity'(017).

* W_SELECTION_SCREEN-ZLOW = S_ACTVT-HIGH.

* APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

* CLEAR W_SELECTION_SCREEN.

* ELSE.

* LOOP AT S_ACTVT.

* CONCATENATE LV_PARAM S_ACTVT-LOW INTO LV_PARAM

* SEPARATED BY C_COMMA.

* ENDLOOP.

* SHIFT LV_PARAM LEFT.

* CLEAR W_SELECTION_SCREEN.

* W_SELECTION_SCREEN-ZDESCR = 'Activity'(017).

* W_SELECTION_SCREEN-ZLOW = LV_PARAM.

* APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

* CLEAR W_SELECTION_SCREEN.

* CLEAR LV_PARAM.

* ENDIF.

*ENDIF.

*

** Write Orders entered in the selection screen in output report

*CLEAR W_SELECTION_SCREEN.

*

*IF NOT S_ORDER[] IS INITIAL.

* READ TABLE S_ORDER INDEX 1.

* IF NOT S_ORDER-HIGH IS INITIAL.

* CLEAR W_SELECTION_SCREEN.

* W_SELECTION_SCREEN-ZDESCR = 'Order'(018).

* W_SELECTION_SCREEN-ZLOW = S_ORDER-LOW.

* APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

*

* CLEAR W_SELECTION_SCREEN.

* W_SELECTION_SCREEN-ZDESCR = 'Order'(018).

* W_SELECTION_SCREEN-ZLOW = S_ORDER-HIGH.

* APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

* CLEAR W_SELECTION_SCREEN.

* ELSE.

* LOOP AT S_ORDER.

* CONCATENATE LV_PARAM S_ORDER-LOW INTO LV_PARAM

* SEPARATED BY C_COMMA.

* ENDLOOP.

* SHIFT LV_PARAM LEFT.

* CLEAR W_SELECTION_SCREEN.

* W_SELECTION_SCREEN-ZDESCR = 'Order'(018).

* W_SELECTION_SCREEN-ZLOW = LV_PARAM.

* APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

* CLEAR W_SELECTION_SCREEN.

* CLEAR LV_PARAM.

* ENDIF.

*ENDIF.

*

** Write Plants entered in the selection screen in output report

*CLEAR W_SELECTION_SCREEN.

*

*IF NOT S_PLANT[] IS INITIAL.

* READ TABLE S_PLANT INDEX 1.

* IF NOT S_PLANT-HIGH IS INITIAL.

* CLEAR W_SELECTION_SCREEN.

* W_SELECTION_SCREEN-ZDESCR = 'Plant'(019).

* W_SELECTION_SCREEN-ZLOW = S_PLANT-LOW.

* APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

*

* CLEAR W_SELECTION_SCREEN.

* W_SELECTION_SCREEN-ZDESCR = 'Plant'(019).

* W_SELECTION_SCREEN-ZLOW = S_PLANT-HIGH.

* APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

* CLEAR W_SELECTION_SCREEN.

* ELSE.

* LOOP AT S_PLANT.

* CONCATENATE LV_PARAM S_PLANT-LOW INTO LV_PARAM

* SEPARATED BY C_COMMA.

* ENDLOOP.

* SHIFT LV_PARAM LEFT.

* CLEAR W_SELECTION_SCREEN.

* W_SELECTION_SCREEN-ZDESCR = 'Plant'(019).

* W_SELECTION_SCREEN-ZLOW = LV_PARAM.

* APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

* CLEAR LV_PARAM.

* CLEAR W_SELECTION_SCREEN.

* ENDIF.

*ENDIF.

*

** Write Control keys entered in the selection screen in output report

*CLEAR W_SELECTION_SCREEN.

*

*IF NOT S_CTLKY[] IS INITIAL.

* READ TABLE S_CTLKY INDEX 1.

* IF NOT S_CTLKY-HIGH IS INITIAL.

* CLEAR W_SELECTION_SCREEN.

* W_SELECTION_SCREEN-ZDESCR = 'Control key'(020).

* W_SELECTION_SCREEN-ZLOW = S_CTLKY-LOW.

* APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

*

* CLEAR W_SELECTION_SCREEN.

* W_SELECTION_SCREEN-ZDESCR = 'Control key'(020).

* W_SELECTION_SCREEN-ZLOW = S_CTLKY-HIGH.

* APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

* CLEAR W_SELECTION_SCREEN.

* ELSE.

* LOOP AT S_CTLKY.

* CONCATENATE LV_PARAM S_CTLKY-LOW INTO LV_PARAM

* SEPARATED BY C_COMMA.

* ENDLOOP.

* SHIFT LV_PARAM LEFT.

* CLEAR W_SELECTION_SCREEN.

* W_SELECTION_SCREEN-ZDESCR = 'Control key'(020).

* W_SELECTION_SCREEN-ZLOW = LV_PARAM.

* APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

* CLEAR LV_PARAM.

* CLEAR W_SELECTION_SCREEN.

* ENDIF.

*ENDIF.

*

** Write Checkbox values entered in the selection screen in output report

*CLEAR W_SELECTION_SCREEN.

*W_SELECTION_SCREEN-ZDESCR = 'Planned'(021).

*W_SELECTION_SCREEN-ZLOW = CB_PLAN.

*APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

*

*CLEAR W_SELECTION_SCREEN.

*W_SELECTION_SCREEN-ZDESCR = 'Actual'(022).

*W_SELECTION_SCREEN-ZLOW = CB_ACTL.

*APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

*

*CLEAR W_SELECTION_SCREEN.

*W_SELECTION_SCREEN-ZDESCR = 'Update Duration'(023).

*W_SELECTION_SCREEN-ZLOW = CB_UPDUR.

*APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

*

** Write Conv. factor entered in the selection screen in output report

*WRITE P_CVFACT TO LV_PARAM.

*CONDENSE LV_PARAM NO-GAPS.

*CLEAR W_SELECTION_SCREEN.

*W_SELECTION_SCREEN-ZDESCR = 'Conversion Factor'(024).

*W_SELECTION_SCREEN-ZLOW = LV_PARAM.

*APPEND W_SELECTION_SCREEN TO I_SELECTION_SCREEN.

*CLEAR W_SELECTION_SCREEN.

*

** selection screen details are printed on output report in standard

** format

*PERFORM SELECTION_SCREEN_DETAILS TABLES I_SELECTION_SCREEN

* USING V_REPID "program name

* V_TITLE. "title

*

*ENDFORM. " SELECTION_SCREEN_REPORT

*

************************************************************************

* ENDFORM SELECTION_SCREEN_REPORT

************************************************************************

************************************************************************

* FORM SUB_AUDIT_REPORT

************************************************************************

* DESCRIPTION: Display Audit report

*

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....:

************************************************************************

FORM SUB_AUDIT_REPORT.

DATA: LV_REC_PROC TYPE I.

DESCRIBE TABLE I_NET_ACT_WORK LINES LV_REC_PROC.

SKIP.

WRITE: /'Number of Records Processed : '(025), LV_REC_PROC.

WRITE: /'Number of Network Selected : '(026), V_NETWRK.

WRITE: /'Number of Network Updated : '(027), V_NETWRK_UPD.

ENDFORM. " SUB_AUDIT_REPORT

************************************************************************

* ENDFORM SUB_AUDIT_REPORT

************************************************************************

************************************************************************

* FORM SUB_ERROR_REPORT

************************************************************************

* DESCRIPTION: Display error report

*

************************************************************************

* CALLED BY: ZMROB_UPDATE_NETWORK

* CALLS....:

************************************************************************

FORM SUB_ERROR_REPORT.

SKIP.

LOOP AT I_ERR_REPORT.

WRITE: / I_ERR_REPORT-AUFNR, ' ', I_ERR_REPORT-VORNR, ' ',

I_ERR_REPORT-MSGTXT.

ENDLOOP.

ENDFORM. " SUB_ERROR_REPORT

************************************************************************

* ENDFORM SUB_ERROR_REPORT

************************************************************************

  • No labels