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
**********************************************************************
* PROGRAM ID           : ZRGTESR_PROCESS_ORDER_CTRL              *
* PROGRAM TITLE        : Process Order Status Management Report      *
*
* DESCRIPTION          : THE PURPOSE OF THIS PROGRAM IS TO DISPLAY   *
*                        ORDERS AND ASSOCIATED CONTROL RECIPES,      *
*                        PI SHEETS AND MESSAGES IN HIERARCHYCAL ORDER*
*                        AND PERFORMING OPERATIONS LIKE DISPLAY/CHANGE
*                        ORDER, COMPLETE/DISCARD CR/PI SHEET ETC.    *
*====================================================================*
* COPIED FROM          : (CLONED PROGRAM                             *
* TITLE                : (PROGRAM TITLE)                             *
* OTHER RELATED OBJ    : (OBJECT NAMES)                              *
*====================================================================*
* CHANGE HISTORY LOG                                                 *
*--------------------------------------------------------------------*
* MOD. NO.|  DATE   | NAME   | CORRECTION NUMBER | CHANGE REFERENCE #*
*--------------------------------------------------------------------*
* MOD-001 |         |        | XXXXXXXXXX       | XXXXXXXXX          *
*                                                                    *
* DESCRIPTION:                                                       *
*--------------------------------------------------------------------*
* MOD-002 |DD/MM/YYYY| XXXXXX | XXXXXXXXXX                           *
*                                                                    *
* DESCRIPTION:                                                       *
**********************************************************************
 REPORT  ZPROCESSORDCTRL NO STANDARD PAGE HEADING
                                       LINE-SIZE  190
                                       LINE-COUNT 255
                                       MESSAGE-ID zdev.\*Tables---------------------------------------------------------------\*
 TABLES: afko,
         resb,
         aufk,
         mara,
         crhd,
         coch,
         tj48t,
         tj02t,
         t001w,
         t003o,
         t024f,
         t134,
         tcb04t,
         rco53if,
         rco54if,
         rcrde,
         makt,
         tc52,
         tc50.

\*Type Declaration-----------------------------------------------------\*

\*Type declaration for final report output display
 TYPES: BEGIN OF struct_temp,
       box TYPE text10,
       err(4) TYPE c,
       summ(4) TYPE c,
       exe(4) TYPE c,
       count(4) TYPE c,
       status(20) TYPE c,"aufastnr,
       type(10) TYPE c,"aufart,
       destination TYPE adr,
       material TYPE matnr,
       description TYPE maktx,
       creationdate(10) TYPE c,"auferfdat,
       creationtime(8) TYPE c,"auferfdat,
 END OF struct_temp.

\*Type Declaration for Selection profile status and order status fields
 TYPES: BEGIN OF typ_s_aufnr,
          aufnr TYPE aufnr,
        END OF typ_s_aufnr,

\*Type Declaration for Selection profile status and order status fields
        typ_ts_aufnr TYPE SORTED TABLE OF typ_s_aufnr
                WITH NON-UNIQUE KEY aufnr,
        BEGIN OF typ_s_objnr,
           aufnr TYPE aufnr,
           aufpl TYPE co_aufpl,
           aplfl TYPE plnfolge,
           plnfl TYPE plnfolge,
           objnr TYPE j_objnr,
       END OF typ_s_objnr,
       typ_ts_aufnr_objnr TYPE SORTED TABLE OF typ_s_objnr
                      WITH NON-UNIQUE KEY aufnr objnr,
       typ_ts_objnr TYPE SORTED TABLE OF typ_s_objnr.

\*Type declaration for order informations
 TYPES: BEGIN OF ty_afko,
          aufnr TYPE aufnr,      " Process Order
          auart TYPE aufart,     " Order type
          aufpl TYPE co_aufpl,   " Routing number
          aplzt TYPE co_aplzl,   " Counter number
          werks TYPE werks_d,    " Plant
          rsnum TYPE rsnum,      " Number of Reservation
          objnr TYPE j_objnr,    " Object number
          erdat TYPE auferfdat,   "Created on
          aedat TYPE aufaedat,    "chaged on
          erfzeit TYPE co_ins_time, "Created at
          plnbez TYPE matnr,     " Material
          maktx TYPE maktx,      " Material description
          flag(1) TYPE c,        " Flag indicator
          objnrdec TYPE j_stext, " Decoded value of objnr
        END OF ty_afko,

\*Type declaration for Operation within an order information
      BEGIN OF ty_afvc,
        aufpl TYPE co_aufpl,    " Routing number
        arbid TYPE cr_objid,    " Object Id
        phseq TYPE phseq,       " Control Receipe Dest.
        arbpl TYPE arbpl,       " Resource
      END OF ty_afvc,

\*Type declaration for lookup informations
      BEGIN OF ty_lookup,
        itemno(4) TYPE c,       " Item No
        doctype(4) TYPE c,      " Document Type
        docno(20) TYPE c,       " Document
        order TYPE aufnr,       " Order
        plant TYPE werks,       " Plant
        frdate TYPE auferfdat,  "creation date
        todate TYPE aufaedat,   "changed on
        pitype TYPE c,          "PI Type
        sender TYPE adr,        "Sender
      END OF ty_lookup.

\*Type Declaration for error messages
 TYPES: BEGIN OF ty_errorlog,
          docno(20) TYPE c,     " Document
          message(50) TYPE c,   " Error Log
        END OF ty_errorlog,

\*Type Declaration for Plant
       BEGIN OF ty_werks,
         werks  TYPE t001w-werks, "Plant
       END OF ty_werks,

\*Type Declaration for status
       BEGIN OF ty_status,
         status TYPE j_txt04,  "LIKE tj02t-txt04,  "Status
       END OF ty_status.

 TYPES: BEGIN OF ty_status_tmp,
         stat TYPE j_status,    "LIKE jest-stat,
         excl TYPE flg_sel,     "LIKE rc27x-flg_sel,
       END OF ty_status_tmp.

\* INTERNAL TABLES------------------------------------------------------\*

\*Internal table for holding order data
 DATA: i_afko TYPE STANDARD TABLE OF ty_afko
       INITIAL SIZE 0 WITH HEADER LINE.

 DATA: i_afvc TYPE STANDARD TABLE OF ty_afvc
       INITIAL SIZE 0 WITH HEADER LINE.

\*Internal table to hold lookup information
 DATA: i_lookup TYPE STANDARD TABLE OF ty_lookup
       INITIAL SIZE 0 WITH HEADER LINE.

\*Internal table to hold all valid Plants
 DATA: i_werks TYPE STANDARD TABLE OF ty_werks
       INITIAL SIZE 0 WITH HEADER LINE.

\*Internal table to hold order master data
 DATA : i_aufk TYPE STANDARD TABLE OF aufk
        INITIAL SIZE 0 WITH HEADER LINE.

\*Internal table to hold order status
 DATA: i_status_table TYPE  STANDARD TABLE OF ty_status
        INITIAL SIZE 0 WITH HEADER LINE.

\*Internal table to hold Process Management: Control Recipe Header data
 DATA : i_sheet_header TYPE  STANDARD TABLE OF coch
        INITIAL SIZE 0 WITH HEADER LINE.

\*Internal table to hold Return Code and Message for PI Sheet data
 DATA : i_return_message TYPE STANDARD TABLE OF rcopisrtc
        INITIAL SIZE 0 WITH HEADER LINE.

\*Internal table to hold Process Management: Control Recipe Header data
 DATA : i_crheader TYPE STANDARD TABLE OF coch
        INITIAL SIZE 0 WITH HEADER LINE.

\*Internal table to hold PP-PI: Header Data for Process Messages data
 DATA : i_comh TYPE STANDARD TABLE OF comh
        INITIAL SIZE 0 WITH HEADER LINE.

\*Internal table to hold final report layout data
 DATA: i_report TYPE struct_temp.

\*Internal table to hold Status header data
 DATA : i_status_hdr_tab TYPE STANDARD TABLE OF ty_status_tmp
        INITIAL SIZE 0 WITH HEADER LINE.

\*Internal table to hold ALV tree control: List of selected checkboxes
 DATA : mt_checked_items TYPE lvc_t_chit.

\*Internal table to hold bapi informations
 DATA : i_procmessheader TYPE STANDARD TABLE OF bapi_rcomhapi
        INITIAL SIZE 0 WITH HEADER LINE,

        i_procmesscharac TYPE STANDARD TABLE OF bapi_rcomeapi
        INITIAL SIZE 0 WITH HEADER LINE,

        i_procmessheaderreturn TYPE STANDARD TABLE OF bapi_rcomhrtc
        INITIAL SIZE 0 WITH HEADER LINE,

        i_procmesscharacreturn TYPE STANDARD TABLE OF bapi_rcomertc
        INITIAL SIZE 0 WITH HEADER LINE,

        i_processmessagenew TYPE STANDARD TABLE OF bapi_rcomh
        INITIAL SIZE 0 WITH HEADER LINE,

        i_procmesstextlines TYPE STANDARD TABLE OF bapi_rcomstxt
        INITIAL SIZE 0 WITH HEADER LINE,

        i_return TYPE STANDARD TABLE OF bapiret2
        INITIAL SIZE 0 WITH HEADER LINE,

        i_discard_pi TYPE STANDARD TABLE OF bapi_cntlrecid
        INITIAL SIZE 0 WITH HEADER LINE.

\*Internal table to hold data for final report output display
 DATA :  i_header TYPE STANDARD TABLE OF struct_temp
         INITIAL SIZE 0." WITH HEADER LINE.

\* Table for storing the error messages
 DATA: i_errorlog TYPE STANDARD TABLE OF ty_errorlog
       INITIAL SIZE 0 WITH HEADER LINE.

\*Internal table to hold alv display data
 DATA: l_layout_node TYPE lvc_s_layn.
 DATA: i_lvc_nkey TYPE lvc_t_nkey.
 DATA: i_children TYPE lvc_t_nkey.
 DATA: i_nodekey_change TYPE lvc_t_nkey.
 DATA: i_nodekey_change1 TYPE lvc_t_nkey.

\*&---------------------------------------------------------------------&
\*                      RANGES                                          *
\*&---------------------------------------------------------------------&
 RANGES: aufnr_range       FOR aufk-aufnr.

\*variables-------------------------------------------------------------\*
\* DEFINE STANDARD TABLES                                               *
 DATA: v_alv_tree         TYPE REF TO cl_gui_alv_tree,
       v_column_tree      TYPE REF TO cl_gui_column_tree,
       v_custom_container TYPE REF TO cl_gui_custom_container.

 CLASS cl_gui_column_tree DEFINITION LOAD.
 CLASS cl_gui_cfw DEFINITION LOAD.

 DATA tree1  TYPE REF TO cl_gui_alv_tree.
 DATA mr_toolbar TYPE REF TO cl_gui_toolbar.

 DATA : i_fieldcatalog TYPE lvc_t_fcat,
        v_max TYPE i VALUE 255,
        v_check TYPE c,
        v_ordstatus TYPE bsvx-sttxt,
        v_discard_pi TYPE c,
        v_cr_status(5) TYPE c,
        v_fav_key TYPE lvc_nkey.

 DATA : v_state TYPE  co_crstat,
        v_exe(4) TYPE c,
        v_proc_mess_id_tmp TYPE co_msid2,
        v_ordclick TYPE c,
        v_checkbox_check TYPE c.

 DATA: v_node_key TYPE lvc_t_nkey."lvc_nkey,
 DATA v_item_name TYPE lvc_nkey."tv_itmname.
 DATA v_node_key1 TYPE lvc_fname.
 DATA : i_node_key TYPE lvc_nkey,
        i_item_layout TYPE lvc_t_layi,
        i_item_layout_s TYPE lvc_s_layn,
        i_outtab_line TYPE abc_ftreet.

 DATA : v_node_text TYPE lvc_value.
 DATA : v_key(4) TYPE c.
 DATA : v_mt_checked_items TYPE lvc_s_chit.
 DATA : v_return_code TYPE i.
 DATA : v_crd(8) TYPE c VALUE 'Y_ST_'.

\*Constants-------------------------------------------------------------\*
 CONSTANTS :
 c_dash(1) TYPE c VALUE '-',       " value of -
 c_x(1) TYPE c VALUE 'X',          " value of X
&nbsp;c_3p(4) TYPE c VALUE ['<at:var at:name="3P" />'|mailto:'<at:var at:name="3P" />'],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of <at:var at:name="3P" />
&nbsp;c_bz(4) TYPE c VALUE ['<at:var at:name="BZ" />'|mailto:'<at:var at:name="BZ" />'],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of <at:var at:name="BZ" />
&nbsp;c_5b(4) TYPE c VALUE ['<at:var at:name="5B" />'|mailto:'<at:var at:name="5B" />'],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of <at:var at:name="5B" />
&nbsp;c_kb(4) TYPE c VALUE ['<at:var at:name="KB" />'|mailto:'<at:var at:name="KB" />'],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of <at:var at:name="KB" />
&nbsp;c_j4(4) TYPE c VALUE ['<at:var at:name="J4" />'|mailto:'<at:var at:name="J4" />'],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of <at:var at:name="J4" />
&nbsp;c_39(4) TYPE c VALUE ['<at:var at:name="39" />'|mailto:'<at:var at:name="39" />'],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of <at:var at:name="39" />
&nbsp;c_ord(3) TYPE c VALUE 'ORD',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of ORD
&nbsp;c_cr(2) TYPE c VALUE 'CR',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of CR
&nbsp;c_mesg(4) TYPE c VALUE 'MESG',&nbsp;&nbsp;&nbsp; " value of MSEG
&nbsp;c_pi(2) TYPE c VALUE 'PI',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of PI
&nbsp;c_box(3) TYPE c VALUE 'BOX',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of BOX
&nbsp;c_dot(1) TYPE c VALUE '.',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of .
&nbsp;c_one(5) TYPE c VALUE '00001',&nbsp;&nbsp;&nbsp; " value of '00001
&nbsp;c_two(5) TYPE c VALUE '00002',&nbsp;&nbsp;&nbsp; " value of '00002
&nbsp;c_three(5) TYPE c VALUE '00003',&nbsp; " value of '00003
&nbsp;c_four(5) TYPE c VALUE '00004',&nbsp;&nbsp; " value of '00004
&nbsp;c_five(5) TYPE c VALUE '00005',&nbsp;&nbsp; " value of '00005
&nbsp;c_six(5) TYPE c VALUE '00006',&nbsp;&nbsp;&nbsp; " value of '00006
&nbsp;c_seven(5) TYPE c VALUE '00007',&nbsp; " value of '00007
&nbsp;c_eight(5) TYPE c VALUE '00008',&nbsp; " value of '00008
&nbsp;c_nine(5) TYPE c VALUE '00009',&nbsp;&nbsp; " value of '00009
&nbsp;c_5d(4) TYPE c VALUE ['<at:var at:name="5D" />'|mailto:'<at:var at:name="5D" />'],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of <at:var at:name="5D" />
&nbsp;c_5c(4) TYPE c VALUE ['<at:var at:name="5C" />'|mailto:'<at:var at:name="5C" />'],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of <at:var at:name="5C" />
&nbsp;c_5f(4) TYPE c VALUE ['<at:var at:name="5F" />'|mailto:'<at:var at:name="5F" />'],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of <at:var at:name="5F" />
&nbsp;c_0a(4) TYPE c VALUE ['<at:var at:name="0A" />'|mailto:'<at:var at:name="0A" />'],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of <at:var at:name="0A" />
&nbsp;c_09(4) TYPE c VALUE ['<at:var at:name="09" />'|mailto:'<at:var at:name="09" />'],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of <at:var at:name="09" />
&nbsp;c_03(4) TYPE c VALUE ['<at:var at:name="03" />'|mailto:'<at:var at:name="03" />'],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of <at:var at:name="03" />
&nbsp;c_08(4) TYPE c VALUE ['<at:var at:name="08" />'|mailto:'<at:var at:name="08" />'],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of <at:var at:name="08" />
&nbsp;c_t(1) TYPE c VALUE 'T',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of T
&nbsp;c_d(1) TYPE c VALUE 'D',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of D
&nbsp;c_n(1) TYPE c VALUE 'N',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of N
&nbsp;c_e(1) TYPE c VALUE 'E',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of E
&nbsp;c_i(1) TYPE c VALUE 'I',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of I
&nbsp;c_w(1) TYPE c VALUE 'W',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of W
&nbsp;c_o(1) TYPE c VALUE 'O',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of O
&nbsp;c_c(1) TYPE c VALUE 'C',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of C
&nbsp;c_p(1) TYPE c VALUE 'P',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of P
&nbsp;c_m(1) TYPE c VALUE 'M',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of M
&nbsp;c_eq(2) TYPE c VALUE 'EQ',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of EQ
&nbsp;c_a(1) TYPE c VALUE 'A',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of Abort
&nbsp;c_br1(3) TYPE c VALUE 'BR1',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of BR1
&nbsp;c_err TYPE lvc_fname VALUE 'ERR', " value of ERR
&nbsp;c_container(9) TYPE c VALUE 'CONTAINER'," value of CONTAINER
&nbsp;c_anr(3) TYPE c VALUE 'ANR',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of ANR
&nbsp;c_wrk(3) TYPE c VALUE 'WRK',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of WRK
&nbsp;c_cor3(4) TYPE c VALUE 'COR3',&nbsp;&nbsp;&nbsp; " value of COR3
&nbsp;c_cor2(4) TYPE c VALUE 'COR2',&nbsp;&nbsp;&nbsp; " value of COR2
&nbsp;c_co53(4) TYPE c VALUE 'CO53',&nbsp;&nbsp;&nbsp; " value of CO53
&nbsp;c_co54(4) TYPE c VALUE 'CO54',&nbsp;&nbsp;&nbsp; " value of CO54
&nbsp;c_co60(4) TYPE c VALUE 'CO60',&nbsp;&nbsp;&nbsp; " value of CO60
&nbsp;c_star(1) TYPE c VALUE '*',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of *
&nbsp;c_transaction(17) TYPE c VALUE 'ZRGTES08_CRMR',
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of ZRGTES08_CRMR
&nbsp;c_terminated(10) TYPE c VALUE 'Terminated',
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of TERMINATED
&nbsp;c_discarded(9) TYPE c VALUE 'Discarded',&nbsp; " value of Discarded
&nbsp;c_processed(9) TYPE c VALUE 'Processed',&nbsp; " value of Processed
&nbsp;c_completed(9) TYPE c VALUE 'Completed',&nbsp; " value of Completed
&nbsp;c_inprocess(10) TYPE c VALUE 'In Process'," value of In Process
&nbsp;c_new1(3) TYPE c VALUE 'New',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of New
&nbsp;c_tobecompleted(15) TYPE c VALUE 'To Be Completed',
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of To be Completed
&nbsp;c_cancelled(9) TYPE c VALUE 'Cancelled',&nbsp; " value of CAncelled
&nbsp;c_sent(4) TYPE c VALUE 'Sent',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of Sent
&nbsp;c_tobesent(10) TYPE c VALUE 'To Be Sent', " value of To be sent
&nbsp;c_sentwithwarning(17) TYPE c VALUE 'Sent with Warning',
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of Sent with Warning
&nbsp;c_pi_crst(7) TYPE c VALUE 'PI_CRST',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of PI_CRST
&nbsp;c_pppi_process_order(18) TYPE c VALUE 'PPPI_PROCESS_ORDER',
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of PPPI_PROCESS_ORDER
&nbsp;c_char(4) TYPE c VALUE 'CHAR',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of CHAR
&nbsp;c_pppi_control_recipe(19) TYPE c VALUE 'PPPI_CONTROL_RECIPE',
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of PPPI_CONTROL_RECEIPE
&nbsp;c_pppi_control_recipe_status(26) TYPE c VALUE
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'PPPI_CONTROL_RECIPE_STATUS',
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of PPPI_RECEIPE_STATUS
&nbsp;c_complete(8) TYPE c VALUE 'COMPLETE',&nbsp;&nbsp;&nbsp; " value of COMPLETE
&nbsp;c_00005(5) TYPE c VALUE '00005',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of 00005
&nbsp;c_00007(5) TYPE c VALUE '00007',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of 00007
&nbsp;c_pppi_event_date(15) TYPE c VALUE 'PPPI_EVENT_DATE',
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of PPPI_EVENT_DATE
&nbsp;c_date(4) TYPE c VALUE 'DATE',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of DATE
&nbsp;c_pppi_event_time(15) TYPE c VALUE 'PPPI_EVENT_TIME',
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of PPPI_EVENT_TIME
&nbsp;c_time(4) TYPE c VALUE 'TIME',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of TIME
&nbsp;c_2(1) TYPE c VALUE '2',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of 2
&nbsp;c_ms(2) TYPE c VALUE 'MS'.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " value of MS

\*----------------------------------------------------------------------\*
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Selection screen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *
\*----------------------------------------------------------------------\*

\*\* REGULAR SELECTION SCREEN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *
&nbsp;SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
&nbsp;SELECT-OPTIONS:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s_werks FOR aufk-werks MEMORY ID wrk OBLIGATORY, "plant
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s_auart FOR aufk-auart MEMORY ID aat,&nbsp;&nbsp;&nbsp; "Order Type
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s_aufnr FOR aufk-aufnr MATCHCODE OBJECT ordb
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MEMORY ID anr,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " process order
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s_fevor FOR afko-fevor,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Production scheduler
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s_plnbez FOR afko-plnbez MATCHCODE OBJECT ordb,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Material
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s_mtart FOR t134-mtart MEMORY ID mta , "material Type
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s_ress FOR crhd-arbpl&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " Ressource
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MATCHCODE OBJECT cram
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MEMORY ID agr,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s_phseq FOR coch-phseq&nbsp; . " MEMORY ID phseq.

&nbsp;SELECTION-SCREEN: END OF BLOCK b1 .

&nbsp;SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002&nbsp; .
&nbsp;SELECT-OPTIONS: s_gstrp FOR afko-gstrp ," MEMORY ID sed,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s_gltrp FOR afko-gltrp .

&nbsp;SELECTION-SCREEN : END OF BLOCK b2 .
&nbsp;SELECTION-SCREEN : BEGIN OF BLOCK b3 WITH FRAME TITLE text-003 .
&nbsp;SELECT-OPTIONS&nbsp;&nbsp; s_status FOR tj02t-txt04.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Order Status

&nbsp;SELECTION-SCREEN SKIP 1.

&nbsp;SELECTION-SCREEN : BEGIN OF BLOCK b3_box1 WITH FRAME TITLE text-020."B1

&nbsp;SELECTION-SCREEN : BEGIN OF LINE .
&nbsp;SELECTION-SCREEN POSITION 5.
&nbsp;SELECTION-SCREEN COMMENT 5(18) text-008 FOR FIELD c_new.
&nbsp;PARAMETER : c_new AS&nbsp;&nbsp; CHECKBOX DEFAULT 'X'.
&nbsp;SELECTION-SCREEN COMMENT 40(18) text-011&nbsp; FOR FIELD c_inwork .
&nbsp;PARAMETER : c_inwork TYPE co_pis_inwork AS CHECKBOX DEFAULT 'X'.
&nbsp;SELECTION-SCREEN&nbsp; COMMENT&nbsp; 75(18) text-013 FOR FIELD c_close .
&nbsp;PARAMETER c_close TYPE co_pis_close
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AS CHECKBOX DEFAULT 'X'.
&nbsp;SELECTION-SCREEN : END OF LINE .

&nbsp;SELECTION-SCREEN : BEGIN OF LINE .
&nbsp;SELECTION-SCREEN COMMENT 5(18) text-016 FOR FIELD c_canc .
&nbsp;PARAMETER : c_canc TYPE co_pis_canc
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AS CHECKBOX DEFAULT 'X'.
&nbsp;SELECTION-SCREEN COMMENT&nbsp; 40(18) text-017 FOR FIELD c_disc.
&nbsp;PARAMETER : c_disc TYPE co_pis_disc
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AS CHECKBOX DEFAULT 'X'.

&nbsp;SELECTION-SCREEN : END OF LINE .

&nbsp;SELECTION-SCREEN : BEGIN OF LINE .
&nbsp;SELECTION-SCREEN COMMENT 5(18) text-018 FOR FIELD c_comp .
&nbsp;PARAMETER : c_comp TYPE co_pis_compl
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AS CHECKBOX DEFAULT 'X'.
&nbsp;SELECTION-SCREEN COMMENT 40(18) text-019 FOR FIELD c_arch .
&nbsp;PARAMETER : c_arch TYPE co_pis_arch
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AS CHECKBOX DEFAULT 'X'.
&nbsp;SELECTION-SCREEN : END OF LINE .

&nbsp;SELECTION-SCREEN : END OF BLOCK b3_box1.&nbsp; "B1

&nbsp;SELECTION-SCREEN : BEGIN OF BLOCK b3_box2 WITH FRAME TITLE text-021."B2

&nbsp;SELECTION-SCREEN : BEGIN OF LINE .
&nbsp;SELECTION-SCREEN POSITION 5.
&nbsp;SELECTION-SCREEN COMMENT 5(18) text-009 FOR FIELD c_create.
&nbsp;PARAMETER : c_create AS CHECKBOX DEFAULT 'X'.
&nbsp;SELECTION-SCREEN COMMENT 40(18) text-012 FOR FIELD c_sentcr .
&nbsp;PARAMETER : c_sentcr AS CHECKBOX DEFAULT 'X'.
&nbsp;SELECTION-SCREEN COMMENT 75(18) text-014 FOR FIELD c_proces .
&nbsp;PARAMETER : c_proces AS CHECKBOX DEFAULT 'X'.

&nbsp;SELECTION-SCREEN : END OF LINE .

&nbsp;SELECTION-SCREEN : BEGIN OF LINE .

&nbsp;SELECTION-SCREEN COMMENT 5(18) text-015 FOR FIELD c_termin .
&nbsp;PARAMETER c_termin AS CHECKBOX DEFAULT 'X'.
&nbsp;SELECTION-SCREEN COMMENT 40(18) text-017 FOR FIELD c_disccr .
&nbsp;PARAMETER : c_disccr AS CHECKBOX DEFAULT 'X'.

&nbsp;SELECTION-SCREEN : END OF LINE .

&nbsp;SELECTION-SCREEN : END OF BLOCK b3_box2.

&nbsp;SELECTION-SCREEN : BEGIN OF BLOCK b3_box3 WITH FRAME TITLE text-022.

&nbsp;SELECTION-SCREEN : BEGIN OF LINE .
&nbsp;SELECTION-SCREEN POSITION 5.

&nbsp;SELECTION-SCREEN COMMENT 5(18) text-010 FOR FIELD c_tosend.
&nbsp;PARAMETER : c_tosend AS CHECKBOX DEFAULT 'X'.
&nbsp;SELECTION-SCREEN COMMENT 40(18) text-012 FOR FIELD c_sentpm.
&nbsp;PARAMETER : c_sentpm AS CHECKBOX DEFAULT 'X'.
&nbsp;SELECTION-SCREEN COMMENT 75(18) text-015 FOR FIELD c_end .
&nbsp;PARAMETER : c_end AS CHECKBOX DEFAULT 'X'.

&nbsp;SELECTION-SCREEN : END OF LINE .

&nbsp;SELECTION-SCREEN : END OF BLOCK b3_box3."B3

&nbsp;SELECTION-SCREEN : END OF BLOCK b3 .

\*---------------------------------------------------------------------\*
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AT SELECTION-SCREEN ON VALUE-REQUEST&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *
\*---------------------------------------------------------------------\*
&nbsp;AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_status-low.
&nbsp;&nbsp; DATA: stsma&nbsp;&nbsp;&nbsp;&nbsp; TYPE j_stsma.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "LIKE atj49-stsma.
&nbsp;&nbsp; DATA: f4_cstate TYPE co_cstatus.&nbsp;&nbsp;&nbsp; "LIKE atj49-cstate.

&nbsp;&nbsp; PERFORM value_state(saplcoss) USING stsma CHANGING f4_cstate
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s_status-low.

&nbsp;AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_status-high.
&nbsp;&nbsp; DATA: stsma&nbsp;&nbsp;&nbsp;&nbsp; TYPE j_stsma.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "LIKE atj49-stsma.
&nbsp;&nbsp; DATA: f4_cstate TYPE co_cstatus.&nbsp;&nbsp;&nbsp; "LIKE atj49-cstate.

&nbsp;&nbsp; PERFORM value_state(saplcoss) USING stsma CHANGING f4_cstate
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s_status-high.

\*\* INITIALIZATION------------------------------------------------------\*
\*INITIALIZATION.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *
\*\* AT SELECTION SCREEN-------------------------------------------------\*

\*Validation of Plant
&nbsp;AT SELECTION-SCREEN ON s_werks.
&nbsp;&nbsp; PERFORM validate_plant.

\* Check the authorisation
&nbsp;&nbsp; PERFORM check_authorisations.

\*Validation of Order type
&nbsp;AT SELECTION-SCREEN ON s_auart.
&nbsp;&nbsp; PERFORM validate_order_type.

\*Validation of Process Order
&nbsp;AT SELECTION-SCREEN ON s_aufnr.
&nbsp;&nbsp; PERFORM validate_order.

\*Validation of Production scheduler
&nbsp;AT SELECTION-SCREEN ON s_fevor.
&nbsp;&nbsp; PERFORM validate_prod_scheduler.

\*Validation of Material
&nbsp;AT SELECTION-SCREEN ON s_plnbez.
&nbsp;&nbsp; PERFORM validate_material.

\*Validation of Material type
&nbsp;AT SELECTION-SCREEN ON s_mtart.
&nbsp;&nbsp; PERFORM validate_material_type.

\*Validation of Resource
&nbsp;AT SELECTION-SCREEN ON s_ress.
&nbsp;&nbsp; PERFORM validate_resource.

\*Validation of Control Recipe Dest.
&nbsp;AT SELECTION-SCREEN ON s_phseq.
&nbsp;&nbsp; PERFORM validate_cntrl_recp_dest.

\*Validation of order status
&nbsp;AT SELECTION-SCREEN ON s_status.

&nbsp;&nbsp; LOOP AT s_status.
&nbsp;&nbsp;&nbsp;&nbsp; IF NOT s_status-high IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM system_state_check CHANGING s_status-low.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MODIFY s_status.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM system_state_check CHANGING s_status-high.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MODIFY s_status.
&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM system_state_check CHANGING s_status-low.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MODIFY s_status.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDLOOP.

\*Check at list one of the checkbox is checked or not
&nbsp;AT SELECTION-SCREEN.
&nbsp;&nbsp; PERFORM checkbox_check.

\******************INCLUDES********************************\*
&nbsp;&nbsp; INCLUDE %LTicon%GT.

\******************INCLUDES********************************\*

\*###############################################################
\* LOCAL CLASSES
\*###############################################################
\*§1. Define a (local) class for event handling

&nbsp;CLASS lcl_tree_event_receiver DEFINITION.

&nbsp;&nbsp; PUBLIC SECTION.
\*§2. Define an event handler method for each event you want to react to.
&nbsp;&nbsp;&nbsp;&nbsp; METHODS handle_node_double_click
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FOR EVENT node_double_click OF cl_gui_alv_tree
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING node_key sender.

&nbsp;&nbsp;&nbsp;&nbsp; METHODS handle_checkbox_change
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FOR EVENT checkbox_change OF cl_gui_alv_tree
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING node_key sender.

\* 'sender' is an implicit event parameter that is provided by
\* ABAP Objects runtime system. It contains a reference to the
\* object that fired the event. You may directly use it to
\* call methods of this instance.
&nbsp;&nbsp;&nbsp;&nbsp; METHODS handle_item_double_click
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FOR EVENT item_double_click OF cl_gui_alv_tree
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING node_key sender.

&nbsp;ENDCLASS.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "lcl_tree_event_receiver DEFINITION
\*****************************************************************\*
&nbsp;CLASS lcl_tree_event_receiver IMPLEMENTATION.

\*Node double click handling
&nbsp;&nbsp; METHOD handle_node_double_click.
&nbsp;&nbsp;&nbsp;&nbsp; DATA: lt_children TYPE lvc_t_nkey.
\*first check if the node is a leaf, i.e. can not be expanded

&nbsp;&nbsp;&nbsp;&nbsp; CALL METHOD sender-%GTget_children
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_node_key&nbsp; = node_key
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; et_children = lt_children.

&nbsp;&nbsp;&nbsp;&nbsp; IF NOT lt_children IS INITIAL.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF v_ordclick EQ c_o.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM call_transaction_cor2.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CALL METHOD sender-%GTexpand_node
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_node_key&nbsp;&nbsp;&nbsp; = node_key
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_level_count = 2.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp;&nbsp;&nbsp; ELSEIF v_ordclick EQ c_c.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM call_transaction_co53.
&nbsp;&nbsp;&nbsp;&nbsp; ELSEIF v_ordclick EQ c_m.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM call_transaction_co54.
&nbsp;&nbsp;&nbsp;&nbsp; ELSEIF v_ordclick EQ c_p.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM call_transaction_co60.

&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; ENDMETHOD.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "handle_node_double_click

\*Checkbox change handling
&nbsp;&nbsp; METHOD handle_checkbox_change.

&nbsp;&nbsp; ENDMETHOD.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "handle_checkbox_change

\*Item Double click handling
&nbsp;&nbsp; METHOD handle_item_double_click.
&nbsp;&nbsp;&nbsp;&nbsp; DATA: lt_children TYPE lvc_t_nkey.
&nbsp;&nbsp;&nbsp;&nbsp; DATA: lt_selected_node TYPE&nbsp;lvc_nkey,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lt_fieldname TYPE&nbsp;lvc_fname.

&nbsp;&nbsp;&nbsp;&nbsp; CALL METHOD sender-%GTget_selected_item
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e_selected_node = lt_selected_node
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e_fieldname&nbsp;&nbsp;&nbsp;&nbsp; = lt_fieldname.

&nbsp;&nbsp;&nbsp;&nbsp; IF NOT lt_selected_node IS INITIAL.
\*Code for the Item selec event
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF v_ordclick EQ c_c.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM call_transaction_co53.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSEIF v_ordclick EQ c_m.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM call_transaction_co54.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSEIF v_ordclick EQ c_p.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM call_transaction_co60.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp;&nbsp;&nbsp; CALL METHOD sender-%GTget_children
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_node_key&nbsp; = node_key
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; et_children = lt_children.

&nbsp;&nbsp;&nbsp;&nbsp; IF NOT lt_children IS INITIAL.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF v_ordclick EQ c_o.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM call_transaction_cor2.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CALL METHOD sender-%GTexpand_node
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_node_key&nbsp;&nbsp;&nbsp; = node_key
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_level_count = 2.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; ENDMETHOD.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "handle_item_double_click

&nbsp;ENDCLASS.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "lcl_tree_event_receiver IMPLEMENTATION
\*##################################################################

\*\* TOP OF PAGE---------------------------------------------------------\*
\*TOP-OF-PAGE.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *
\*\* START OF SELECTION--------------------------------------------------\*
&nbsp;START-OF-SELECTION.

\* Populate the table i_afvc with phase information
&nbsp;&nbsp; PERFORM populate_afvc.

\*Get Order status into an internal table.
&nbsp;&nbsp; PERFORM order_status_table.

\* fill status tables
&nbsp;&nbsp; PERFORM fill_status_tables.

\* fill select ranges for order
&nbsp;&nbsp; PERFORM fill_ranges.

\* status check header
&nbsp;&nbsp; PERFORM check_s_selid.

\* fill aufnr_range
&nbsp;&nbsp; PERFORM update_s_aufnr .

\*Retrive required data from AFKO table based on the selection screen
&nbsp;&nbsp; PERFORM get_order_data.

\*\* AT LINE SELECTION---------------------------------------------------\*
\*AT LINE-SELECTION.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *
\*\* AT USER COMMAND-----------------------------------------------------\*
\*AT USER-COMMAND.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *
\*\* END OF SELECTION----------------------------------------------------\*

&nbsp;END-OF-SELECTION.

\*Call custom screen where report is to be displayed
&nbsp;&nbsp; CALL SCREEN 100.
\*&--------------------------------------------------------------------\-

\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Module&nbsp; PBO OUTPUT
\*&--------------------------------------------------------------------\-
\* Module Process before output
\*---------------------------------------------------------------------\-

&nbsp;MODULE pbo OUTPUT.
\*Set PF-Status and titlebar for the report
&nbsp;&nbsp; SET PF-STATUS 'MAIN100'.
&nbsp;&nbsp; SET TITLEBAR 'MAINTITLE'.

\*Prepare hierarchy report
&nbsp;&nbsp; IF v_alv_tree IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; PERFORM init_tree.

&nbsp;&nbsp;&nbsp;&nbsp; IF NOT i_lookup\[\] IS INITIAL.
\*Expand all order nodes
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM all_header_node_expand.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CALL METHOD cl_gui_cfw=%GTflush
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXCEPTIONS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cntl_system_error = 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cntl_error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 2.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc NE 0.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CALL FUNCTION 'POPUP_TO_INFORM'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; titel = text-054 "'Errors in Automation Queue'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; txt1&nbsp; = text-055 "'Internal Error'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; txt2&nbsp; = text-056 "'A Method in Automation Queue'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; txt3&nbsp; = text-057."'has an Error Released'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDMODULE.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " PBO OUTPUT
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Module&nbsp; PAI INPUT
\*&---------------------------------------------------------------------\*
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; text
\*----------------------------------------------------------------------\*
&nbsp;MODULE pai INPUT.

\*Get the item or node selected
&nbsp;&nbsp; PERFORM get_item_and_node_select.

&nbsp;&nbsp; CASE sy-ucomm.
&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'EXIT' OR 'BACK' OR 'CANC'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM exit_program.

\*When Display Order
&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'DISPORD'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM call_transaction_cor3.

\*When Change Ordre
&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'CHANGORD'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM call_transaction_cor2.

\*Control Recipe
&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'CNTRLRECP'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM call_transaction_co53.

\*Proces Messages
&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'MESSAGE'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM call_transaction_co54.

\*Display Error log
&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'DISPLOG'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM display_log.

\*Complete Control recipe/PI Sheet
&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'COMPLETE'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM complete_proecess.

\*Discard Control recipe
&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'DISCARD'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM discard_proecess.

\*Refresh Report Display
&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'REFRESH'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM refresh_display_list.

\*When Item/Node double click or checkbox change
&nbsp;&nbsp;&nbsp;&nbsp; WHEN OTHERS.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; READ TABLE i_lookup WITH KEY itemno = v_key.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc = 0.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF i_lookup-doctype = c_ord.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_ordclick = c_o.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSEIF i_lookup-doctype = c_cr AND
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NOT i_lookup-docno IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_ordclick = c_c.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSEIF i_lookup-doctype = c_pi AND
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NOT i_lookup-docno IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_ordclick = c_p.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSEIF i_lookup-doctype = c_mesg AND
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NOT i_lookup-docno IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_ordclick = c_m.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
\*Checkbox change,node and item click ivent triger
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CALL METHOD cl_gui_cfw=%GTdispatch
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return_code = v_return_code.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR v_ordclick.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; ENDCASE.

&nbsp;&nbsp; CALL METHOD cl_gui_cfw=%GTflush
&nbsp;&nbsp;&nbsp;&nbsp; EXCEPTIONS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cntl_system_error = 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cntl_error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 2.

&nbsp;ENDMODULE.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " PAI INPUT
\**&--------------------------------------------------------------------\-
\**&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; exit_program
\**&--------------------------------------------------------------------\-
\**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; free object and leave program
\**---------------------------------------------------------------------\-

&nbsp;FORM exit_program.

&nbsp;&nbsp; CALL METHOD v_custom_container-%GTfree.

&nbsp;&nbsp; LEAVE TO TRANSACTION c_transaction.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " exit_program
\**&--------------------------------------------------------------------\-
\**&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; init_tree
\**&--------------------------------------------------------------------\-
\*\* Create Field catalog,container and hierarchy order report
\**---------------------------------------------------------------------\-
&nbsp;FORM init_tree .

\* create container for alv-tree
&nbsp;&nbsp; DATA: l_tree_container_name(30) TYPE c.

&nbsp;&nbsp; l_tree_container_name = 'CONTAINER'.

&nbsp;&nbsp; CREATE OBJECT v_custom_container
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; container_name = l_tree_container_name
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXCEPTIONS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cntl_error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cntl_system_error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; create_error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 3
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lifetime_error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 4
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lifetime_dynpro_dynpro_link = 5.
&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE x208(00) WITH text-058.&nbsp; "'ERROR'.
&nbsp;&nbsp; ENDIF.

\* create tree control
&nbsp;&nbsp; CREATE OBJECT v_alv_tree
&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parent&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = v_custom_container
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; node_selection_mode =
cl_gui_column_tree=%GTnode_sel_mode_multiple
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; item_selection&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = c_x
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; no_html_header&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = c_x
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; no_toolbar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = ''
&nbsp;&nbsp;&nbsp;&nbsp; EXCEPTIONS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cntl_error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cntl_system_error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; create_error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 3
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lifetime_error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 4
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; illegal_node_selection_mode&nbsp; = 5
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; failed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 6
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; illegal_column_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 7.
&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE x208(00) WITH text-058.&nbsp; "'ERROR'.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "#EC NOTEXT
&nbsp;&nbsp; ENDIF.

\* create Hierarchy-header
&nbsp;&nbsp; DATA l_hierarchy_header TYPE treev_hhdr.
&nbsp;&nbsp; PERFORM build_hierarchy_header CHANGING l_hierarchy_header.

\* repid for saving variants
&nbsp;&nbsp; DATA: l_variant TYPE disvariant.
&nbsp;&nbsp; l_variant-report = sy-repid.

\* Hide columns and mark complete column for icon display
&nbsp;&nbsp; PERFORM build_fieldcatalog.

\*Set the display table
&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTset_table_for_first_display
&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is_hierarchy_header = l_hierarchy_header
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; it_list_commentary&nbsp; = l_list_commentary
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_logo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = l_logo
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_background_id&nbsp;&nbsp;&nbsp;&nbsp; = 'ALV_BACKGROUND'
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_save&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 'A'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is_variant&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = l_variant
&nbsp;&nbsp;&nbsp;&nbsp; CHANGING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; it_fieldcatalog&nbsp;&nbsp;&nbsp;&nbsp; = i_fieldcatalog
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; it_outtab&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = i_header. "table must be empty \!

&nbsp;&nbsp; PERFORM create_hierarchy.

\* add own functioncodes to the toolbar
\*&nbsp; PERFORM CHANGE_TOOLBAR.

&nbsp;&nbsp; IF i_lookup\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; CALL METHOD v_custom_container-%GTfree.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE i000 WITH text-035.
&nbsp;&nbsp;&nbsp;&nbsp; LEAVE TO TRANSACTION c_transaction.
&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp; PERFORM register_events.

\* Send data to frontend.
&nbsp;&nbsp;&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTfrontend_update.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " init_tree
\**&--------------------------------------------------------------------\-
\**&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; build_fieldcatalog
\**&--------------------------------------------------------------------\-
\*\* Build field catalog table
\*\* Field properties are specified with fix value. Constant not declared
\*\* for them
\**---------------------------------------------------------------------\-
&nbsp;FORM build_fieldcatalog.

&nbsp;&nbsp; DATA: l_fieldcatalog TYPE lvc_s_fcat.

&nbsp;&nbsp; l_fieldcatalog-row_pos&nbsp;= 0.
&nbsp;&nbsp; l_fieldcatalog-col_pos&nbsp;= 1.
&nbsp;&nbsp; l_fieldcatalog-fieldname = 'BOX'.
&nbsp;&nbsp; l_fieldcatalog-tabname&nbsp;= 1.
&nbsp;&nbsp; l_fieldcatalog-datatype = 'CHAR'.
&nbsp;&nbsp; l_fieldcatalog-fix_column = 'X'.
&nbsp;&nbsp; l_fieldcatalog-outputlen = 7.
&nbsp;&nbsp; l_fieldcatalog-inttype&nbsp;= 'C'.
&nbsp;&nbsp; l_fieldcatalog-intlen&nbsp;= 000006.
&nbsp;&nbsp; l_fieldcatalog-reptext&nbsp;= '&nbsp;&nbsp;&nbsp;&nbsp; '.
&nbsp;&nbsp; l_fieldcatalog-domname&nbsp;= 'TEXT10'.
&nbsp;&nbsp; l_fieldcatalog-ref_table = 'ZPISTATUS'.
&nbsp;&nbsp; l_fieldcatalog-dd_outlen = 000006.
&nbsp;&nbsp; l_fieldcatalog-scrtext_l =&nbsp; '&nbsp;&nbsp;&nbsp;&nbsp; '.
&nbsp;&nbsp; l_fieldcatalog-scrtext_m =&nbsp; '&nbsp;&nbsp;&nbsp;&nbsp; '.
&nbsp;&nbsp; l_fieldcatalog-scrtext_s =&nbsp; '&nbsp;&nbsp;&nbsp;&nbsp; '.
&nbsp;&nbsp; APPEND l_fieldcatalog TO i_fieldcatalog.

&nbsp;&nbsp; l_fieldcatalog-row_pos&nbsp;= 0.
&nbsp;&nbsp; l_fieldcatalog-col_pos&nbsp;= 2.
&nbsp;&nbsp; l_fieldcatalog-fieldname = 'ERR'.
&nbsp;&nbsp; l_fieldcatalog-tabname&nbsp;= 1.
&nbsp;&nbsp; l_fieldcatalog-datatype = 'CHAR'.
&nbsp;&nbsp; l_fieldcatalog-fix_column = 'X'.
&nbsp;&nbsp; l_fieldcatalog-outputlen = 6.
&nbsp;&nbsp; l_fieldcatalog-inttype&nbsp;= 'C'.
&nbsp;&nbsp; l_fieldcatalog-intlen&nbsp;= 000004.
&nbsp;&nbsp; l_fieldcatalog-reptext&nbsp;= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '.
&nbsp;&nbsp; l_fieldcatalog-domname&nbsp;= 'ZEXE'.
&nbsp;&nbsp; l_fieldcatalog-ref_table = 'ZPISTATUS'.
&nbsp;&nbsp; l_fieldcatalog-dd_outlen = 000004.
&nbsp;&nbsp; l_fieldcatalog-scrtext_l =&nbsp; ' Err&nbsp; '.
&nbsp;&nbsp; l_fieldcatalog-scrtext_m =&nbsp; ' Err&nbsp; '.
&nbsp;&nbsp; l_fieldcatalog-scrtext_s =&nbsp; ' Err&nbsp; '.
&nbsp;&nbsp; APPEND l_fieldcatalog TO i_fieldcatalog.

&nbsp;&nbsp; l_fieldcatalog-row_pos&nbsp;= 0.
&nbsp;&nbsp; l_fieldcatalog-col_pos&nbsp;= 3.
&nbsp;&nbsp; l_fieldcatalog-fieldname = 'SUMM'.
&nbsp;&nbsp; l_fieldcatalog-tabname&nbsp;= 1.
&nbsp;&nbsp; l_fieldcatalog-datatype = 'CHAR'.
&nbsp;&nbsp; l_fieldcatalog-fix_column = 'X'.
&nbsp;&nbsp; l_fieldcatalog-outputlen = 6.
&nbsp;&nbsp; l_fieldcatalog-inttype&nbsp;= 'C'.
&nbsp;&nbsp; l_fieldcatalog-intlen&nbsp;= 000004.
&nbsp;&nbsp; l_fieldcatalog-reptext&nbsp;= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '.
&nbsp;&nbsp; l_fieldcatalog-domname&nbsp;= 'ZEXE'.
&nbsp;&nbsp; l_fieldcatalog-ref_table = 'ZPISTATUS'.
&nbsp;&nbsp; l_fieldcatalog-dd_outlen = 000004.
&nbsp;&nbsp; l_fieldcatalog-scrtext_l =&nbsp; 'Action'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_m =&nbsp; 'Action'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_s =&nbsp; '&nbsp; Ac&nbsp; '.
&nbsp;&nbsp; APPEND l_fieldcatalog TO i_fieldcatalog.

&nbsp;&nbsp; l_fieldcatalog-row_pos&nbsp;= 0.
&nbsp;&nbsp; l_fieldcatalog-col_pos&nbsp;= 4.
&nbsp;&nbsp; l_fieldcatalog-fieldname = 'COUNT'.
&nbsp;&nbsp; l_fieldcatalog-tabname&nbsp;= 1.
&nbsp;&nbsp; l_fieldcatalog-datatype = 'CHAR'.
&nbsp;&nbsp; l_fieldcatalog-fix_column = 'X'.
&nbsp;&nbsp; l_fieldcatalog-outputlen = 6.
&nbsp;&nbsp; l_fieldcatalog-inttype&nbsp;= 'C'.
&nbsp;&nbsp; l_fieldcatalog-intlen&nbsp;= 000004.
&nbsp;&nbsp; l_fieldcatalog-reptext&nbsp;= 'No'.
&nbsp;&nbsp; l_fieldcatalog-domname&nbsp;= 'ZEXE'.
&nbsp;&nbsp; l_fieldcatalog-ref_table = 'ZPISTATUS'.
&nbsp;&nbsp; l_fieldcatalog-dd_outlen = 000004.
&nbsp;&nbsp; l_fieldcatalog-scrtext_l =&nbsp; 'No Count'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_m =&nbsp; 'No Count'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_s =&nbsp; '&nbsp; No&nbsp; '.
&nbsp;&nbsp; APPEND l_fieldcatalog TO i_fieldcatalog.

&nbsp;&nbsp; l_fieldcatalog-row_pos&nbsp;= 0.
&nbsp;&nbsp; l_fieldcatalog-col_pos&nbsp;= 5.
&nbsp;&nbsp; l_fieldcatalog-fieldname = 'EXE'.
&nbsp;&nbsp; l_fieldcatalog-tabname&nbsp;= 1.
&nbsp;&nbsp; l_fieldcatalog-datatype = 'CHAR'.
&nbsp;&nbsp; l_fieldcatalog-fix_column = 'X'.
&nbsp;&nbsp; l_fieldcatalog-outputlen = 8.
&nbsp;&nbsp; l_fieldcatalog-inttype&nbsp;= 'C'.
&nbsp;&nbsp; l_fieldcatalog-intlen&nbsp;= 000006.
&nbsp;&nbsp; l_fieldcatalog-reptext&nbsp;= 'Exc'.
&nbsp;&nbsp; l_fieldcatalog-domname&nbsp;= 'ZEXE'.
&nbsp;&nbsp; l_fieldcatalog-ref_table = 'ZPISTATUS'.
&nbsp;&nbsp; l_fieldcatalog-dd_outlen = 000006.
&nbsp;&nbsp; l_fieldcatalog-scrtext_l =&nbsp; 'Exc'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_m =&nbsp; 'Exc'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_s =&nbsp; 'Exc'.
&nbsp;&nbsp; APPEND l_fieldcatalog TO i_fieldcatalog.

&nbsp;&nbsp; l_fieldcatalog-row_pos&nbsp;= 0.
&nbsp;&nbsp; l_fieldcatalog-col_pos&nbsp;= 6.
&nbsp;&nbsp; l_fieldcatalog-fieldname = 'STATUS'.
&nbsp;&nbsp; l_fieldcatalog-tabname&nbsp;= 1.
&nbsp;&nbsp; l_fieldcatalog-datatype = 'NUMC'.
&nbsp;&nbsp; l_fieldcatalog-fix_column = 'X'.
&nbsp;&nbsp; l_fieldcatalog-outputlen = 20.
&nbsp;&nbsp; l_fieldcatalog-inttype&nbsp;= 'N'.
&nbsp;&nbsp; l_fieldcatalog-intlen&nbsp;= 000002.
&nbsp;&nbsp; l_fieldcatalog-reptext&nbsp;= 'Stat'.
&nbsp;&nbsp; l_fieldcatalog-domname&nbsp;= 'AUFSTNR'.
&nbsp;&nbsp; l_fieldcatalog-ref_table = 'ZPISTATUS'.
&nbsp;&nbsp; l_fieldcatalog-dd_outlen = 000002.
&nbsp;&nbsp; l_fieldcatalog-scrtext_l =&nbsp; 'Document status'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_m =&nbsp; 'Status'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_s =&nbsp; 'Status'.
&nbsp;&nbsp; APPEND l_fieldcatalog TO i_fieldcatalog.

&nbsp;&nbsp; l_fieldcatalog-row_pos&nbsp;= 0.
&nbsp;&nbsp; l_fieldcatalog-col_pos&nbsp;= 7.
&nbsp;&nbsp; l_fieldcatalog-fieldname = 'TYPE'.
&nbsp;&nbsp; l_fieldcatalog-tabname&nbsp;= 1.
&nbsp;&nbsp; l_fieldcatalog-datatype = 'CHAR'.
&nbsp;&nbsp; l_fieldcatalog-fix_column = 'X'.
&nbsp;&nbsp; l_fieldcatalog-outputlen = 14.
&nbsp;&nbsp; l_fieldcatalog-inttype&nbsp;= 'C'.
&nbsp;&nbsp; l_fieldcatalog-intlen&nbsp;= 000009.
&nbsp;&nbsp; l_fieldcatalog-reptext&nbsp;= 'Type'.
&nbsp;&nbsp; l_fieldcatalog-domname&nbsp;= 'AUFART'.
&nbsp;&nbsp; l_fieldcatalog-ref_table = 'ZPISTATUS'.
&nbsp;&nbsp; l_fieldcatalog-dd_outlen = 000008.
&nbsp;&nbsp; l_fieldcatalog-scrtext_l =&nbsp; 'Document type'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_m =&nbsp; 'Type'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_s =&nbsp; 'Type'.
&nbsp;&nbsp; APPEND l_fieldcatalog TO i_fieldcatalog.

&nbsp;&nbsp; l_fieldcatalog-row_pos&nbsp;= 0.
&nbsp;&nbsp; l_fieldcatalog-col_pos&nbsp;= 8.
&nbsp;&nbsp; l_fieldcatalog-fieldname = 'DESTINATION'.
&nbsp;&nbsp; l_fieldcatalog-tabname&nbsp;= 1.
&nbsp;&nbsp; l_fieldcatalog-datatype = 'CHAR'.
&nbsp;&nbsp; l_fieldcatalog-fix_column = 'X'.
&nbsp;&nbsp; l_fieldcatalog-outputlen = 32.
&nbsp;&nbsp; l_fieldcatalog-inttype&nbsp;= 'C'.
&nbsp;&nbsp; l_fieldcatalog-intlen&nbsp;= 000032.
&nbsp;&nbsp; l_fieldcatalog-reptext&nbsp;= 'Destination address'.
&nbsp;&nbsp; l_fieldcatalog-domname&nbsp;= 'CHAR32'.
&nbsp;&nbsp; l_fieldcatalog-ref_table = 'ZPISTATUS'.
&nbsp;&nbsp; l_fieldcatalog-dd_outlen = 000032.
&nbsp;&nbsp; l_fieldcatalog-scrtext_l =&nbsp; 'Destination/Sender address'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_m =&nbsp; 'Destn/Sendr'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_s =&nbsp; 'Destn/Send'.
&nbsp;&nbsp; APPEND l_fieldcatalog TO i_fieldcatalog.

&nbsp;&nbsp; l_fieldcatalog-row_pos&nbsp;= 0.
&nbsp;&nbsp; l_fieldcatalog-col_pos&nbsp;= 9.
&nbsp;&nbsp; l_fieldcatalog-fieldname = 'MATERIAL'.
&nbsp;&nbsp; l_fieldcatalog-tabname&nbsp;= 1.
&nbsp;&nbsp; l_fieldcatalog-convexit = 'MATN1'.
&nbsp;&nbsp; l_fieldcatalog-datatype = 'CHAR'.
&nbsp;&nbsp; l_fieldcatalog-fix_column = 'X'.
&nbsp;&nbsp; l_fieldcatalog-outputlen = 18.
&nbsp;&nbsp; l_fieldcatalog-inttype&nbsp;= 'C'.
&nbsp;&nbsp; l_fieldcatalog-intlen&nbsp;= 000018.
&nbsp;&nbsp; l_fieldcatalog-reptext&nbsp;= 'Material'.
&nbsp;&nbsp; l_fieldcatalog-domname&nbsp;= 'MATNR'.
&nbsp;&nbsp; l_fieldcatalog-ref_table = 'ZPISTATUS'.
&nbsp;&nbsp; l_fieldcatalog-dd_outlen = 000018.
&nbsp;&nbsp; l_fieldcatalog-scrtext_l =&nbsp; 'Material'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_m =&nbsp; 'Material'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_s =&nbsp; 'Material'.
&nbsp;&nbsp; APPEND l_fieldcatalog TO i_fieldcatalog.

&nbsp;&nbsp; l_fieldcatalog-row_pos&nbsp;= 0.
&nbsp;&nbsp; l_fieldcatalog-col_pos&nbsp;= 10.
&nbsp;&nbsp; l_fieldcatalog-fieldname = 'DESCRIPTION'.
&nbsp;&nbsp; l_fieldcatalog-tabname&nbsp;= 1.
&nbsp;&nbsp; l_fieldcatalog-datatype = 'CHAR'.
&nbsp;&nbsp; l_fieldcatalog-fix_column = 'X'.
&nbsp;&nbsp; l_fieldcatalog-outputlen = 40.
&nbsp;&nbsp; l_fieldcatalog-inttype&nbsp;= 'C'.
&nbsp;&nbsp; l_fieldcatalog-intlen&nbsp;= 000040.
&nbsp;&nbsp; l_fieldcatalog-reptext&nbsp;= 'Material description'.
&nbsp;&nbsp; l_fieldcatalog-domname&nbsp;= 'TEXT40'.
&nbsp;&nbsp; l_fieldcatalog-ref_table = 'ZPISTATUS'.
&nbsp;&nbsp; l_fieldcatalog-dd_outlen = 000040.
&nbsp;&nbsp; l_fieldcatalog-scrtext_l =&nbsp; 'Material description'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_m =&nbsp; 'Description'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_s =&nbsp; 'Mat Descr'.
&nbsp;&nbsp; APPEND l_fieldcatalog TO i_fieldcatalog.

&nbsp;&nbsp; l_fieldcatalog-row_pos&nbsp;= 0.
&nbsp;&nbsp; l_fieldcatalog-col_pos&nbsp;= 11.
&nbsp;&nbsp; l_fieldcatalog-fieldname = 'CREATIONDATE'.
&nbsp;&nbsp; l_fieldcatalog-tabname&nbsp;= 1.
&nbsp;&nbsp; l_fieldcatalog-datatype = 'DATS'.
&nbsp;&nbsp; l_fieldcatalog-fix_column = 'X'.
&nbsp;&nbsp; l_fieldcatalog-outputlen = 14.
&nbsp;&nbsp; l_fieldcatalog-inttype&nbsp;= 'D'.
&nbsp;&nbsp; l_fieldcatalog-intlen&nbsp;= 000012.
&nbsp;&nbsp; l_fieldcatalog-reptext&nbsp;= 'Created on'.
&nbsp;&nbsp; l_fieldcatalog-domname&nbsp;= 'DATUM'.
&nbsp;&nbsp; l_fieldcatalog-ref_table = 'ZPISTATUS'.
&nbsp;&nbsp; l_fieldcatalog-dd_outlen = 000012.
&nbsp;&nbsp; l_fieldcatalog-scrtext_l =&nbsp; 'Created on'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_m =&nbsp; 'Created on'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_s =&nbsp; ' Crtd on&nbsp;&nbsp; '.
&nbsp;&nbsp; APPEND l_fieldcatalog TO i_fieldcatalog.

&nbsp;&nbsp; l_fieldcatalog-row_pos&nbsp;= 0.
&nbsp;&nbsp; l_fieldcatalog-col_pos&nbsp;= 12.
&nbsp;&nbsp; l_fieldcatalog-fieldname = 'CREATIONTIME'.
&nbsp;&nbsp; l_fieldcatalog-tabname&nbsp;= 1.
&nbsp;&nbsp; l_fieldcatalog-datatype = 'TIMS'.
&nbsp;&nbsp; l_fieldcatalog-fix_column = 'X'.
&nbsp;&nbsp; l_fieldcatalog-outputlen = 12.
&nbsp;&nbsp; l_fieldcatalog-inttype&nbsp;= 'D'.
&nbsp;&nbsp; l_fieldcatalog-intlen&nbsp;= 000010.
&nbsp;&nbsp; l_fieldcatalog-reptext&nbsp;= 'Created at'.
&nbsp;&nbsp; l_fieldcatalog-domname&nbsp;= 'UZEIT'.
&nbsp;&nbsp; l_fieldcatalog-ref_table = 'ZPISTATUS'.
&nbsp;&nbsp; l_fieldcatalog-dd_outlen = 000010.
&nbsp;&nbsp; l_fieldcatalog-scrtext_l =&nbsp; 'Created at'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_m =&nbsp; 'Created at'.
&nbsp;&nbsp; l_fieldcatalog-scrtext_s =&nbsp; ' Crtd at&nbsp;&nbsp; '.
&nbsp;&nbsp; APPEND l_fieldcatalog TO i_fieldcatalog.

\*\* Change the fieldcatalog to hide fields and to determine
\*\* some initial calculations for chosen fields.
&nbsp;&nbsp; LOOP AT i_fieldcatalog INTO l_fieldcatalog.
&nbsp;&nbsp;&nbsp;&nbsp; CASE l_fieldcatalog-fieldname.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'MATERIAL' OR 'DESCRIPTION'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_fieldcatalog-no_out = 'X'.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'EXE'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_fieldcatalog-icon = 'X'.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'ERR'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_fieldcatalog-icon = 'X'.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'SUMM'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_fieldcatalog-icon = 'X'.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'COUNT'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_fieldcatalog-just = 'C'.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'BOX'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_fieldcatalog-just = 'C'.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHEN 'STATUS'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_fieldcatalog-just = 'L'.

&nbsp;&nbsp;&nbsp;&nbsp; ENDCASE.

&nbsp;&nbsp;&nbsp;&nbsp; MODIFY i_fieldcatalog FROM l_fieldcatalog.
&nbsp;&nbsp; ENDLOOP.
\*\* The fieldcatalog is provided in form 'init_tree' using method
\*\* set_table_for_first_display.
&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " build_fieldcatalog
\**&--------------------------------------------------------------------\-
\*
\**&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; create_hierarchy
\**&--------------------------------------------------------------------\-
\*\* Create hierarchycal display report with auder, CR PI and message
\*\* status details for each order
\**---------------------------------------------------------------------\-
&nbsp;FORM create_hierarchy.

&nbsp;&nbsp; DATA: i_report_t TYPE struct_temp OCCURS 0,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_top_key TYPE lvc_nkey.

\* add data to tree
&nbsp;&nbsp; DATA: l_carrid_key TYPE lvc_nkey,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_connid_key TYPE lvc_nkey,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_last_key TYPE lvc_nkey.

&nbsp;&nbsp; DATA: l_month_key TYPE lvc_nkey,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_node_image TYPE tv_image.
\* node-layout
&nbsp;&nbsp; DATA: l_node_text TYPE lvc_value,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_month_text(15) TYPE c,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_carrier_image TYPE tv_image.
&nbsp;&nbsp; DATA: l_count(4) TYPE c,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_itemno(4) TYPE c.

\* Replace string for planetype by icon
\*&nbsp; perform insert_icons tables i_report_t.

&nbsp;&nbsp; CLEAR i_afko.
&nbsp;&nbsp; CLEAR i_lookup.
&nbsp;&nbsp; l_count = 0.
&nbsp;&nbsp; l_itemno = 0.
&nbsp;&nbsp; IF NOT i_afko\[\] IS INITIAL.

&nbsp;&nbsp;&nbsp;&nbsp; SORT i_afko BY aufnr.
\*Loop at Order data and get CR,PI and messages for the process order and
\*display the detail status report.
&nbsp;&nbsp;&nbsp;&nbsp; LOOP AT i_afko.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_report.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR l_count.
\*Check for the mat type, Resource & Control Recipe Dest
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM check_mattype_resourc_crdest.
\*If either of these are not valid ignore that record.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF v_check IS INITIAL.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM populate_order_data USING i_afko.
\*Remove leading zeros form order no
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; input&nbsp; = i_afko-aufnr
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output = l_node_text.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CONCATENATE l_node_text c_dash i_report-material c_dash
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_report-description INTO l_node_text
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SEPARATED BY space.
\*Checkbox check is done for checkbox display at the item & node
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR l_layout_node.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_layout_node-exp_image = c_3p.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_layout_node-n_image = c_3p.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR l_month_key.
\*Add first node with order status information
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM add_a_node USING i_report l_month_key l_node_text
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; space l_carrier_image
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING l_connid_key.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_month_key = l_connid_key.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR v_checkbox_check.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR l_layout_node.
\*Prepare lookup table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_itemno = l_itemno + 1.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM prepare_lookup_table USING l_itemno c_ord i_afko-aufnr.

\*Get Cpntrol Recipe data for the order and display the required data in
\*the status report
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM get_cr_data.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF i_crheader\[\] IS INITIAL.
\*Make child folder for Control Recipes if no CR found for the order
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM display_folder USING i_report
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_month_key
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; text-036
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; space
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING l_connid_key.
\*Prepare lookup table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_itemno = l_itemno + 1.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM prepare_lookup_table USING l_itemno c_cr space.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSE.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_report.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_report-summ = v_exe.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR v_exe.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DESCRIBE TABLE i_crheader LINES l_count.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_report-count = l_count.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_node_text = text-036.
\*Make child node for displaying Control Recipes for the order
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM add_a_node USING i_report l_month_key l_node_text
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; space l_carrier_image
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING l_connid_key.

\*Prepare lookup table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_itemno = l_itemno + 1.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM prepare_lookup_table USING l_itemno c_cr space.
\*Loop at the Control recipe found for the order and display in the
\*status report
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOOP AT i_crheader.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM populate_cr_data.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_node_text = i_crheader-crid.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_checkbox_check = c_x.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_layout_node-n_image = c_39. "Icon Generate
\*Display Control Recipe items for the order
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM add_a_node USING&nbsp; i_report l_connid_key l_node_text
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; space l_carrier_image
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING l_last_key.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR v_checkbox_check.
\*Prepare lookup table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_itemno = l_itemno + 1.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_lookup-pitype = i_crheader-cotyp.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM prepare_lookup_table USING l_itemno c_cr
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_crheader-crid.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDLOOP.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR l_layout_node.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

\*Get PI Sheet data for the order and display the required data in the
\*status report.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM get_pi_sheet_data.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF i_sheet_header\[\] IS INITIAL.
\*Make child folder for PI Sheets if no data found for the order
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM display_folder USING i_report
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_month_key
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; text-037
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; space
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING l_connid_key.
\*Prepare lookup table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_itemno = l_itemno + 1.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM prepare_lookup_table USING l_itemno c_pi space.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_report.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_report-summ = v_exe.&nbsp; "c_bz.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DESCRIBE TABLE i_sheet_header LINES l_count.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_report-count = l_count.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_node_text = text-037.
\*Make child node for displaying PI Sheets for the order
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM add_a_node USING i_report l_month_key l_node_text
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; space l_carrier_image
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING l_connid_key.

\*Prepare lookup table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_itemno = l_itemno + 1.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM prepare_lookup_table USING l_itemno c_pi space.

\*Loop at the PI Sheet found for the order and prepare status report
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOOP AT i_sheet_header.
\*Get status of the PI Sheet
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM get_pi_status.
\*Populate i_Report with PI Sheet data
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM populate_pi_data.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_node_text = i_sheet_header-crid.
\*Display PI Sheet items for the order
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_node_image = c_x.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_layout_node-n_image = c_j4. "Icon HTM
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM add_a_node USING&nbsp; i_report l_connid_key l_node_text
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_node_image l_carrier_image
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING l_last_key.

\*Prepare lookup table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_itemno = l_itemno + 1.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM prepare_lookup_table USING l_itemno c_pi
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_sheet_header-crid.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDLOOP.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR l_layout_node.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

\*Get Messages for the order and display the required mesage info in the
\*status report.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM get_message_data.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF i_comh\[\] IS INITIAL.
\*Make child folder for PI Sheets if no data found for the order
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM display_folder USING i_report
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_month_key
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; text-038
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; space
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING l_connid_key.

\*Prepare lookup table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_itemno = l_itemno + 1.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM prepare_lookup_table USING l_itemno c_mesg space.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSE.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_report.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_report-summ = v_exe.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR v_exe.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DESCRIBE TABLE i_comh LINES l_count.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_report-count = l_count.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_node_text = text-038.
\*Make child folder for Message if no data found
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM add_a_node USING i_report l_month_key l_node_text
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; space l_carrier_image
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING l_connid_key.

\*Prepare lookup table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_itemno = l_itemno + 1.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM prepare_lookup_table USING l_itemno c_mesg space.

\*Loop at message table for the order and prepare status report
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOOP AT i_comh.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM populate_mesg_data.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_node_text = i_comh-msid.
\*Display Message item details for the order
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_node_image = c_x.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_layout_node-n_image = c_kb. "Icon Transfer
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM add_a_node USING&nbsp; i_report l_connid_key l_node_text
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_node_image l_carrier_image
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING l_last_key.

\*Prepare lookup table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_itemno = l_itemno + 1.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM prepare_lookup_table USING l_itemno c_mesg
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_comh-msid.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDLOOP.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; ENDLOOP.
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR l_layout_node.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " create_hierarchy

\**&--------------------------------------------------------------------\-
\*
\**&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; build_hierarchy_header
\**&--------------------------------------------------------------------\-
\**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; build hierarchy-header-information
\**---------------------------------------------------------------------\-
\**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \--%GTP_L_HIERARCHY_HEADER&nbsp; strucxture for hierarchy-header
\**---------------------------------------------------------------------\-

&nbsp;FORM build_hierarchy_header CHANGING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p_hierarchy_header TYPE treev_hhdr.

&nbsp;&nbsp; p_hierarchy_header-heading = text-039.
&nbsp;&nbsp; p_hierarchy_header-tooltip = text-040.
&nbsp;&nbsp; p_hierarchy_header-width = 42.
&nbsp;&nbsp; p_hierarchy_header-width_pix = c_x.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " build_hierarchy_header
\**&--------------------------------------------------------------------\-
\*
\**&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; register_events.
\**&--------------------------------------------------------------------\-
\*\* Registers events
\**---------------------------------------------------------------------\-
&nbsp;FORM register_events.
\* Event registration: tell ALV Tree which events shall be passed
\* from frontend to backend.
&nbsp;&nbsp; DATA: lt_events TYPE cntl_simple_events,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_event TYPE cntl_simple_event.
&nbsp;&nbsp; DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.

\* The following four tree events registers ALV Tree in the constructor
\* method itself.
\*&nbsp;&nbsp;&nbsp; - cl_gui_column_tree=%GTeventid_expand_no_children
\* (needed to load data to frontend when a user expands a node)
\*&nbsp;&nbsp;&nbsp; - cl_gui_column_tree=%GTeventid_header_context_men_req
\* (needed for header context menu)
\*&nbsp;&nbsp;&nbsp; - cl_gui_column_tree=%GTeventid_header_click
\* (allows selection of columns (only when item selection activated))
\*&nbsp;&nbsp; - cl_gui_column_tree=%GTeventid_item_keypress
\* (needed for F1-Help (only when item selection activated))
\*
\* Nevertheless you have to provide their IDs again if you register
\* additional events with SET_REGISTERED_EVENTS (see below).
\* To do so, call first method&nbsp; GET_REGISTERED_EVENTS (this way,
\* all already registered events remain registered, even your own):
&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTget_registered_events
&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; events = lt_events.

\* (If you do not these events will be deregistered\!\!\!).
\* You do not have to register events of the toolbar again.

\* define the events which will be passed to the backend
\* node double click
&nbsp;&nbsp; l_event-eventid = cl_gui_column_tree=%GTeventid_node_double_click.
&nbsp;&nbsp; l_event-appl_event = c_x. " process PAI if event occurs
&nbsp;&nbsp; APPEND l_event TO lt_events.

\*item double click
&nbsp;&nbsp; l_event-eventid = cl_gui_column_tree=%GTeventid_item_double_click.
&nbsp;&nbsp; l_event-appl_event = c_x.
&nbsp;&nbsp; APPEND l_event TO lt_events.

\**expand no children
\*&nbsp; l_event-eventid = CL_GUI_COLUMN_TREE=%GTEVENTID_EXPAND_NO_CHILDREN.
\*&nbsp; l_event-appl_event = 'X'.
\*&nbsp; append l_event to lt_events.
\*
\**link click
\*&nbsp; l_event-eventid = CL_GUI_COLUMN_TREE=%GTEVENTID_LINK_CLICK.
\*&nbsp; l_event-appl_event = 'X'.
\*&nbsp; append l_event to lt_events.
\*
\*\* button click
\*&nbsp; l_event-eventid = CL_GUI_COLUMN_TREE=%GTEVENTID_button_click.
\*&nbsp; l_event-appl_event = 'X'.
\*&nbsp; append l_event to lt_events.

\*checkbox change
&nbsp;&nbsp; l_event-appl_event = c_x.
&nbsp;&nbsp; l_event-eventid = cl_gui_column_tree=%GTeventid_checkbox_change.
&nbsp;&nbsp; APPEND l_event TO lt_events.

\* register events on frontend
&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTset_registered_events
&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; events&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = lt_events
&nbsp;&nbsp;&nbsp;&nbsp; EXCEPTIONS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cntl_error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cntl_system_error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; illegal_event_combination = 3.
&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE x208(00) WITH text-058.&nbsp; "'ERROR'.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "#EC NOTEXT
&nbsp;&nbsp; ENDIF.

\* set Handler
&nbsp;&nbsp; CREATE OBJECT l_event_receiver.
&nbsp;&nbsp; SET HANDLER l_event_receiver-%GThandle_node_double_click
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FOR v_alv_tree.
&nbsp;&nbsp; SET HANDLER l_event_receiver-%GThandle_item_double_click
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FOR v_alv_tree.
&nbsp;&nbsp; SET HANDLER l_event_receiver-%GThandle_checkbox_change
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FOR v_alv_tree.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " register_events
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; GET_ORDER_DATA
\*&---------------------------------------------------------------------\*
\* Select order related data from table AUFK and AFKO based on the
\* selection parameter/
\*----------------------------------------------------------------------\*
&nbsp;FORM get_order_data .
&nbsp;&nbsp; REFRESH i_afko.
\*Retreieve Data from AFKO and AUFK
&nbsp;&nbsp; SELECT a~aufnr
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b~auart
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a~aufpl
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a~aplzt
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b~werks
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a~rsnum
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b~objnr
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b~erdat
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b~aedat
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b~erfzeit
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a~plnbez
&nbsp;&nbsp; INTO CORRESPONDING FIELDS OF TABLE i_afko
&nbsp;&nbsp; FROM afko AS a INNER JOIN aufk AS b
&nbsp;&nbsp;&nbsp;&nbsp; ON a~aufnr = b~aufnr
&nbsp;&nbsp; WHERE b~werks IN s_werks
&nbsp;&nbsp;&nbsp; AND b~auart IN s_auart
&nbsp;&nbsp;&nbsp; AND a~aufnr IN s_aufnr "process order
&nbsp;&nbsp;&nbsp; AND a~fevor IN s_fevor
&nbsp;&nbsp;&nbsp; AND a~plnbez IN s_plnbez
&nbsp;&nbsp;&nbsp; AND a~gstrp IN s_gstrp
&nbsp;&nbsp;&nbsp; AND a~gltrp IN s_gltrp.

&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
\*&nbsp; Issue error message and stop processing
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE i000 WITH text-061.&nbsp;&nbsp;&nbsp; "'No data selected'.
&nbsp;&nbsp;&nbsp;&nbsp; LEAVE LIST-PROCESSING.
&nbsp;&nbsp; ELSE.
\*&nbsp;&nbsp; Sort the table I_afko
&nbsp;&nbsp;&nbsp;&nbsp; SORT i_afko BY plnbez.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " GET_ORDER_DATA

\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; validate_plant
\*&---------------------------------------------------------------------\*
\*Validate Plant
\*----------------------------------------------------------------------\*
&nbsp;FORM validate_plant .

&nbsp;&nbsp; IF NOT s_werks\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; SELECT werks&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " Plant
&nbsp;&nbsp;&nbsp;&nbsp; INTO TABLE i_werks
&nbsp;&nbsp;&nbsp;&nbsp; FROM t001w
&nbsp;&nbsp;&nbsp;&nbsp; WHERE werks IN s_werks.
&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
\*Issue error message and stop processing
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE e000 WITH text-041.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " validate_plant
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; validate_order_type
\*&---------------------------------------------------------------------\*
\* Validation of Ordre Type
\*----------------------------------------------------------------------\*
&nbsp;FORM validate_order_type .

&nbsp;&nbsp; IF NOT s_auart\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; SELECT auart&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " Order Type
&nbsp;&nbsp;&nbsp;&nbsp; INTO t003o-auart
&nbsp;&nbsp;&nbsp;&nbsp; UP TO 1 ROWS
&nbsp;&nbsp;&nbsp;&nbsp; FROM t003o
&nbsp;&nbsp;&nbsp;&nbsp; WHERE auart IN s_auart.
&nbsp;&nbsp;&nbsp;&nbsp; ENDSELECT.
&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
\*Issue error message and stop processing
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE e000 WITH text-042.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " validate_order_type
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; validate_order
\*&---------------------------------------------------------------------\*
\* Validation of Process Order
\*----------------------------------------------------------------------\*
&nbsp;FORM validate_order .

&nbsp;&nbsp; IF NOT s_aufnr IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; SELECT SINGLE * FROM aufk
&nbsp;&nbsp;&nbsp;&nbsp; WHERE aufnr IN s_aufnr.

&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE e000 WITH text-043.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " validate_order
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; validate_Prod_scheduler
\*&---------------------------------------------------------------------\*
\* Validation of Production Scheduller
\*----------------------------------------------------------------------\*
&nbsp;FORM validate_prod_scheduler .

&nbsp;&nbsp; IF NOT s_fevor\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; SELECT fevor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " Production Scheduler
&nbsp;&nbsp;&nbsp;&nbsp; INTO t024f-fevor
&nbsp;&nbsp;&nbsp;&nbsp; UP TO 1 ROWS
&nbsp;&nbsp;&nbsp;&nbsp; FROM t024f
&nbsp;&nbsp;&nbsp;&nbsp; WHERE fevor IN s_fevor.
&nbsp;&nbsp;&nbsp;&nbsp; ENDSELECT.
&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
\*Issue error message and stop processing
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE e000 WITH text-044.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " validate_Prod_scheduler
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; validate_material
\*&---------------------------------------------------------------------\*
\* Validation of Material entered
\*----------------------------------------------------------------------\*
&nbsp;FORM validate_material .

&nbsp;&nbsp; IF NOT s_plnbez IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; SELECT SINGLE * FROM mara
&nbsp;&nbsp;&nbsp;&nbsp; WHERE matnr IN s_plnbez.

&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE e000 WITH text-045.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " validate_material
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; validate_material_type
\*&---------------------------------------------------------------------\*
\*Validation of material type entered in the selection screen
\*----------------------------------------------------------------------\*
&nbsp;FORM validate_material_type .

&nbsp;&nbsp; IF NOT s_mtart\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; SELECT mtart&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " Material Type
&nbsp;&nbsp;&nbsp;&nbsp; INTO t134-mtart
&nbsp;&nbsp;&nbsp;&nbsp; UP TO 1 ROWS
&nbsp;&nbsp;&nbsp;&nbsp; FROM t134
&nbsp;&nbsp;&nbsp;&nbsp; WHERE mtart IN s_mtart.
&nbsp;&nbsp;&nbsp;&nbsp; ENDSELECT.
&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
\*Issue error message and stop processing
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE e000 WITH text-046.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " validate_material_type
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; validate_Resource
\*&---------------------------------------------------------------------\*
\*&nbsp; Validation of Resource
\*----------------------------------------------------------------------\*
&nbsp;FORM validate_resource .

&nbsp;&nbsp; IF NOT s_ress IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; SELECT SINGLE * FROM crhd
&nbsp;&nbsp;&nbsp;&nbsp; INTO crhd
&nbsp;&nbsp;&nbsp;&nbsp; WHERE arbpl IN s_ress.

&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE e000 WITH text-047.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " validate_Resource
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; validate_Cntrl_Recp_Dest
\*&---------------------------------------------------------------------\*
\* Validation of control recipe destination
\*----------------------------------------------------------------------\*
&nbsp;FORM validate_cntrl_recp_dest .

&nbsp;&nbsp; IF NOT s_phseq\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; SELECT phseq&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " Control Receipe Dest.
&nbsp;&nbsp;&nbsp;&nbsp; INTO tc52-phseq
&nbsp;&nbsp;&nbsp;&nbsp; UP TO 1 ROWS
&nbsp;&nbsp;&nbsp;&nbsp; FROM tc52
&nbsp;&nbsp;&nbsp;&nbsp; WHERE phseq IN s_phseq.
&nbsp;&nbsp;&nbsp;&nbsp; ENDSELECT.
&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
\*Issue error message and stop processing
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE e000 WITH text-048.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " validate_Cntrl_Recp_Dest
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; add_a_node
\*&---------------------------------------------------------------------\*
\* Add node
\*----------------------------------------------------------------------\*
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \--%GTP_i_report&nbsp; text
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \--%GTP_L_MONTH_KEY&nbsp; text
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \--%GTP_L_NODE_TEXT&nbsp; text
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \--%GTP_SPACE&nbsp; text
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \--%GTP_L_CARRIER_IMAGE&nbsp; text
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %LT--P_L_CONNID_KEY&nbsp; text
\*----------------------------------------------------------------------\*
&nbsp;FORM add_a_node USING&nbsp; p_report TYPE struct_temp
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p_relat_key TYPE lvc_nkey
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p_node_text TYPE lvc_value
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p_node_image TYPE tv_image
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p_item_image TYPE tv_image
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING p_new_key.

&nbsp;&nbsp; DATA: l_node_text TYPE lvc_value.

\* set item-layout
&nbsp;&nbsp; DATA: l_item_layout TYPE lvc_t_layi,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_item_layout_s TYPE lvc_s_layi.

&nbsp;&nbsp; l_item_layout_s-fieldname = v_alv_tree-%GTc_hierarchy_column_name.

&nbsp;&nbsp; IF v_checkbox_check = c_x.
&nbsp;&nbsp;&nbsp;&nbsp; l_item_layout_s-fieldname = c_box.
&nbsp;&nbsp;&nbsp;&nbsp; l_item_layout_s-class&nbsp;&nbsp; = cl_gui_column_tree=%GTitem_class_checkbox
.
&nbsp;&nbsp;&nbsp;&nbsp; l_item_layout_s-editable = c_x.
&nbsp;&nbsp;&nbsp;&nbsp; l_item_layout_s-togg_right = c_x.
&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp; l_item_layout_s-fieldname = c_box.
&nbsp;&nbsp;&nbsp;&nbsp; l_item_layout_s-hidden = c_x.
&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; l_item_layout_s-t_image = p_node_image.
&nbsp;&nbsp; APPEND l_item_layout_s TO l_item_layout.

&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTadd_node
&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_relat_node_key = p_relat_key
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_relationship&nbsp;&nbsp; = cl_gui_column_tree=%GTrelat_last_child
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_node_text&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = p_node_text
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is_outtab_line&nbsp;&nbsp; = p_report
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is_node_layout&nbsp;&nbsp; = l_layout_node
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; it_item_layout&nbsp;&nbsp; = l_item_layout
&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e_new_node_key&nbsp;&nbsp; = p_new_key.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " add_a_node
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; GET_ITEM_AND_NODE_SELECT
\*&---------------------------------------------------------------------\*
\* Get the Item/node selected in the hierarchy status report
\*----------------------------------------------------------------------\*
&nbsp;FORM get_item_and_node_select .

&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTget_selected_item
&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e_selected_node = v_item_name
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e_fieldname&nbsp;&nbsp;&nbsp;&nbsp; = v_node_key1.

&nbsp;&nbsp; IF NOT v_item_name IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; i_node_key = v_item_name.
&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTget_selected_nodes
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ct_selected_nodes = v_node_key.
&nbsp;&nbsp;&nbsp;&nbsp; LOOP AT v_node_key INTO i_node_key.

&nbsp;&nbsp;&nbsp;&nbsp; ENDLOOP.
&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; IF NOT i_node_key IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; v_key = i_node_key+7(4).
&nbsp;&nbsp;&nbsp;&nbsp; IF v_key+0(1) = space.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_key = i_node_key+8(4).
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " GET_ITEM_AND_NODE_SELECT
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; POPULATE_ORDER_DATA
\*&---------------------------------------------------------------------\*
\*Populate Ordre data to the I_report table for display
\*----------------------------------------------------------------------\*
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \--%GTP_I_AFKO&nbsp; text
\*----------------------------------------------------------------------\*
&nbsp;FORM populate_order_data&nbsp; USING&nbsp;&nbsp;&nbsp; p_i_afko.

&nbsp;&nbsp; CLEAR makt-maktx.
&nbsp;&nbsp; SELECT SINGLE maktx FROM makt
&nbsp;&nbsp; INTO makt-maktx
&nbsp;&nbsp; WHERE
&nbsp;&nbsp; matnr = i_afko-plnbez AND
&nbsp;&nbsp; spras = sy-langu.

&nbsp;&nbsp; i_report-material = i_afko-plnbez.
&nbsp;&nbsp; i_report-description = makt-maktx.
&nbsp;&nbsp; CONCATENATE i_afko-erdat+6(2) c_dot
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_afko-erdat+4(2) c_dot
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_afko-erdat+0(4) INTO i_report-creationdate.
&nbsp;&nbsp; CONCATENATE i_afko-erfzeit+0(2) c_dot
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_afko-erfzeit+2(2) c_dot
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_afko-erfzeit+4(2) INTO i_report-creationtime.

&nbsp;&nbsp; CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; input&nbsp; = i_report-material
&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output = i_report-material.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " POPULATE_ORDER_DATA
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; POPULATE_CR_DATA
\*&---------------------------------------------------------------------\*
\* Populate Control Recipe data to the I_report table for display
\*----------------------------------------------------------------------\*
&nbsp;FORM populate_cr_data .

&nbsp;&nbsp; CLEAR tcb04t-crstktx.
&nbsp;&nbsp; SELECT SINGLE crstktx FROM tcb04t
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INTO tcb04t-crstktx
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; crstat = i_crheader-crstat AND
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; spras = sy-langu.

&nbsp;&nbsp; CLEAR i_report.
&nbsp;&nbsp; i_report-type = i_crheader-phseq.
&nbsp;&nbsp; IF tcb04t-crstktx = c_terminated OR tcb04t-crstktx = c_discarded.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-exe = c_0a.
&nbsp;&nbsp; ELSEIF tcb04t-crstktx = c_processed.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-exe = c_08.
&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-exe = c_09.
&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; i_report-err = c_5f.
&nbsp;&nbsp; i_report-status = tcb04t-crstktx.
&nbsp;&nbsp; i_report-destination = i_crheader-adres.
&nbsp;&nbsp; CONCATENATE i_crheader-andat+6(2) c_dot i_crheader-andat+4(2) c_dot
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_crheader-andat+0(4) INTO i_report-creationdate.
&nbsp;&nbsp; CONCATENATE i_crheader-anuzt+0(2) c_dot i_crheader-anuzt+2(2) c_dot
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_crheader-anuzt+4(2) INTO i_report-creationtime.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " POPULATE_CR_DATA
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; POPULATE_PI_DATA
\*&---------------------------------------------------------------------\*
\*Populate PI Sheet data to the I_report table for display
\*----------------------------------------------------------------------\*
&nbsp;FORM populate_pi_data .

&nbsp;&nbsp; CLEAR i_report.
&nbsp;&nbsp; i_report-type = i_sheet_header-phseq.
&nbsp;&nbsp; IF v_state = c_five.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-exe = c_08.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-status = c_completed.
&nbsp;&nbsp; ELSEIF v_state = c_two.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-exe = c_09.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-status = c_inprocess.
&nbsp;&nbsp; ELSEIF v_state = c_three.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-exe = c_09.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-status = c_new1.
&nbsp;&nbsp; ELSEIF v_state = c_eight.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-exe = c_09.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-status = c_tobecompleted.
&nbsp;&nbsp; ELSEIF v_state = c_four OR v_state = c_seven.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-exe = c_0a.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-status = c_cancelled.
&nbsp;&nbsp; ELSEIF v_state = c_six.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-exe = c_0a.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-status = c_discarded.
&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; CLEAR v_state.
&nbsp;&nbsp; i_report-err = c_5f.
&nbsp;&nbsp; i_report-destination = i_sheet_header-adres.
&nbsp; CONCATENATE i_sheet_header-andat+6(2) c_dot i_sheet_header-andat+4(2)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c_dot i_sheet_header-andat+0(4) INTO i_report-creationdate.
&nbsp;&nbsp; CONCATENATE i_crheader-anuzt+0(2) c_dot i_crheader-anuzt+2(2) c_dot
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_crheader-anuzt+4(2) INTO i_report-creationtime.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " POPULATE_PI_DATA
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; POPULATE_MESG_DATA
\*&---------------------------------------------------------------------\*
\* Populate Process Message data to the I_report table for display
\*----------------------------------------------------------------------\*
&nbsp;FORM populate_mesg_data .

&nbsp;&nbsp; CLEAR i_report.
&nbsp;&nbsp; i_report-type = i_comh-mscla.
&nbsp;&nbsp; IF i_comh-errkz = c_n.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-exe = c_08.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-status = c_sent.
&nbsp;&nbsp; ELSEIF i_comh-errkz = c_t OR i_comh-errkz = space.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-exe = c_09.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-status = c_tobesent.
&nbsp;&nbsp; ELSEIF i_comh-errkz = c_w.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-exe = c_08.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-status = c_sentwithwarning.
&nbsp;&nbsp; ELSE."IF i_comh-errkz = c_E.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-exe = c_0a.
&nbsp;&nbsp;&nbsp;&nbsp; i_report-status = c_terminated.
&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; i_report-destination = i_comh-source.
&nbsp;&nbsp; CONCATENATE i_comh-sedat+6(2) c_dot i_comh-sedat+4(2)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c_dot i_comh-sedat+0(4) INTO i_report-creationdate.
&nbsp;&nbsp; CONCATENATE i_comh-seuzt+0(2) c_dot i_comh-seuzt+2(2)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c_dot i_comh-seuzt+4(2) INTO i_report-creationtime.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " POPULATE_MESG_DATA
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; GET_CR_DATA
\*&---------------------------------------------------------------------\*
\* Get all Control Recipe data for the Process Order
\*----------------------------------------------------------------------\*
&nbsp;FORM get_cr_data .

&nbsp;&nbsp; CALL FUNCTION 'COCB_CONTROL_RECIPE_GET_LIST'
&nbsp; EXPORTING
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PLANT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CONTROL_RECIPE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp; process_order&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = i_afko-aufnr
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ADDRESS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = ' '
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DESTINATION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEST_TYPE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TEST_CNTL_REC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 'X'
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PROD_CNTL_REC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 'X'
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; STATUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DATE_FROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DATE_TO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = SY-DATLO
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TIME_FROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MATERIAL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BATCH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INSPECTION_LOT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SCHED_DATE_FROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SCHED_DATE_TO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MAX_NO_OF_ENTRIES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NO_AUTHORITY_CHECK_REQ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = ' '
\*&nbsp;&nbsp;&nbsp; IMPORTING
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NO_OF_SELECTED_ENTRIES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp; TABLES
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cr_header&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = i_crheader
&nbsp;&nbsp;&nbsp; EXCEPTIONS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; no_control_recipe_found&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; no_authority&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; internal_failure&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 3
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OTHERS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 4
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .
&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
\* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
\*Message e000 with text-062 i_afko-aufnr.
&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; IF NOT s_phseq\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_crheader WHERE NOT phseq IN s_phseq.
&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; CLEAR i_crheader.

&nbsp;&nbsp; IF NOT c_create IS INITIAL OR NOT c_sentcr IS INITIAL OR
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NOT c_proces IS INITIAL OR NOT c_termin IS INITIAL OR
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NOT c_disccr IS INITIAL.

&nbsp;&nbsp;&nbsp;&nbsp; IF c_create IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_crheader WHERE crstat = c_one.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp;&nbsp;&nbsp; IF c_sentcr IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_crheader WHERE crstat = c_three.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; IF c_proces IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_crheader WHERE crstat = c_five.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; IF c_termin IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_crheader WHERE crstat = c_four.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; IF c_disccr IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_crheader WHERE crstat = c_seven.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; LOOP AT i_crheader.
&nbsp;&nbsp;&nbsp;&nbsp; IF i_crheader-crstat EQ c_five OR i_crheader-crstat EQ c_seven
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OR i_crheader-crstat EQ c_four.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_exe = c_5b.
&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_exe = c_5d.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXIT.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDLOOP.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " GET_CR_DATA
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; GET_PI_SHEET_DATA
\*&---------------------------------------------------------------------\*
\*Get all PI Sheet data for the Process Order
\*----------------------------------------------------------------------\*
&nbsp;FORM get_pi_sheet_data .

&nbsp;&nbsp; CALL FUNCTION 'PI_SHEET_GET_LIST'
&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; process_order&nbsp;&nbsp;&nbsp;&nbsp; = i_afko-aufnr
&nbsp;&nbsp;&nbsp;&nbsp; TABLES
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pi_sheet_header&nbsp;&nbsp; = i_sheet_header
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return_message&nbsp;&nbsp;&nbsp; = i_return_message
&nbsp;&nbsp;&nbsp;&nbsp; EXCEPTIONS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; no_pi_sheet_found = 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; no_authority&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; internal_failure&nbsp; = 3.

&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
\* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
\*&nbsp;&nbsp; message e000 with text-063 i_afko-aufnr.
&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; CLEAR i_sheet_header.

&nbsp;&nbsp; IF NOT c_new IS INITIAL OR NOT c_inwork IS INITIAL OR
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NOT c_close IS INITIAL OR NOT c_canc IS INITIAL OR
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NOT c_disc IS INITIAL OR NOT c_comp IS INITIAL OR
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NOT c_arch IS INITIAL.

&nbsp;&nbsp;&nbsp;&nbsp; IF c_new IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_sheet_header WHERE crstat = c_three.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; IF c_inwork IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_sheet_header WHERE crstat = c_two.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; IF c_close IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_sheet_header WHERE crstat = c_eight.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; IF c_canc IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_sheet_header WHERE crstat = c_four.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; IF c_disc IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_sheet_header WHERE crstat = c_six.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; IF c_comp IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_sheet_header WHERE crstat = c_five.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
\*&nbsp;&nbsp;&nbsp;&nbsp; IF c_arch IS INITIAL.
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_sheet_header WHERE crstat = '00007'.
\*&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; LOOP AT i_sheet_header.
&nbsp;&nbsp;&nbsp;&nbsp; IF i_sheet_header-crstat EQ c_five OR
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_sheet_header-crstat EQ c_seven OR
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_sheet_header-crstat EQ c_four.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_exe = c_5b.
&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_exe = c_5d.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXIT.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDLOOP.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " GET_PI_SHEET_DATA
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; GET_MESSAGE_DATA
\*&---------------------------------------------------------------------\*
\* Get all Process Messages for the Process Order
\*----------------------------------------------------------------------\*
&nbsp;FORM get_message_data .

&nbsp;&nbsp; SELECT * FROM comh INTO TABLE i_comh
&nbsp;&nbsp; WHERE
&nbsp;&nbsp; werk IN s_werks AND
&nbsp;&nbsp; aufnr = i_afko-aufnr.

&nbsp;&nbsp; IF NOT c_tosend IS INITIAL OR NOT c_sentpm IS INITIAL OR
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NOT c_end IS INITIAL.

&nbsp;&nbsp;&nbsp;&nbsp; IF c_tosend IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_comh WHERE errkz = space OR errkz = c_t.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; IF c_sentpm IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_comh WHERE errkz = c_n.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; IF c_end IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE i_comh WHERE errkz = c_d.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; READ TABLE i_comh WITH KEY errkz = c_d.
&nbsp;&nbsp; IF sy-subrc = 0.
&nbsp;&nbsp;&nbsp;&nbsp; v_exe = c_5c.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "['<at:var at:name="0A" />'|mailto:'<at:var at:name="0A" />'].
&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp; READ TABLE i_comh WITH KEY errkz = space.
&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc = 0.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_exe = c_5d.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "['<at:var at:name="09" />'|mailto:'<at:var at:name="09" />'].
&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; READ TABLE i_comh WITH KEY errkz = c_t.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc = 0.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_exe = c_5d.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "['<at:var at:name="09" />'|mailto:'<at:var at:name="09" />'].
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; READ TABLE i_comh WITH KEY errkz = c_e.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc = 0.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_exe = c_5c.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "['<at:var at:name="0A" />'|mailto:'<at:var at:name="0A" />'].
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; READ TABLE i_comh WITH KEY errkz = c_w.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc = 0.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_exe = c_5d.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "['<at:var at:name="0A" />'|mailto:'<at:var at:name="0A" />'].
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_exe = c_5b.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "['<at:var at:name="08" />'|mailto:'<at:var at:name="08" />'].
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " GET_MESSAGE_DATA
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; display_folder
\*&---------------------------------------------------------------------\*
\* Display a folder if there is no data to be inserted under the node
\*----------------------------------------------------------------------\*
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \--%GTP_i_report&nbsp; text
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \--%GTP_L_MONTH_KEY&nbsp; text
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \--%GTP_1606&nbsp;&nbsp; text
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \--%GTP_1607&nbsp;&nbsp; text
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \--%GTP_ELSE&nbsp; text
\*----------------------------------------------------------------------\*
&nbsp;FORM display_folder&nbsp; USING&nbsp;&nbsp;&nbsp; p_report TYPE struct_temp
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p_relat_key TYPE lvc_nkey
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p_node_text TYPE lvc_value
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p_value TYPE c
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING p_new_key.

&nbsp;&nbsp; DATA: l_node_text TYPE lvc_value.
&nbsp;&nbsp; DATA: l_layout_node TYPE lvc_s_layn.
\* set item-layout
&nbsp;&nbsp; DATA: l_item_layout TYPE lvc_t_layi,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_item_layout_s TYPE lvc_s_layi.

&nbsp;&nbsp; CLEAR i_report.
&nbsp;&nbsp; i_report-summ = c_bz.
&nbsp;&nbsp; i_report-status = p_value.

&nbsp;&nbsp; l_item_layout_s-fieldname = c_box.
&nbsp;&nbsp; l_item_layout_s-hidden = c_x.
&nbsp;&nbsp; APPEND l_item_layout_s TO l_item_layout.
&nbsp;&nbsp; CLEAR l_item_layout_s.
&nbsp;&nbsp; l_layout_node-isfolder = c_x.&nbsp;&nbsp; "=%GTadd a folder, NOT a leaf

&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTadd_node
&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_relat_node_key = p_relat_key
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_relationship&nbsp;&nbsp; = cl_gui_column_tree=%GTrelat_last_child
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_node_text&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = p_node_text
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is_outtab_line&nbsp;&nbsp; = p_report
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is_node_layout&nbsp;&nbsp; = l_layout_node
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; it_item_layout&nbsp;&nbsp; = l_item_layout
&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e_new_node_key&nbsp;&nbsp; = p_new_key.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " display_folder
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; system_state_check
\*&---------------------------------------------------------------------\*
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; text
\*----------------------------------------------------------------------\*
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %LT--P_S_STATUS&nbsp; text
\*----------------------------------------------------------------------\*
&nbsp;FORM system_state_check
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING p_status TYPE j_txt04. "tj02t-txt04.

&nbsp;&nbsp; DATA: l_status TYPE j_txt04,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "LIKE p_status,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_status_nr TYPE j_status.&nbsp; "LIKE jest-stat.

&nbsp;&nbsp; CHECK NOT p_status IS INITIAL.

&nbsp;&nbsp; CALL FUNCTION 'STATUS_TEXT_CONVERSION'
&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; language&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = sy-langu
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; txt04&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = p_status
&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; status_number&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = l_status_nr
&nbsp;&nbsp;&nbsp;&nbsp; EXCEPTIONS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; insufficient_input = 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not_found&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; object_not_found&nbsp;&nbsp; = 3
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wrong_mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 4
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OTHERS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 5.
&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
\*&nbsp;&nbsp; ok, now we try with upper case
&nbsp;&nbsp;&nbsp;&nbsp; l_status = p_status.
&nbsp;&nbsp;&nbsp;&nbsp; TRANSLATE l_status TO UPPER CASE.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "#EC TRANSLANG

&nbsp;&nbsp;&nbsp;&nbsp; CALL FUNCTION 'STATUS_TEXT_CONVERSION'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; language&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = sy-langu
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; txt04&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = l_status
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; status_number&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = l_status_nr
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXCEPTIONS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; insufficient_input = 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not_found&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; object_not_found&nbsp;&nbsp; = 3
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wrong_mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 4
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OTHERS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 5.

&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc = 0.
\*&nbsp;&nbsp;&nbsp;&nbsp; if uppercase is correct, then we use it from now on
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p_status&nbsp;&nbsp;&nbsp; = l_status.
&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE e000 WITH text-059. "'we expect a correct value here\!'.
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " system_state_check
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; fill_status_tables
\*&---------------------------------------------------------------------\*
\* This subroutine fills the status tables
\*----------------------------------------------------------------------\*
&nbsp;FORM fill_status_tables .

&nbsp;&nbsp; LOOP AT i_status_table.
&nbsp;&nbsp;&nbsp;&nbsp; PERFORM fill_status_table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TABLES i_status_hdr_tab
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; USING&nbsp; i_status_table-status.
&nbsp;&nbsp; ENDLOOP.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " fill_status_tables
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; fill_ranges
\*&---------------------------------------------------------------------\*
\* This subroutines copies the Process order range table
\*----------------------------------------------------------------------\*
&nbsp;FORM fill_ranges .

&nbsp;&nbsp; aufnr_range\[\] = s_aufnr\[\].

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " fill_ranges
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; check_s_selid
\*&---------------------------------------------------------------------\*
\*&nbsp; This subroutine validates the selection id
\*----------------------------------------------------------------------\*
&nbsp;FORM check_s_selid .

&nbsp;&nbsp; DATA:
&nbsp;&nbsp;&nbsp;&nbsp; lts_objnr TYPE typ_ts_aufnr_objnr.

&nbsp;&nbsp; FIELD-SYMBOLS:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %LTtyp_s_objnr%GT TYPE typ_s_objnr.
&nbsp;&nbsp;&nbsp;&nbsp; .
\*&nbsp; CHECK NOT p_selid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IS INITIAL
\*&nbsp; OR&nbsp;&nbsp;&nbsp; NOT status_hdr_tab\[\] IS INITIAL.
&nbsp;&nbsp; CHECK NOT i_status_hdr_tab\[\] IS INITIAL.
\*&nbsp; SELECT aufnr objnr FROM aufk
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INTO CORRESPONDING FIELDS OF TABLE lts_objnr\[\]
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FOR ALL ENTRIES IN aufnr_range\[\]
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE aufnr = aufnr_range-low.

&nbsp;&nbsp; SELECT aufnr objnr FROM aufk
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INTO CORRESPONDING FIELDS OF TABLE lts_objnr\[\]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE aufnr IN aufnr_range\[\]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND autyp = 40. "Only Process orders required for this report

&nbsp;&nbsp; PERFORM reduce_aufnr_objnr_by_status
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TABLES i_status_hdr_tab
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; USING&nbsp; p_selid
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING lts_objnr\[\].

\*Check whether order entered matches with status entered in the
\*selection screen
&nbsp;&nbsp; IF lts_objnr\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE i000 WITH text-049.
&nbsp;&nbsp;&nbsp;&nbsp; LEAVE LIST-PROCESSING.
&nbsp;&nbsp; ENDIF.

\* Auftragsnummern-Range löschen und neu füllen
&nbsp;&nbsp; REFRESH aufnr_range\[\].
&nbsp;&nbsp; aufnr_range-sign&nbsp;&nbsp; = c_i.
&nbsp;&nbsp; aufnr_range-option = c_eq.
&nbsp;&nbsp; CLEAR aufnr_range-low.
&nbsp;&nbsp; CLEAR aufnr_range-high.
&nbsp;&nbsp; LOOP AT lts_objnr\[\] ASSIGNING %LTtyp_s_objnr%GT.
&nbsp;&nbsp;&nbsp;&nbsp; aufnr_range-low =&nbsp; %LTtyp_s_objnr%GT-aufnr.
&nbsp;&nbsp;&nbsp;&nbsp; APPEND aufnr_range.
&nbsp;&nbsp; ENDLOOP.
\* no order found
&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
&nbsp;&nbsp;&nbsp;&nbsp; APPEND aufnr_range.
&nbsp;&nbsp; ENDIF.
\* Speicherbereiche freigeben
&nbsp;&nbsp; FREE: lts_objnr\[\].

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " check_s_selid
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; update_s_aufnr
\*&---------------------------------------------------------------------\*
\*&nbsp; This subroutine updates the Process order range table
\*----------------------------------------------------------------------\*
&nbsp;FORM update_s_aufnr .

&nbsp;&nbsp; CLEAR s_aufnr.
&nbsp;&nbsp; REFRESH s_aufnr.

&nbsp;&nbsp; s_aufnr\[\]&nbsp; = aufnr_range\[\].

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " update_s_aufnr
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; fill_status_table
\*&---------------------------------------------------------------------\*
\*&nbsp; This subroutine populates the status table
\*----------------------------------------------------------------------\*
&nbsp;FORM fill_status_table TABLES p_status_tab STRUCTURE i_status_hdr_tab
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; USING s_status&nbsp; TYPE j_txt04. "LIKE tj02t-txt04.

&nbsp;&nbsp; DATA l_status_tmp TYPE ty_status_tmp.&nbsp;&nbsp; "LIKE status_hdr_tab.
\* append status to imported status table
&nbsp;&nbsp; CLEAR l_status_tmp.
\* Status vom Selektionsbild
&nbsp;&nbsp; IF NOT s_status IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; CALL FUNCTION 'STATUS_TEXT_CONVERSION'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; language&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = sy-langu
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; txt04&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = s_status
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; status_number&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = l_status_tmp-stat
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXCEPTIONS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; insufficient_input = 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not_found&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; object_not_found&nbsp;&nbsp; = 3
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wrong_mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 4
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OTHERS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 5.
&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc EQ 0.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_status_tmp-excl = c_x.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLLECT l_status_tmp INTO p_status_tab.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " fill_status_table
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; ORDER_STATUS_TABLE
\*&---------------------------------------------------------------------\*
\*&nbsp; This subroutine populates the order status table
\*----------------------------------------------------------------------\*
&nbsp;FORM order_status_table .

&nbsp;&nbsp; IF NOT s_status\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; IF s_status-high IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOOP AT s_status.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_status_table-status = s_status-low.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_status_table.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_status_table.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDLOOP.
&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT txt04 FROM tj02t
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INTO TABLE i_status_table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; spras = sy-langu AND
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; txt04 IN s_status.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " ORDER_STATUS_TABLE
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; reduce_aufnr_objnr_by_status
\*&---------------------------------------------------------------------\*
\*&nbsp; This subroutine updates the status
\*----------------------------------------------------------------------\*
&nbsp;FORM reduce_aufnr_objnr_by_status
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TABLES&nbsp;&nbsp; p_status_tab STRUCTURE i_status_hdr_tab
\*&nbsp;&nbsp;&nbsp;&nbsp; USING&nbsp;&nbsp;&nbsp; selid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LIKE p_selid
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING l_cts_objnr&nbsp; TYPE typ_ts_objnr.

\* Statusobjekte
&nbsp;&nbsp; DATA:
&nbsp;&nbsp;&nbsp;&nbsp; l_objnr_tab TYPE STANDARD TABLE OF jsto_pre
&nbsp;&nbsp;&nbsp;&nbsp; INITIAL SIZE 0 WITH HEADER LINE.
&nbsp;&nbsp; "LIKE jsto_pre OCCURS 0 WITH HEADER LINE.

&nbsp;&nbsp; FIELD-SYMBOLS:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %LTtyp_s_objnr%GT TYPE typ_s_objnr.

\*&nbsp; CHECK NOT selid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IS INITIAL
\*&nbsp; OR&nbsp;&nbsp;&nbsp; NOT status_tab\[\] IS INITIAL.
&nbsp;&nbsp; CHECK NOT p_status_tab\[\] IS INITIAL.
\* preread
&nbsp;&nbsp; LOOP AT l_cts_objnr\[\] ASSIGNING %LTtyp_s_objnr%GT.
&nbsp;&nbsp;&nbsp;&nbsp; l_objnr_tab-objnr = %LTtyp_s_objnr%GT-objnr.
&nbsp;&nbsp;&nbsp;&nbsp; APPEND l_objnr_tab.
&nbsp;&nbsp; ENDLOOP.
&nbsp;&nbsp; CALL FUNCTION 'STATUS_PRE_READ'
&nbsp;&nbsp;&nbsp;&nbsp; TABLES
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jsto_pre_tab = l_objnr_tab.

&nbsp;&nbsp; DATA objects_deleted.
&nbsp;&nbsp; PERFORM reduce_objnr_by_status
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TABLES&nbsp;&nbsp; l_objnr_tab
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p_status_tab
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; USING&nbsp;&nbsp;&nbsp; selid
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING objects_deleted.

&nbsp;&nbsp; IF objects_deleted = c_x.
\* Alle Aufträge entfernen, deren OBJNR nicht mehr in der Tabelle
\* OBJNR_TAB enthalten ist.
&nbsp;&nbsp;&nbsp;&nbsp; IF l_objnr_tab\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; REFRESH l_cts_objnr\[\].
&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SORT l_objnr_tab BY objnr.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOOP AT l_cts_objnr\[\] ASSIGNING %LTtyp_s_objnr%GT.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; READ TABLE l_objnr_tab
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WITH KEY objnr = %LTtyp_s_objnr%GT-objnr
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BINARY SEARCH.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE l_cts_objnr\[\].
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDLOOP.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " reduce_aufnr_objnr_by_status
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; reduce_objnr_by_status
\*&---------------------------------------------------------------------\*
\*&nbsp; This subroutine updates the status
\*----------------------------------------------------------------------\*
&nbsp;FORM reduce_objnr_by_status
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TABLES&nbsp;&nbsp; p_objnr_tab&nbsp; STRUCTURE objnr_tab
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p_status_tab STRUCTURE i_status_hdr_tab
\*&nbsp;&nbsp;&nbsp;&nbsp; USING&nbsp;&nbsp;&nbsp; selid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LIKE p_selid
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CHANGING p_objects_deleted.
&nbsp;&nbsp; DATA l_objnr_cnt TYPE sydbcnt.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "LIKE sy-dbcnt.
&nbsp;&nbsp; DATA l_dbcnt TYPE sydbcnt.

&nbsp;&nbsp; CLEAR p_objects_deleted.
&nbsp;&nbsp; CHECK NOT p_objnr_tab\[\]&nbsp; IS INITIAL.
&nbsp;&nbsp; DESCRIBE TABLE p_objnr_tab LINES l_objnr_cnt.
\* Statusprüfung gegen Status in Statustabelle
&nbsp;&nbsp; LOOP AT p_status_tab.
&nbsp;&nbsp;&nbsp;&nbsp; IF p_objnr_tab\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXIT.
&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
\* Alle Objektnummern, bei denen der geforderte Status (nicht) sitzt,
\* werden aus der Tabelle OBJNR_TAB gelöscht.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CALL FUNCTION 'STATUS_CHECK_MULTI'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; status&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = p_status_tab-stat
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flg_exclude = p_status_tab-excl
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TABLES
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OBJECTS&nbsp;&nbsp;&nbsp;&nbsp; = p_objnr_tab.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDLOOP.
\* Statusprüfung gegen das Selektionsschema
\*&nbsp; IF NOT selid IS INITIAL.
\*&nbsp;&nbsp; LOOP AT objnr_tab.
\*&nbsp;&nbsp;&nbsp;&nbsp; DATA flg_status_ok TYPE c.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Statusprüfung OK
\*&nbsp;&nbsp;&nbsp;&nbsp; CALL FUNCTION 'STATUS_CHECK_BY_SELSCHEM'
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; objnr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = objnr_tab-objnr
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; selid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = ' '"selid
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fullfill&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = flg_status_ok
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXCEPTIONS
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; no_stat_scheme = 01
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; no_stat_tab&nbsp;&nbsp;&nbsp; = 02.
\*&nbsp;&nbsp;&nbsp;&nbsp; IF&nbsp; sy-subrc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IS INITIAL
\*&nbsp;&nbsp;&nbsp;&nbsp; AND flg_status_ok IS INITIAL.
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE objnr_tab.
\*&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
\*&nbsp;&nbsp; ENDLOOP.
\*&nbsp; ENDIF.

&nbsp;&nbsp; DESCRIBE TABLE p_objnr_tab LINES l_dbcnt. "sy-dbcnt.
&nbsp;&nbsp; IF l_dbcnt %LT%GT l_objnr_cnt.
&nbsp;&nbsp;&nbsp;&nbsp; p_objects_deleted = c_x.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " reduce_objnr_by_status
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; check_mattype_resourc_CRdest
\*&---------------------------------------------------------------------\*
\* Check the material type and Resource destination for the selected
\* order records.
\*----------------------------------------------------------------------\*
&nbsp;FORM check_mattype_resourc_crdest.

&nbsp;&nbsp; CLEAR v_check.

\*Check for material type with the value entered in the selection screen
&nbsp;&nbsp; SELECT SINGLE mtart
&nbsp;&nbsp; FROM mara INTO mara-mtart
&nbsp;&nbsp; WHERE
&nbsp;&nbsp; matnr = i_afko-plnbez.
&nbsp;&nbsp; IF NOT mara-mtart IN s_mtart.
&nbsp;&nbsp;&nbsp;&nbsp; v_check = c_x.
&nbsp;&nbsp; ENDIF.

\*Check for control recipe destination with the selection screen value
&nbsp;&nbsp; IF v_check IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_afvc.
&nbsp;&nbsp;&nbsp;&nbsp; READ TABLE i_afvc WITH KEY aufpl = i_afko-aufpl BINARY SEARCH.
&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc %LT%GT 0. " Reading is not successful
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_check = c_x.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " check_mattype_resourc_CRdest
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; populate_afvc
\*&---------------------------------------------------------------------\*
\*Get Operation within an order data from table AFVC
\*----------------------------------------------------------------------\*
&nbsp;FORM populate_afvc .

&nbsp;&nbsp; SELECT a~aufpl
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a~arbid
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a~phseq
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b~arbpl
&nbsp;&nbsp; INTO TABLE i_afvc
&nbsp;&nbsp; FROM afvc AS a INNER JOIN crhd AS b
&nbsp;&nbsp; ON a~arbid = b~objid
&nbsp;&nbsp; WHERE&nbsp; a~phseq IN s_phseq
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND b~arbpl IN s_ress
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND a~phflg = c_x.
&nbsp;&nbsp; IF sy-subrc = 0.
\*&nbsp;&nbsp;&nbsp;&nbsp; Sort the table I_afvc
&nbsp;&nbsp;&nbsp;&nbsp; SORT i_afvc BY aufpl.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " populate_afvc
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; populate_selected_data_table
\*&---------------------------------------------------------------------\*
\*&nbsp; Populate all tables required for COntrol Recipe Discard/Complete
\*----------------------------------------------------------------------\*
&nbsp;FORM populate_selected_data_table .

&nbsp;&nbsp; v_proc_mess_id_tmp = v_proc_mess_id_tmp + 1.

&nbsp;&nbsp; i_procmessheader-proc_mess_id_tmp = v_proc_mess_id_tmp.
&nbsp;&nbsp; i_procmessheader-plant = i_lookup-plant.
&nbsp;&nbsp; i_procmessheader-proc_mess_category = c_pi_crst.
&nbsp;&nbsp; i_procmessheader-test_flag = space.
&nbsp;&nbsp; i_procmessheader-sender_name = i_lookup-sender.
&nbsp;&nbsp; APPEND i_procmessheader.
&nbsp;&nbsp; CLEAR i_procmessheader.

&nbsp;&nbsp; i_procmesscharac-proc_mess_id_tmp = v_proc_mess_id_tmp.
&nbsp;&nbsp; i_procmesscharac-name_char = c_pppi_process_order.
&nbsp;&nbsp; i_procmesscharac-char_value = i_lookup-order.
&nbsp;&nbsp; i_procmesscharac-data_type = c_char.
&nbsp;&nbsp; APPEND i_procmesscharac.
&nbsp;&nbsp; CLEAR i_procmesscharac.

&nbsp;&nbsp; i_procmesscharac-proc_mess_id_tmp = v_proc_mess_id_tmp.
&nbsp;&nbsp; i_procmesscharac-name_char = c_pppi_control_recipe.
&nbsp;&nbsp; i_procmesscharac-char_value = i_lookup-docno.
&nbsp;&nbsp; i_procmesscharac-data_type = c_char.
&nbsp;&nbsp; APPEND i_procmesscharac.
&nbsp;&nbsp; CLEAR i_procmesscharac.

&nbsp;&nbsp; i_procmesscharac-proc_mess_id_tmp = v_proc_mess_id_tmp.
&nbsp;&nbsp; i_procmesscharac-name_char = c_pppi_control_recipe_status.
&nbsp;&nbsp; IF sy-ucomm = c_complete.
&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-char_value = c_00005.
&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-char_value = c_00007.
&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; i_procmesscharac-data_type = c_char.
&nbsp;&nbsp; APPEND i_procmesscharac.
&nbsp;&nbsp; CLEAR i_procmesscharac.

&nbsp;&nbsp; i_procmesscharac-proc_mess_id_tmp = v_proc_mess_id_tmp.
&nbsp;&nbsp; i_procmesscharac-name_char = c_pppi_event_date.
&nbsp;&nbsp; i_procmesscharac-char_value = sy-datum.
&nbsp;&nbsp; i_procmesscharac-data_type = c_date.
&nbsp;&nbsp; APPEND i_procmesscharac.
&nbsp;&nbsp; CLEAR i_procmesscharac.

&nbsp;&nbsp; i_procmesscharac-proc_mess_id_tmp = v_proc_mess_id_tmp.
&nbsp;&nbsp; i_procmesscharac-name_char = c_pppi_event_time.
&nbsp;&nbsp; i_procmesscharac-char_value = sy-uzeit.
&nbsp;&nbsp; i_procmesscharac-data_type = c_time.
&nbsp;&nbsp; APPEND i_procmesscharac.
&nbsp;&nbsp; CLEAR i_procmesscharac.

\*Processing for the external CRD type

&nbsp;&nbsp; SELECT SINGLE *
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM coch&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "control recipe table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE crid = i_lookup-docno.

&nbsp;&nbsp; IF sy-subrc = 0.

\* Lookup process message categories for CRD using convention Y_ST\_

&nbsp;&nbsp;&nbsp;&nbsp; IF coch-cotyp = c_2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "external CRD type

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_crd+5(2) = coch-phseq.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT SINGLE \*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "existence check
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM tc50&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "proc mess categories table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE werks = coch-werk
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND cstyp = c_ms
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND costr = v_crd.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc = 0.

\*&nbsp;&nbsp; Create process message for external CRD if process message category
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exists

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_proc_mess_id_tmp = v_proc_mess_id_tmp + 1.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmessheader-proc_mess_id_tmp = v_proc_mess_id_tmp.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmessheader-plant = i_lookup-plant.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmessheader-proc_mess_category = v_crd.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmessheader-test_flag = space.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmessheader-sender_name = i_lookup-sender.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_procmessheader.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_procmessheader.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-proc_mess_id_tmp = v_proc_mess_id_tmp.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-name_char = c_pppi_process_order.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-char_value = i_lookup-order.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-data_type = c_char.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_procmesscharac.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_procmesscharac.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-proc_mess_id_tmp = v_proc_mess_id_tmp.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-name_char = c_pppi_control_recipe.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-char_value = i_lookup-docno.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-data_type = c_char.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_procmesscharac.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_procmesscharac.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-proc_mess_id_tmp = v_proc_mess_id_tmp.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-name_char = c_pppi_control_recipe_status.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF sy-ucomm = c_complete.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-char_value = c_00005.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-char_value = c_00007.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-data_type = c_char.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_procmesscharac.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_procmesscharac.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-proc_mess_id_tmp = v_proc_mess_id_tmp.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-name_char = c_pppi_event_date.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-char_value = sy-datum.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-data_type = c_date.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_procmesscharac.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_procmesscharac.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-proc_mess_id_tmp = v_proc_mess_id_tmp.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-name_char = c_pppi_event_time.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-char_value = sy-uzeit.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_procmesscharac-data_type = c_time.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_procmesscharac.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_procmesscharac.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " populate_selected_data_table
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; discard_control_recipe
\*&---------------------------------------------------------------------\*
\* Discard Control recipe and prepare errorlog table
\*----------------------------------------------------------------------\*
&nbsp;FORM discard_control_recipe .

&nbsp;&nbsp; DATA: i_count TYPE lvc_nkey.

&nbsp;&nbsp; CALL FUNCTION 'BAPI_PROCESS_MESSAGE_CREATEMLT'
&nbsp;&nbsp;&nbsp;&nbsp; TABLES
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; procmessheader&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = i_procmessheader
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; procmesscharac&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = i_procmesscharac
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; procmesstextlines&nbsp;&nbsp;&nbsp; = i_procmesstextlines
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; processmessagenew&nbsp;&nbsp;&nbsp; = i_processmessagenew
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; procmessheaderreturn = i_procmessheaderreturn
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; procmesscharacreturn = i_procmesscharacreturn
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = i_return.

\*Building eror log table
&nbsp;&nbsp; LOOP AT i_procmessheaderreturn WHERE return_code %LT%GT 00.
&nbsp;&nbsp;&nbsp;&nbsp; IF i_procmessheaderreturn-return_code = 99.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOOP AT i_procmesscharacreturn WHERE
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proc_mess_id_tmp = i_procmessheaderreturn-proc_mess_id_tmp
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND return_code %LT%GT 00.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; READ TABLE i_procmesscharac WITH KEY
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proc_mess_id_tmp = i_procmesscharacreturn-proc_mess_id_tmp
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name_char = c_pppi_control_recipe.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc = 0.
\*Build table for where Err flag needs to be set
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; READ TABLE i_lookup WITH KEY
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; docno = i_procmesscharac-char_value
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; doctype = c_cr.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc = 0.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_count = i_count + i_lookup-itemno.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_count TO i_nodekey_change.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_count.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
\*Build errorlog table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_errorlog-docno = i_procmesscharac-char_value.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_errorlog-message = i_procmesscharacreturn-message.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_errorlog.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_errorlog.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDLOOP.
&nbsp;&nbsp;&nbsp;&nbsp; ELSE.

&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDLOOP.

&nbsp;&nbsp; LOOP AT i_return WHERE type = c_e OR type = c_a.
&nbsp;&nbsp;&nbsp;&nbsp; READ TABLE i_procmesscharac WITH KEY
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name_char = c_pppi_control_recipe.
&nbsp;&nbsp;&nbsp;&nbsp; i_errorlog-docno = i_procmesscharac-char_value.
&nbsp;&nbsp;&nbsp;&nbsp; i_errorlog-message = i_return-message.
&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_errorlog.
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_errorlog.
\*Build table for where Err flag needs to be set
&nbsp;&nbsp;&nbsp;&nbsp; READ TABLE i_lookup WITH KEY
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; docno = i_procmesscharac-char_value
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; doctype = c_cr.
&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc = 0.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_count = i_count + i_lookup-itemno.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_count TO i_nodekey_change.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_count.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDLOOP.

&nbsp;&nbsp; REFRESH i_procmessheader.
&nbsp;&nbsp; REFRESH i_procmesscharac.
&nbsp;&nbsp; REFRESH i_procmesstextlines.
\*&nbsp;&nbsp; REFRESH i_processmessagenew.
&nbsp;&nbsp; REFRESH i_procmessheaderreturn.
&nbsp;&nbsp; REFRESH i_procmesscharacreturn.
&nbsp;&nbsp; REFRESH i_return.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " discard_control_recipe
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; discard_pi_sheet
\*&---------------------------------------------------------------------\*
\*&nbsp; Discard PI sheet and prepare errorlog table
\*----------------------------------------------------------------------\*
&nbsp;FORM discard_pi_sheet .

&nbsp;&nbsp; DATA : l_not_discarded_count TYPE i,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_count TYPE lvc_nkey,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_discarded_count TYPE i.
\*Discard PI sheet
&nbsp;&nbsp; CALL FUNCTION 'PI_SHEET_DISCARD'
&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dialog_flag&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = c_x
&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; discarded_count&nbsp;&nbsp;&nbsp;&nbsp; = l_discarded_count
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not_discarded_count = l_not_discarded_count
&nbsp;&nbsp;&nbsp;&nbsp; TABLES
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cntrl_recipe_id_tab = i_discard_pi.

\*Build errorlog table
&nbsp;&nbsp; IF NOT l_not_discarded_count IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; LOOP AT i_discard_pi.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_errorlog-docno = i_discard_pi-cntl_rec_id.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_errorlog-message = text-065.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "'Unable to discard or cancel PI Sheet'.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_errorlog.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_errorlog.
\*Set Error flag to the Control Recipe
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; READ TABLE i_lookup WITH KEY
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; docno = i_discard_pi-cntl_rec_id
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; doctype = c_cr.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc = 0.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_count = i_count + i_lookup-itemno.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_count TO i_nodekey_change.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_count.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
\*Set Error flag to PI Sheet for the corresponding Control Recipe
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; READ TABLE i_lookup WITH KEY
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; docno = i_discard_pi-cntl_rec_id
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; doctype = c_pi.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc = 0.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_count = i_count + i_lookup-itemno.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_count TO i_nodekey_change.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_count.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; ENDLOOP.
&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; CLEAR: l_discarded_count.
&nbsp;&nbsp; CLEAR:l_not_discarded_count.
&nbsp;&nbsp; REFRESH i_discard_pi.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " discard_pi_sheet
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; BAPI_TRANSACTION_COMMIT
\*&---------------------------------------------------------------------\*
\* BAPI Commit
\*----------------------------------------------------------------------\*
&nbsp;FORM bapi_transaction_commit .

&nbsp;&nbsp; CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
\*&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WAIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = i_return.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " BAPI_TRANSACTION_COMMIT
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; ALL_HEADER_NODE_EXPAND
\*&---------------------------------------------------------------------\*
\* Expand all selected nodes
\*----------------------------------------------------------------------\*
&nbsp;FORM all_header_node_expand .

&nbsp;&nbsp; DATA: l_lvc_nkey TYPE lvc_nkey.
&nbsp;&nbsp; DATA: l_first_node TYPE lvc_nkey.

&nbsp;&nbsp; LOOP AT i_lookup WHERE doctype = c_ord.
&nbsp;&nbsp;&nbsp;&nbsp; l_lvc_nkey = l_lvc_nkey + i_lookup-itemno.
&nbsp;&nbsp;&nbsp;&nbsp; APPEND l_lvc_nkey TO i_lvc_nkey.
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR l_lvc_nkey.
&nbsp;&nbsp; ENDLOOP.

&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTexpand_nodes
&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; it_node_key = i_lvc_nkey.
&nbsp;&nbsp; REFRESH i_lvc_nkey.

&nbsp;&nbsp; l_first_node = l_first_node + 1.
&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTset_top_node
&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_node_key = l_first_node.
&nbsp;&nbsp; CLEAR l_first_node.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " ALL_HEADER_NODE_EXPAND
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; DISPLAY_LOG
\*&---------------------------------------------------------------------\*
\*&nbsp; Prepare and display log table
\*----------------------------------------------------------------------\*
&nbsp;FORM display_log .

&nbsp;&nbsp; DATA: lv_tfill&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TYPE i,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ls_field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TYPE help_value,&nbsp;&nbsp; "LIKE help_value,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lt_fields&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TYPE STANDARD TABLE OF help_value
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INITIAL SIZE 0 WITH HEADER LINE,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lv_index&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TYPE sytabix.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "LIKE sy-tabix.

&nbsp;&nbsp; IF i_errorlog\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; EXIT.
&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; ls_field-tabname&nbsp;&nbsp;&nbsp; =&nbsp; 'COCH'.
&nbsp;&nbsp; ls_field-fieldname&nbsp; =&nbsp; 'CRID'.
&nbsp;&nbsp; ls_field-selectflag =&nbsp; 'X'.
&nbsp;&nbsp; APPEND ls_field TO lt_fields.

&nbsp;&nbsp; ls_field-tabname&nbsp;&nbsp;&nbsp; =&nbsp; 'PMCHECK'.
&nbsp;&nbsp; ls_field-fieldname&nbsp; =&nbsp; 'ERROR_TEXT'.
&nbsp;&nbsp; ls_field-selectflag =&nbsp; 'X'.
&nbsp;&nbsp; APPEND ls_field TO lt_fields.

\*Display ErrorLog table
&nbsp;&nbsp; SORT i_errorlog BY docno.
&nbsp;&nbsp; CALL FUNCTION 'MD_POPUP_SHOW_INTERNAL_TABLE'
&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; title&nbsp;&nbsp; = text-060
&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; index =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lv_index "'The following control recipes could not be updated'
&nbsp;&nbsp;&nbsp;&nbsp; TABLES
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; values&nbsp;&nbsp;&nbsp; = i_errorlog
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; columns&nbsp;&nbsp; = lt_fields
&nbsp;&nbsp;&nbsp;&nbsp; EXCEPTIONS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; leave&nbsp;&nbsp;&nbsp;&nbsp; = 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OTHERS&nbsp;&nbsp;&nbsp; = 2.

&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
\*&nbsp;&nbsp;&nbsp;&nbsp; FREE i_errorlog.
\*&nbsp;&nbsp;&nbsp;&nbsp; EXIT.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " DISPLAY_LOG
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; CALL_TRANSACTION_COR3
\*&---------------------------------------------------------------------\*
\* Set parameter ID and call transaction COR3
\*----------------------------------------------------------------------\*
&nbsp;FORM call_transaction_cor3 .

&nbsp;&nbsp; READ TABLE i_lookup WITH KEY itemno = v_key.
&nbsp;&nbsp; IF sy-subrc = 0 AND i_lookup-doctype = c_ord.
&nbsp;&nbsp;&nbsp;&nbsp; SET PARAMETER ID: c_br1 FIELD i_lookup-docno.
&nbsp;&nbsp;&nbsp;&nbsp; CALL TRANSACTION c_cor3 AND SKIP FIRST SCREEN .
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR v_node_text.
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_node_key.
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR v_key.
&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE i000 WITH text-034.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " CALL_TRANSACTION_COR3
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; CALL_TRANSACTION_COR2
\*&---------------------------------------------------------------------\*
\*&nbsp;&nbsp; Set parameter ID and call transaction COR2
\*----------------------------------------------------------------------\*
&nbsp;FORM call_transaction_cor2 .

&nbsp;&nbsp; READ TABLE i_lookup WITH KEY itemno = v_key.
&nbsp;&nbsp; IF sy-subrc = 0 AND i_lookup-doctype = c_ord.
&nbsp;&nbsp;&nbsp;&nbsp; SET PARAMETER ID: c_br1 FIELD i_lookup-docno.
&nbsp;&nbsp;&nbsp;&nbsp; CALL TRANSACTION c_cor2 AND SKIP FIRST SCREEN .
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR v_node_text.
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_node_key.
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR v_key.

&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE i000 WITH text-034.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " CALL_TRANSACTION_COR2
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; CALL_TRANSACTION_CO53
\*&---------------------------------------------------------------------\*
\* Set parameter ID and call transaction CO53
\*----------------------------------------------------------------------\*
&nbsp;FORM call_transaction_co53 .

&nbsp;&nbsp; DATA : l_flg-no_init TYPE c.

&nbsp;&nbsp; READ TABLE i_lookup WITH KEY itemno = v_key.
&nbsp;&nbsp; IF sy-subrc = 0." AND i_lookup-doctype = c_CR.
&nbsp;&nbsp;&nbsp;&nbsp; l_flg-no_init = c_x.
&nbsp;&nbsp;&nbsp;&nbsp; rco53if-abdat = i_lookup-frdate.
&nbsp;&nbsp;&nbsp;&nbsp; SET PARAMETER ID: 'WRK' FIELD i_lookup-plant.
&nbsp;&nbsp;&nbsp;&nbsp; SET PARAMETER ID: 'ANR' FIELD i_lookup-order.
&nbsp;&nbsp;&nbsp;&nbsp; SET PARAMETER ID: 'ABDAT' FIELD rco53if-abdat.
&nbsp;&nbsp;&nbsp;&nbsp; SET PARAMETER ID 'NO_INIT' FIELD l_flg-no_init.
&nbsp;&nbsp;&nbsp;&nbsp; CALL TRANSACTION c_co53 AND SKIP FIRST SCREEN .
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR rco54if-abdat.
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR l_flg-no_init.
&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE i000 WITH text-033.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " CALL_TRANSACTION_CO53
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; CALL_TRANSACTION_CO54
\*&---------------------------------------------------------------------\*
\* Set parameter ID and call transaction CO54
\*----------------------------------------------------------------------\*
&nbsp;FORM call_transaction_co54 .

&nbsp;&nbsp; DATA : l_flg-no_init TYPE c.

&nbsp;&nbsp; READ TABLE i_lookup WITH KEY itemno = v_key.
&nbsp;&nbsp; IF sy-subrc = 0." AND i_lookup-doctype = c_MESG.
&nbsp;&nbsp;&nbsp;&nbsp; l_flg-no_init = c_x.
&nbsp;&nbsp;&nbsp;&nbsp; rco54if-abdat = i_lookup-frdate.
&nbsp;&nbsp;&nbsp;&nbsp; SET PARAMETER ID: 'WRK' FIELD i_lookup-plant.
&nbsp;&nbsp;&nbsp;&nbsp; SET PARAMETER ID: 'BID' FIELD i_lookup-order.
&nbsp;&nbsp;&nbsp;&nbsp; SET PARAMETER ID: 'ABDAT' FIELD rco54if-abdat.
&nbsp;&nbsp;&nbsp;&nbsp; SET PARAMETER ID 'NO_INIT_SAPLCO51' FIELD l_flg-no_init.
&nbsp;&nbsp;&nbsp;&nbsp; CALL TRANSACTION c_co54 AND SKIP FIRST SCREEN .
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR rco54if-abdat.
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR l_flg-no_init.
&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE i000 WITH text-032.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " CALL_TRANSACTION_CO54
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; COMPLETE_PROECESS
\*&---------------------------------------------------------------------\*
\* Perform CR complete process for the selected CR
\*----------------------------------------------------------------------\*
&nbsp;FORM complete_proecess .

&nbsp;&nbsp; DATA: l_count TYPE lvc_nkey.
\*Free error log
&nbsp;&nbsp; FREE i_errorlog.

&nbsp;&nbsp; IF NOT i_nodekey_change1\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; PERFORM clear_log_err_icon.
&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; CALL METHOD cl_gui_cfw=%GTdispatch.

&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTget_checked_items
&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; et_checked_items = mt_checked_items.

&nbsp;&nbsp; IF NOT mt_checked_items IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; LOOP AT mt_checked_items INTO v_mt_checked_items.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR v_discard_pi.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_key = v_mt_checked_items-nodekey+7(4).
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF v_key+0(1) = space.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_key = v_mt_checked_items-nodekey+8(4).
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; READ TABLE i_lookup WITH KEY itemno = v_key.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc = 0 AND i_lookup-doctype = c_cr.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF i_lookup-pitype = 4.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_discard_pi = v_discard_pi + 1.
\*Prepare errorlog table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_errorlog-docno = i_lookup-docno.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_errorlog-message = text-031.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_errorlog.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_errorlog.
\*prepare error icon display table.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_count = l_count + i_lookup-itemno.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND l_count TO i_nodekey_change.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR l_count.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
\*Check for the status of the Control Recipe
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM status_lookup.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF NOT v_cr_status EQ c_x.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM populate_selected_data_table.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; ENDLOOP.
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR v_proc_mess_id_tmp.
\*&nbsp;&nbsp;&nbsp;&nbsp; IF v_discard_pi IS INITIAL AND NOT i_procmessheader\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; IF NOT i_procmessheader\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM discard_control_recipe.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM bapi_transaction_commit.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp;&nbsp;&nbsp; IF NOT i_nodekey_change\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM modify_nodes.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; IF NOT v_discard_pi IS INITIAL OR v_cr_status EQ c_x.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE i000 WITH text-023 text-024.
&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE i000 WITH text-051.
&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; CLEAR v_discard_pi.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " COMPLETE_PROECESS
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; DISCARD_PROECESS
\*&---------------------------------------------------------------------\*
\* PErform discard process for the order and associated CR which are
\* selected
\*----------------------------------------------------------------------\*
&nbsp;FORM discard_proecess .

&nbsp;&nbsp; DATA: l_count TYPE lvc_nkey.
\*Free error log
&nbsp;&nbsp; FREE i_errorlog.

&nbsp;&nbsp; IF NOT i_nodekey_change1\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; PERFORM clear_log_err_icon.
&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; CALL METHOD cl_gui_cfw=%GTdispatch.

&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTget_checked_items
&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; et_checked_items = mt_checked_items.

&nbsp;&nbsp; IF NOT mt_checked_items IS INITIAL.

&nbsp;&nbsp;&nbsp;&nbsp; LOOP AT mt_checked_items INTO v_mt_checked_items.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR v_discard_pi.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_key = v_mt_checked_items-nodekey+7(4).
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF v_key+0(1) = space.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_key = v_mt_checked_items-nodekey+8(4).
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; READ TABLE i_lookup WITH KEY itemno = v_key.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF sy-subrc = 0 AND i_lookup-doctype = c_cr.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF i_lookup-pitype NE 4.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "PI Type
\**Prepare errorlog table
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_errorlog-docno = i_lookup-docno.
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_errorlog-message = text-031.
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_errorlog.
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_errorlog.
\**prepare error icon display table.
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_count = l_count + i_lookup-itemno.
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND l_count TO i_nodekey_change.
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR l_count.
\*Check for the status of the Control Recipe
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM status_lookup.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF NOT v_cr_status EQ c_x.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM populate_selected_data_table.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF NOT i_procmessheader\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM discard_control_recipe.
\*Check for the function call success
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM bapi_transaction_commit.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF i_lookup-pitype = 4.
\*Check for the status of the Control Recipe
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM status_lookup.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF NOT v_cr_status EQ c_x.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_discard_pi-cntl_rec_id = i_lookup-docno.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_discard_pi.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_discard_pi.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF NOT v_cr_status EQ c_x.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM populate_selected_data_table.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "PI Type
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp;&nbsp;&nbsp; ENDLOOP.
&nbsp;&nbsp;&nbsp;&nbsp; CLEAR v_proc_mess_id_tmp.
&nbsp;&nbsp;&nbsp;&nbsp; IF NOT i_procmessheader\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM discard_control_recipe.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF NOT i_discard_pi\[\] IS INITIAL
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND NOT i_processmessagenew\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM discard_pi_sheet.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM bapi_transaction_commit.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp;&nbsp;&nbsp; IF NOT i_nodekey_change\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERFORM modify_nodes.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; ENDIF.
\*&nbsp;&nbsp; IF NOT v_cr_status IS INITIAL.
&nbsp;&nbsp; IF NOT i_errorlog\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE i000 WITH text-050 text-024.
&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE i000 WITH text-052.
&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; CLEAR v_cr_status.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " DISCARD_PROECESS
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; call_transaction_co60
\*&---------------------------------------------------------------------\*
\* Set parameter ID and call transaction CO60
\*----------------------------------------------------------------------\*
&nbsp;FORM call_transaction_co60 .

&nbsp;&nbsp; READ TABLE i_lookup WITH KEY itemno = v_key.
&nbsp;&nbsp; IF sy-subrc = 0 AND i_lookup-doctype = c_pi.
&nbsp;&nbsp;&nbsp;&nbsp; SET PARAMETER ID: 'WRK' FIELD i_lookup-plant.
&nbsp;&nbsp;&nbsp;&nbsp; SET PARAMETER ID: 'ANR' FIELD i_lookup-order.
&nbsp;&nbsp;&nbsp;&nbsp; CALL TRANSACTION c_co60 AND SKIP FIRST SCREEN .
&nbsp;&nbsp; ELSE.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE i000 WITH text-030.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " call_transaction_co60
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; modify_nodes
\*&---------------------------------------------------------------------\*
\* Change CR and PI items after complete or discard
\*----------------------------------------------------------------------\*
&nbsp;FORM modify_nodes .

&nbsp;&nbsp; DATA : l_nodekey_change TYPE lvc_nkey.

&nbsp;&nbsp; LOOP AT i_nodekey_change INTO l_nodekey_change.
&nbsp;&nbsp;&nbsp;&nbsp; IF NOT i_errorlog\[\] IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTchange_item
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_node_key&nbsp; = l_nodekey_change
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_fieldname = c_err
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_data&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = c_03
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_u_data&nbsp;&nbsp;&nbsp; = c_x.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTfrontend_update.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND l_nodekey_change TO i_nodekey_change1.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDLOOP.

&nbsp;&nbsp; REFRESH i_nodekey_change.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " modify_nodes
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; REFRESH_DISPLAY_LIST
\*&---------------------------------------------------------------------\*
\*&nbsp; Refresh Status report
\*----------------------------------------------------------------------\*
&nbsp;FORM refresh_display_list .

&nbsp;&nbsp; REFRESH i_errorlog.
&nbsp;&nbsp; REFRESH i_lvc_nkey.
&nbsp;&nbsp; REFRESH i_lookup.
&nbsp;&nbsp; REFRESH i_fieldcatalog.
&nbsp;&nbsp; REFRESH i_header.
&nbsp;&nbsp; REFRESH i_afko.
&nbsp;&nbsp; CALL METHOD v_custom_container-%GTfree.
&nbsp;&nbsp; PERFORM get_order_data.
&nbsp;&nbsp; PERFORM init_tree.
&nbsp;&nbsp; PERFORM all_header_node_expand.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " REFRESH_DISPLAY_LIST
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; GET_PI_STATUS
\*&---------------------------------------------------------------------\*
\*&nbsp; Get PI status
\*----------------------------------------------------------------------\*
&nbsp;FORM get_pi_status .

&nbsp;&nbsp; CALL FUNCTION 'PI_SHEET_GET_STATE'
&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cntrl_recipe_id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = i_sheet_header-crid
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CRD_TYPE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp; IMPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cr_state&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = v_state
&nbsp;&nbsp;&nbsp;&nbsp; EXCEPTIONS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not_found&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; crd_type_not_supported&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; internal_error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 3
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OTHERS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 4 .
&nbsp;&nbsp; IF sy-subrc %LT%GT 0.
\* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
\*Message e000 with text-064 i_sheet_header-crid.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " GET_PI_STATUS
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; PREPARE_LOOKUP_TABLE
\*&---------------------------------------------------------------------\*
\* Prepare Lookup file
\*----------------------------------------------------------------------\*
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \--%GTP_L_ITEMNO&nbsp; text
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \--%GTp_doctype&nbsp;&nbsp; text
\*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \--%GTp_docno&nbsp; text
\*----------------------------------------------------------------------\*
&nbsp;FORM prepare_lookup_table&nbsp; USING&nbsp;&nbsp;&nbsp; p_l_itemno TYPE any
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p_doctype TYPE any
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p_docno TYPE any.

&nbsp;&nbsp; i_lookup-itemno = p_l_itemno.
&nbsp;&nbsp; i_lookup-doctype = p_doctype.
&nbsp;&nbsp; i_lookup-docno = p_docno.
&nbsp;&nbsp; i_lookup-order = i_afko-aufnr.
&nbsp;&nbsp; i_lookup-plant = i_afko-werks.
&nbsp;&nbsp; i_lookup-frdate = i_afko-erdat.
&nbsp;&nbsp; i_lookup-todate = i_afko-aedat.
&nbsp;&nbsp; APPEND i_lookup.
&nbsp;&nbsp; CLEAR i_lookup.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " PREPARE_LOOKUP_TABLE
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; checkbox_check
\*&---------------------------------------------------------------------\*
\* Check at least one checkbox is checked or not.
\*----------------------------------------------------------------------\*
&nbsp;FORM checkbox_check .

&nbsp;&nbsp; IF c_new IS INITIAL AND c_inwork IS INITIAL AND c_close IS INITIAL
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND c_canc IS INITIAL AND c_disc IS INITIAL AND c_comp IS INITIAL
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND c_arch IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE e000 WITH text-029.
&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; IF c_create IS INITIAL AND c_sentcr IS INITIAL
&nbsp;&nbsp; AND c_proces IS INITIAL AND c_termin IS INITIAL
&nbsp;&nbsp; AND c_disccr IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE e000 WITH text-028.
&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; IF c_tosend IS INITIAL AND c_sentpm IS INITIAL
&nbsp;&nbsp; AND c_end IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE e000 WITH text-027.
&nbsp;&nbsp; ENDIF.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " checkbox_check
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; status_lookup
\*&---------------------------------------------------------------------\*
\* Check he status of the control recipe selected for discard/complete
\*----------------------------------------------------------------------\*
&nbsp;FORM status_lookup .

&nbsp;&nbsp; DATA: l_count TYPE lvc_nkey.

&nbsp;&nbsp; CLEAR v_cr_status.
&nbsp;&nbsp; SELECT SINGLE *
&nbsp;&nbsp; FROM coch
&nbsp;&nbsp; WHERE
&nbsp;&nbsp; crid = i_lookup-docno.
&nbsp;&nbsp; IF sy-subrc = 0.
&nbsp;&nbsp;&nbsp;&nbsp; IF coch-crstat EQ c_four OR coch-crstat EQ c_five
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OR coch-crstat EQ c_seven.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v_cr_status = c_x.
\*prepare error log table
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_errorlog-docno = i_lookup-docno.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CONCATENATE text-025 coch-crstat text-026
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INTO i_errorlog-message SEPARATED BY space.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND i_errorlog.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR i_errorlog.
\*prepare error icon display table.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_count = l_count + i_lookup-itemno.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APPEND l_count TO i_nodekey_change.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLEAR l_count.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; ENDIF.
&nbsp;&nbsp; CLEAR coch.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " status_lookup
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; CLEAR_LOG_ERR_ICON
\*&---------------------------------------------------------------------\*
\* clear error log and error icons
\*----------------------------------------------------------------------\*
&nbsp;FORM clear_log_err_icon .

&nbsp;&nbsp; REFRESH i_errorlog.

&nbsp;&nbsp; DATA : l_nodekey_change TYPE lvc_nkey.

&nbsp;&nbsp; LOOP AT i_nodekey_change1 INTO l_nodekey_change.
&nbsp;&nbsp;&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTchange_item
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXPORTING
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_node_key&nbsp; = l_nodekey_change
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_fieldname = c_err
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_data&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = c_5f
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i_u_data&nbsp;&nbsp;&nbsp; = c_x.

&nbsp;&nbsp;&nbsp;&nbsp; CALL METHOD v_alv_tree-%GTfrontend_update.

&nbsp;&nbsp; ENDLOOP.

&nbsp;&nbsp; REFRESH i_nodekey_change1.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " CLEAR_LOG_ERR_ICON
\*&---------------------------------------------------------------------\*
\*&&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Form&nbsp; check_authorisations
\*&---------------------------------------------------------------------\*
\* Authorization Check for Plant
\*----------------------------------------------------------------------\*
&nbsp;FORM check_authorisations .

&nbsp;&nbsp; LOOP AT i_werks.

&nbsp;&nbsp;&nbsp;&nbsp; AUTHORITY-CHECK OBJECT 'C_MESS_WRK'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ID 'ACTVT' FIELD c_star
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ID 'WERKS' FIELD i_werks-werks.

&nbsp;&nbsp;&nbsp;&nbsp; IF NOT sy-subrc IS INITIAL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MESSAGE s000 WITH text-053 i_werks-werks.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LEAVE LIST-PROCESSING.
&nbsp;&nbsp;&nbsp;&nbsp; ENDIF.

&nbsp;&nbsp; ENDLOOP.

&nbsp;ENDFORM.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " check_authorisations

\*Text elements
\*---------------------------------------------------------\-
\* 001 Selection Screen
\* 002 Date Range
\* 003 Status
\* 008 New CR
\* 009 Create CR
\* 010 To send CR
\* 011 In work CR
\* 012 Send CR
\* 013 Closed CR
\* 014 Process CR
\* 015 Terminate CR
\* 016 Cancelled CR
\* 017 Discarded CR
\* 018 Complete CR
\* 019 Archived CR

\*Selection texts
\*---------------------------------------------------------\-
\* C_ARCH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Archive
\* C_CANC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Cancel
\* C_CLOSE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Closed
\* C_COMP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Complete
\* C_CREATE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Create
\* C_DISC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Discard.
\* C_DISCCR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Discard Control Recipe
\* C_END&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End
\* C_INWORK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In Work
\* C_NEW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; New
\* C_PROCES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Process
\* C_SENTCR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sent Control Recipe
\* C_SENTPM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sent Process Message
\* C_TERMIN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Terminate
\* C_TOSEND&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To be send
\* S_AUART&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Order Type
\* S_AUFNR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Process Order
\* S_FEVOR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Production scheduler
\* S_GLTRP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Date
\* S_GSTRP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Start Date
\* S_MTART&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Material Type
\* S_PHSEQ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Phase
\* S_PLNBEZ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Material
\* S_RESS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Residual
\* S_STATUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Status
\* S_WERKS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Plant

\*Messages
\*---------------------------------------------------------\-
\*
\* Message class: 00
\*208&nbsp;&nbsp; &
\*
\* Message class: ZDEV
\*000

\*Text elements
\*---------------------------------------------------------\-
\* 001 Selection Screen
\* 002 Date Range
\* 003 Status
\* 008 New CR
\* 009 Create CR
\* 010 To send CR
\* 012 In work CR
\* 013 Send CR
\* 014 Closed CR
\* 015 Process CR
\* 016 Terminate CR
\* 017 Cancelled CR
\* 018 Discarded CR
\* 019 Complete CR
\* 020 Archived CR

\*Selection texts
\*---------------------------------------------------------\-
\* C_ARCH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Archive
\* C_CANC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Cancel
\* C_CLOSE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Closed
\* C_COMP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Complete
\* C_CREATE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Create
\* C_DISC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Discard.
\* C_DISCCR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Discard Control Recipe
\* C_END&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End
\* C_INWORK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In Work
\* C_NEW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; New
\* C_PROCES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Process
\* C_SENTCR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sent Control Recipe
\* C_SENTPM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sent Process Message
\* C_TERMIN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Terminate
\* C_TOSEND&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To be send
\* S_AUART&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Order Type
\* S_AUFNR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Process Order
\* S_FEVOR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Production scheduler
\* S_GLTRP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Date
\* S_GSTRP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Start Date
\* S_MTART&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Material Type
\* S_PHSEQ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Phase Sequence
\* S_PLNBEZ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Production scheduler
\* S_RESS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Residual
\* S_STATUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Status
\* S_WERKS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Plant

\*Messages
\*---------------------------------------------------------\-
\*
\* Message class: 00
\*208&nbsp;&nbsp; &
\*
\* Message class: ZDEV
\*000

\*Text elements
\*---------------------------------------------------------\-
\* 001 * 001 Selection Screen
\* 002 * 002 Date Range
\* 003 * 003 Status
\* 008 * 008 New CR
\* 009 * 009 Create CR
\* 010 * 010 To send CR
\* 012 * 012 In work CR
\* 013 * 013 Send CR
\* 014 * 014 Closed CR
\* 015 * 015 Process CR
\* 016 * 016 Terminate CR
\* 017 * 017 Cancelled CR
\* 018 * 018 Discarded CR
\* 019 * 019 Complete CR
\* 020 * 020 Archived CR

\*Selection texts
\*---------------------------------------------------------\-
\* C_ARCH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Archive
\* C_CANC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Cancel
\* C_CLOSE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Closed
\* C_COMP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Complete
\* C_CREATE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Create
\* C_DISC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Discard
\* C_DISCCR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Discard Control Recipe
\* C_END&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End
\* C_INWORK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In Work
\* C_NEW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; New
\* C_PROCES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Process
\* C_SENTCR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sent Control Recipe
\* C_SENTPM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sent Process Messages
\* C_TERMIN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Terminate
\* C_TOSEND&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To be send
\* S_AUART&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Order Type
\* S_AUFNR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Process Order
\* S_FEVOR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Production scheduler
\* S_GLTRP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Date
\* S_GSTRP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Start Date
\* S_MTART&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Material Typ
\* S_PHSEQ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Phase Sequence
\* S_PLNBEZ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Production Scheduler
\* S_RESS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Residual
\* S_STATUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Status
\* S_WERKS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Plant

\*Messages
\*---------------------------------------------------------\-
\*
\* Message class: 00
\*208&nbsp;&nbsp; &
\*
\* Message class: ZDEV
\*000

\*Text elements
\*---------------------------------------------------------\-
\* 001 Selection Screen
\* 002 Date Range
\* 003 Status
\* 008 CR
\* 009 Create CR
\* 010 To send CR
\* 012 In work CR
\* 013 Send CR
\* 014 Closed CR
\* 015 Process CR
\* 016 Terminate CR
\* 017 Cancelled CR
\* 018 Discarded CR
\* 019 Complete CR
\* 020 Archived CR

\*Selection texts
\*---------------------------------------------------------\-
\* C_ARCH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Archive
\* C_CANC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Cancel
\* C_CLOSE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Closed
\* C_COMP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Complete
\* C_CREATE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Create
\* C_DISC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Discard
\* C_DISCCR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Discard Control Recipe
\* C_END&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End
\* C_INWORK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In Work
\* C_NEW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; New
\* C_PROCES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Process
\* C_SENTCR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sent Control Recipe
\* C_SENTPM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sent Process Messages
\* C_TERMIN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Terminate
\* C_TOSEND&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To be send
\* S_AUART&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Order Type
\* S_AUFNR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Process Order
\* S_FEVOR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Production scheduler
\* S_GLTRP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Date
\* S_GSTRP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Start Date
\* S_MTART&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Material Typ
\* S_PHSEQ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Phase Sequence
\* S_PLNBEZ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Production Scheduler
\* S_RESS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Residual
\* S_STATUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Status
\* S_WERKS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Plant

\*Messages
\*---------------------------------------------------------\-
\*
\* Message class: 00
\*208&nbsp;&nbsp; &
\*
\* Message class: ZDEV
\*000

\-------------------------------------------------------------------------------\-
  • No labels