Skip to end of metadata
Go to start of metadata
Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
*& Date:    2005/03/16                                                 *
*& Purpose: Download Planning data into an excel spreadsheet, allow    *
*&          the user to make modifications and then upload the file    *
*&          back into R/3 to make the modifications                    *
*&---------------------------------------------------------------------*
REPORT  ZPUPLANNING_DOWNL_UPL1 LINE-SIZE 255 MESSAGE-ID ZP.

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

************************************************************************
* INCLUDES - PART 1
************************************************************************
INCLUDE ZPIPLANNING_DOWNL_UPL_TOP1.

************************************************************************
* SELECTION SCREEN
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-000.
PARAMETERS:     RB_DOWNL RADIOBUTTON GROUP RBG1.
SELECTION-SCREEN ULINE.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR,    " Material
                S_WERKS FOR MARC-WERKS,    " Plant
                S_DISPO FOR MDKP-DISPO,    " MRP Controller
*                s_dsdat FOR mdkp-dsdat,    " Date
                S_BESKZ FOR MARC-BESKZ
                            DEFAULT 'F',   " Procurement Type
                S_SOBSL FOR MARC-SOBSL,    " Spec. Proc Type.
*                s_delkz FOR mdtb-delkz,    " MRP Element
                S_EKGRP FOR MARC-EKGRP.    " Purchasing Group
PARAMETERS :  P_VKORG LIKE MVKE-VKORG,    " sales organisation
              P_VTWEG LIKE MVKE-VTWEG,    " Distribution channel
              P_LGNUM LIKE MLGN-LGNUM.   " Warehouse number
SELECT-OPTIONS: S_VMSTA FOR MVKE-VMSTA.    " sales status
SELECTION-SCREEN BEGIN OF BLOCK BL2 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_DSDAT FOR MDKP-DSDAT,    " Date
                S_DELKZ FOR MDTB-DELKZ.    " MRP Element
SELECTION-SCREEN END OF BLOCK BL2.
SELECTION-SCREEN BEGIN OF BLOCK BL3 WITH FRAME TITLE TEXT-015.
SELECT-OPTIONS: S_AMATNR FOR MARA-MATNR.   " active BOM
PARAMETERS :    P_DATUV LIKE STKO-DATUV DEFAULT SY-DATUM,
                P_CAPID LIKE TC04T-CAPID DEFAULT 'PP01'.
SELECTION-SCREEN END OF BLOCK BL3.
SELECTION-SCREEN BEGIN OF BLOCK BL4 WITH FRAME TITLE TEXT-016.
SELECT-OPTIONS: S_BUDAT FOR MKPF-BUDAT,    " consumption date
                S_BWART FOR MSEG-BWART.    " Mvt type for consumption
SELECTION-SCREEN END OF BLOCK BL4.
SELECTION-SCREEN SKIP 3.
PARAMETERS:     RB_UPLD RADIOBUTTON GROUP RBG1.
SELECTION-SCREEN ULINE.
PARAMETERS:     P_FILE LIKE RLGRAP-FILENAME,
                CHK_FIR AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK BL1.
DATA: G_TITLE  TYPE STRING,
      G_SUBRC  TYPE SY-SUBRC.
DATA: WA_FILE  TYPE FILE_TABLE,
      IT_FILES TYPE FILETABLE.
G_TITLE = TEXT-002.
AT SELECTION-SCREEN.
  SELECT SINGLE MATNR FROM MARA INTO MARA-MATNR WHERE MATNR IN S_MATNR.
  IF SY-SUBRC NE 0.
    MESSAGE E000.
  ENDIF.
  SELECT SINGLE WERKS FROM MARC INTO MARC-WERKS WHERE WERKS IN S_WERKS.
  IF SY-SUBRC NE 0.
    MESSAGE E001.
  ENDIF.
  SELECT SINGLE MATNR FROM MAST INTO MAST-MATNR WHERE MATNR IN S_AMATNR.
  IF SY-SUBRC NE 0.
    MESSAGE E002.
  ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
  G_TITLE = TEXT-010.
  REFRESH: IT_FILES.
  CALL METHOD CL_GUI_FRONTEND_SERVICES=%GTFILE_OPEN_DIALOG
     EXPORTING
       WINDOW_TITLE            = G_TITLE
       DEFAULT_EXTENSION       = 'xls'
*      DEFAULT_FILENAME        =
       FILE_FILTER             =
CL_GUI_FRONTEND_SERVICES=%GTFILETYPE_EXCEL
       INITIAL_DIRECTORY       = 'C:\'
     CHANGING
       FILE_TABLE              = IT_FILES
       RC                      = G_SUBRC
     EXCEPTIONS
       FILE_OPEN_DIALOG_FAILED = 1
       CNTL_ERROR              = 2
       ERROR_NO_GUI            = 3
       NOT_SUPPORTED_BY_GUI    = 4
       OTHERS                  = 5.
  IF SY-SUBRC %LT%GT 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  READ TABLE IT_FILES INTO WA_FILE INDEX 1.
  IF SY-SUBRC = 0.
    P_FILE = WA_FILE-FILENAME.
  ENDIF.
************************************************************************
* INCLUDES - PART 2
************************************************************************
*  INCLUDE z_alv_include_v2.
*  INCLUDE zpiplanning_downl_upl_inc1.
*&---------------------------------------------------------------------*
*&  Include           Z_ALV_INCLUDE_V2
*&---------------------------------------------------------------------*
*----------------------------------------------------------------------*
*   INCLUDE Z_ALV_INCLUDE                                              *
*----------------------------------------------------------------------*
* Type Pools
  TYPE-POOLS: RSDS.
* Class definitions
*CLASS lcl_event_receiver DEFINITION DEFERRED.
****************************************************************
* LOCAL CLASSES: Definition
****************************************************************
* class c_event_receiver: local class to handle print events
*    - PRINT_TOP_OF_PAGE (page header)
*    - PRINT_END_OF_PAGE (page footer)
*    - PRINT_TOP_OF_LIST (list header)
*    - PRINT_END_OF_LIST (list footer)
CLASS LCL_EVENT_RECEIVER DEFINITION.
  PUBLIC SECTION.
* § 2. Define a method for each print event you need.
    METHODS:
    HANDLE_TOP_OF_PAGE
        FOR EVENT PRINT_TOP_OF_PAGE OF CL_GUI_ALV_GRID,
    HANDLE_END_OF_PAGE
        FOR EVENT PRINT_END_OF_PAGE OF CL_GUI_ALV_GRID,
    HANDLE_TOP_OF_LIST
        FOR EVENT PRINT_TOP_OF_LIST OF CL_GUI_ALV_GRID,
    HANDLE_END_OF_LIST
        FOR EVENT PRINT_END_OF_LIST OF CL_GUI_ALV_GRID,
    HANDLE_DOUBLE_CLICK
        FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
            IMPORTING E_ROW E_COLUMN,
    HANDLE_DATA_CHANGED
         FOR EVENT DATA_CHANGED OF CL_GUI_ALV_GRID
             IMPORTING ER_DATA_CHANGED,
    HANDLE_DATA_CHANGED_FINISHED
         FOR EVENT DATA_CHANGED_FINISHED OF CL_GUI_ALV_GRID
             IMPORTING E_MODIFIED
                       ET_GOOD_CELLS.
  PRIVATE SECTION.
    DATA: E_ROW    TYPE LVC_S_ROW,
          E_COLUMN TYPE LVC_S_COL.
    DATA: ERROR_IN_DATA TYPE C.
* Methods to modularize event handler method HANDLE_DATA_CHANGED:
*    METHODS: update_data_in_table
*     IMPORTING
**        ps_good_planetype TYPE lvc_s_modi
*        pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
*
*    METHODS: ch_new_plane_v_new_seatsocc
*           IMPORTING
*              psg_plane TYPE lvc_s_modi
*              psg_socc TYPE lvc_s_modi
*              ps_saplane TYPE saplane
*              pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
*
*    METHODS: ch_new_plane_v_old_seatsocc
*           IMPORTING
*              psg_plane TYPE lvc_s_modi
*              ps_saplane TYPE saplane
*              pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
*
*    METHODS: check_seatsocc
*           IMPORTING
*              ps_good TYPE lvc_s_modi
*              pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.

ENDCLASS.                    "lcl_event_receiver DEFINITION

DATA:
*      ok_code          LIKE sy-ucomm,
      G_REPID           LIKE SY-REPID,
      G_REPID2          LIKE SY-REPID,
      GS_PRINT          TYPE LVC_S_PRNT,
      GS_PRINT2         TYPE LVC_S_PRNT,
      GS_LAYOUT         TYPE LVC_S_LAYO,
      GS_LAYOUT2        TYPE LVC_S_LAYO,
      GS_VARIANT        TYPE DISVARIANT,
      GS_VARIANT2       TYPE DISVARIANT,
      G_REPORT_NAME     TYPE LVC_S_LAYO-GRID_TITLE,
      G_REPORT_NAME2    TYPE LVC_S_LAYO-GRID_TITLE,
      G_CONTAINER_NAME  TYPE SCRFNAME,
      G_CONTAINER_NAME2 TYPE SCRFNAME,
      G_STRUCTURE_NAME  TYPE DD02L-TABNAME,
      G_STRUCTURE_NAME2 TYPE DD02L-TABNAME,
      GT_SORT           TYPE LVC_T_SORT,
      GT_SORT2          TYPE LVC_T_SORT,
      GT_FIELDCAT       TYPE LVC_T_FCAT WITH HEADER LINE,
      GT_FIELDCAT2      TYPE LVC_T_FCAT WITH HEADER LINE.
*declaration of Objects
DATA:
      CUSTOM_CONTAINER   TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
      CUSTOM_CONTAINER2  TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
      TOP_CONTAINER      TYPE REF TO CL_GUI_CONTAINER,
      TOP_CONTAINER2     TYPE REF TO CL_GUI_CONTAINER,
      MAIN_CONTAINER     TYPE REF TO CL_GUI_CONTAINER,
      MAIN_CONTAINER2    TYPE REF TO CL_GUI_CONTAINER,
      BOTTOM_CONTAINER   TYPE REF TO CL_GUI_CONTAINER,
      BOTTOM_CONTAINER2  TYPE REF TO CL_GUI_CONTAINER,
      EZ_SPLIT_CONTAINER TYPE REF TO CL_GUI_EASY_SPLITTER_CONTAINER,
      EZ_SPLIT_CONTAINER2 TYPE REF TO CL_GUI_EASY_SPLITTER_CONTAINER,
      SPLITTER_CONTAINER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
      SPLITTER_CONTAINER2 TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
      GRID1              TYPE REF TO CL_GUI_ALV_GRID,
      GRID2              TYPE REF TO CL_GUI_ALV_GRID,
      TEXT_BOX_TOP       TYPE REF TO CL_DD_DOCUMENT,
      TEXT_BOX_TOP2      TYPE REF TO CL_DD_DOCUMENT,
      TEXT_BOX_BOTTOM    TYPE REF TO CL_DD_DOCUMENT,
      TEXT_BOX_BOTTOM2   TYPE REF TO CL_DD_DOCUMENT,
      EVENT_RECEIVER     TYPE REF TO LCL_EVENT_RECEIVER,
      EVENT_RECEIVER2    TYPE REF TO LCL_EVENT_RECEIVER.
FIELD-SYMBOLS:
*                 %LTfs_data%GT TYPE REF TO data,
*                 %LTfs_table%GT TYPE ANY TABLE,
               %LTGT_OUTPUT%GT TYPE STANDARD TABLE,
                %LTGT_OUTPUT2%GT TYPE ANY TABLE,
                %LTGT_BOMS%GT TYPE STANDARD TABLE.

*&---------------------------------------------------------------------*
*&      Form  CREATE_HEADER
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --%GT  p1        text
*  %LT--  p2        text
*----------------------------------------------------------------------*
FORM CREATE_SCREEN_HEADER.
  DATA:
    IT_SEL_CRIT      LIKE RSPARAMS OCCURS 20 WITH HEADER LINE,
    IT_PROGRAM_TEXTS LIKE TEXTPOOL OCCURS 0 WITH HEADER LINE,
    IT_LIST_COMMENTARY    TYPE SLIS_T_LISTHEADER,
    LS_LINE          TYPE SLIS_LISTHEADER,
    DATA_TYPE.
  FIELD-SYMBOLS: %LTLFS1%GT.
  TYPES: BEGIN OF TYPE_PARAM_TABLE,
           PARNAM(255) TYPE C,
           LOWVAL      TYPE TVARV_VAL,
           TOVAL(4)    TYPE C,
           HIGVAL      TYPE TVARV_VAL,
         END OF TYPE_PARAM_TABLE.
  READ TEXTPOOL SY-CPROG INTO IT_PROGRAM_TEXTS.
  CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
    EXPORTING
      CURR_REPORT     = SY-CPROG
    TABLES
      SELECTION_TABLE = IT_SEL_CRIT
    EXCEPTIONS
      NOT_FOUND       = 1
      NO_REPORT       = 2
      OTHERS          = 3.
  IF NOT SY-SUBRC = 0.
    CALL FUNCTION 'POPUP_TO_INFORM'
      EXPORTING
        TITEL = G_REPID
        TXT2  = SY-SUBRC
        TXT1  = 'Error getting sel options - contact support'.
  ENDIF.
  LOOP AT IT_SEL_CRIT.
    READ TABLE IT_PROGRAM_TEXTS WITH KEY
      KEY = IT_SEL_CRIT-SELNAME.
    ASSIGN (IT_SEL_CRIT-SELNAME) TO %LTLFS1%GT.
    DESCRIBE FIELD %LTLFS1%GT TYPE DATA_TYPE.
    IF DATA_TYPE = 'D'.
      IF NOT IT_SEL_CRIT-LOW IS INITIAL.
        CONCATENATE IT_SEL_CRIT-LOW(4) '/' IT_SEL_CRIT-LOW+4(2) '/'
                    IT_SEL_CRIT-LOW+6(2) INTO IT_SEL_CRIT-LOW.
      ENDIF.
      IF NOT IT_SEL_CRIT-HIGH IS INITIAL.
        CONCATENATE IT_SEL_CRIT-HIGH(4) '/' IT_SEL_CRIT-HIGH+4(2) '/'
                    IT_SEL_CRIT-HIGH+6(2) INTO IT_SEL_CRIT-HIGH.
      ENDIF.
    ENDIF.
    IF DATA_TYPE = 'T'.
      IF NOT IT_SEL_CRIT-LOW IS INITIAL.
        CONCATENATE IT_SEL_CRIT-LOW(2) ':' IT_SEL_CRIT-LOW+2(2)
               INTO IT_SEL_CRIT-LOW.
      ENDIF.
      IF NOT IT_SEL_CRIT-HIGH IS INITIAL.
        CONCATENATE IT_SEL_CRIT-HIGH(2) ':' IT_SEL_CRIT-HIGH+2(2)
               INTO IT_SEL_CRIT-HIGH.
      ENDIF.
    ENDIF.
    CLEAR LS_LINE.
    LS_LINE-TYP  = 'S'.
    LS_LINE-KEY  = IT_PROGRAM_TEXTS-ENTRY.
    IF NOT IT_SEL_CRIT-HIGH IS INITIAL.
      CONCATENATE IT_SEL_CRIT-LOW 'to' IT_SEL_CRIT-HIGH
             INTO LS_LINE-INFO
                  SEPARATED BY SPACE.
    ELSE.
      LS_LINE-INFO = IT_SEL_CRIT-LOW.
    ENDIF.
    APPEND LS_LINE TO IT_LIST_COMMENTARY.
  ENDLOOP.
  EXPORT IT_LIST_COMMENTARY FROM IT_LIST_COMMENTARY
      TO MEMORY ID 'DYNDOS_FOR_ALV'.
  CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'
    EXPORTING
      DOCUMENT = TEXT_BOX_TOP
      BOTTOM   = SPACE.
* get TOP-%GTHTML_TABLE ready
  CALL METHOD TEXT_BOX_TOP-%GTMERGE_DOCUMENT.
ENDFORM.                    " CREATE_HEADER
*&---------------------------------------------------------------------*
*&      Form  create_screen_header_man
*&---------------------------------------------------------------------*
FORM CREATE_SCREEN_HEADER_MAN.
  TYPES: BEGIN OF TY_PARM_TABLE,
           ENTRY(150) TYPE C.
          INCLUDE STRUCTURE RSPARAMS.
  TYPES: END OF TY_PARM_TABLE.
  DATA:
    IT_SEL_CRIT        LIKE RSPARAMS OCCURS 20 WITH HEADER LINE,
    IT_PROGRAM_TEXTS   LIKE TEXTPOOL OCCURS 0 WITH HEADER LINE,
    IT_PARAMETERS      TYPE TABLE OF TY_PARM_TABLE WITH HEADER LINE,
    LS_LINE            TYPE SLIS_LISTHEADER,
    DATA_TYPE,
    S_TABLE            TYPE REF TO CL_DD_TABLE_ELEMENT,
    COLUMN1            TYPE REF TO CL_DD_AREA,
    COLUMN2            TYPE REF TO CL_DD_AREA,
    COLUMN3            TYPE REF TO CL_DD_AREA,
    A_LOGO             TYPE REF TO CL_DD_AREA,
    LINE_TEXT(255)     TYPE C,
    LINE_TEXT2(255)    TYPE C,
    OLD_LINE_TEXT(255) TYPE C,
    LINE_CONCAT(255)   TYPE C,
    ICON_NAME          TYPE ICON_NAME.
  FIELD-SYMBOLS: %LTLFS1%GT.
* read the selection texts from the selection screen
  READ TEXTPOOL SY-CPROG INTO IT_PROGRAM_TEXTS.
  CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
    EXPORTING
      CURR_REPORT     = SY-CPROG
    TABLES
      SELECTION_TABLE = IT_SEL_CRIT
    EXCEPTIONS
      NOT_FOUND       = 1
      NO_REPORT       = 2
      OTHERS          = 3.
  IF NOT SY-SUBRC = 0.
    CALL FUNCTION 'POPUP_TO_INFORM'
      EXPORTING
        TITEL = G_REPID
        TXT2  = SY-SUBRC
        TXT1  = 'Error getting sel options - contact support'.
  ENDIF.
* Split the top section of the screen with 99% to the left
* this will leave one little frame at the right for us
* to insert the companyt logo
  CALL METHOD TEXT_BOX_TOP-%GTVERTICAL_SPLIT
    EXPORTING
      SPLIT_AREA  = TEXT_BOX_TOP
      SPLIT_WIDTH = '99%'
    IMPORTING
      RIGHT_AREA  = A_LOGO.
  CALL METHOD A_LOGO-%GTADD_PICTURE
    EXPORTING
      PICTURE_ID = 'CAMOPLAST_LOGO_COL_229_110'.

* add a table for the parameter display and add 2 columns
  CALL METHOD TEXT_BOX_TOP-%GTADD_TABLE
    EXPORTING
      NO_OF_COLUMNS               = 3
      WITH_HEADING                = ' '
      CELL_BACKGROUND_TRANSPARENT = 'X'
      WIDTH                       = ''
      BORDER                      = '1'
    IMPORTING
      TABLE                       = S_TABLE.
  CALL METHOD S_TABLE-%GTADD_COLUMN
    IMPORTING
      COLUMN = COLUMN1.
  CALL METHOD S_TABLE-%GTADD_COLUMN
    IMPORTING
      COLUMN = COLUMN2.
  CALL METHOD S_TABLE-%GTADD_COLUMN
    IMPORTING
      COLUMN = COLUMN3.

* add the table column names in the first row of the table
  LINE_TEXT = 'Parameter Name'.
  CALL METHOD COLUMN1-%GTADD_TEXT
    EXPORTING
      TEXT         = LINE_TEXT
      SAP_EMPHASIS = 'Strong'.
  LINE_TEXT = 'Type'.
  CALL METHOD COLUMN2-%GTADD_TEXT
    EXPORTING
      TEXT         = LINE_TEXT
      SAP_EMPHASIS = 'Strong'.
  CALL METHOD COLUMN3-%GTADD_GAP
    EXPORTING
      WIDTH = 3.
  LINE_TEXT = 'Value'.
  CALL METHOD COLUMN3-%GTADD_TEXT
    EXPORTING
      TEXT         = LINE_TEXT
      SAP_EMPHASIS = 'Strong'.
  CALL METHOD S_TABLE-%GTNEW_ROW.

  LOOP AT IT_SEL_CRIT.
    READ TABLE IT_PROGRAM_TEXTS WITH KEY
      KEY = IT_SEL_CRIT-SELNAME.
    IT_PARAMETERS-ENTRY = IT_PROGRAM_TEXTS-ENTRY.
    MOVE-CORRESPONDING IT_SEL_CRIT TO IT_PARAMETERS.
    APPEND IT_PARAMETERS.
  ENDLOOP.
  SORT IT_PARAMETERS BY ENTRY.

  LOOP AT IT_PARAMETERS.
*   if the text is set with the dictionary default text, remove
*   the D character from the begining of the string
    IF IT_PARAMETERS(8) = 'D       '.
      IT_PARAMETERS-ENTRY = IT_PARAMETERS-ENTRY+8.
    ENDIF.
    ASSIGN (IT_PARAMETERS-SELNAME) TO %LTLFS1%GT.
    DESCRIBE FIELD %LTLFS1%GT TYPE DATA_TYPE.
    IF DATA_TYPE = 'D'.
      IF NOT IT_PARAMETERS-LOW IS INITIAL AND
         NOT IT_PARAMETERS-LOW = '00000000'.
        CONCATENATE IT_PARAMETERS-LOW(4) '/' IT_PARAMETERS-LOW+4(2) '/'
                    IT_PARAMETERS-LOW+6(2) INTO IT_PARAMETERS-LOW.
      ELSE.
        CONTINUE.
      ENDIF.
      IF NOT IT_PARAMETERS-HIGH IS INITIAL AND
         NOT IT_PARAMETERS-HIGH = '00000000'.
        CONCATENATE IT_PARAMETERS-HIGH(4) '/' IT_PARAMETERS-HIGH+4(2)
'/'
                          IT_PARAMETERS-HIGH+6(2) INTO
IT_PARAMETERS-HIGH.
      ENDIF.
    ENDIF.
    IF DATA_TYPE = 'T'.
      IF NOT IT_PARAMETERS-LOW IS INITIAL.
        CONCATENATE IT_PARAMETERS-LOW(2) ':' IT_PARAMETERS-LOW+2(2)
               INTO IT_PARAMETERS-LOW.
      ENDIF.
      IF NOT IT_PARAMETERS-HIGH IS INITIAL.
        CONCATENATE IT_PARAMETERS-HIGH(2) ':' IT_PARAMETERS-HIGH+2(2)
               INTO IT_PARAMETERS-HIGH.
      ENDIF.
    ENDIF.
    IF NOT IT_PARAMETERS-HIGH IS INITIAL AND
       NOT IT_PARAMETERS-HIGH = '            0.000'.
      CONCATENATE IT_PARAMETERS-LOW 'to' IT_PARAMETERS-HIGH
             INTO LINE_CONCAT
                  SEPARATED BY SPACE.
    ELSE.
      LINE_CONCAT = IT_PARAMETERS-LOW.
    ENDIF.
    IF NOT IT_PARAMETERS-LOW IS INITIAL.
      CALL METHOD S_TABLE-%GTNEW_ROW.
      IF OLD_LINE_TEXT NE IT_PARAMETERS-ENTRY.
        LINE_TEXT = IT_PARAMETERS-ENTRY.
        CALL METHOD COLUMN1-%GTADD_TEXT
          EXPORTING
            TEXT         = LINE_TEXT
            SAP_EMPHASIS = 'Strong'.
**************************
* KEVIN NORRIS 2008/01/08 - ADD ICONS TO TABLE
        ICON_NAME = 'ICON_EQUAL'.
        IF IT_PARAMETERS-SIGN = ''.
          CASE IT_PARAMETERS-OPTION.
            WHEN 'EQ'.
              ICON_NAME = 'ICON_EQUAL'.
            WHEN 'NE'.
              ICON_NAME = 'ICON_NOT_EQUAL'.
            WHEN 'GT'.
              ICON_NAME = 'ICON_GREATER'.
            WHEN 'LT'.
              ICON_NAME = 'ICON_LESS'.
            WHEN 'GE'.
              ICON_NAME = 'ICON_GREATER_EQUAL'.
            WHEN 'LE'.
              ICON_NAME = 'ICON_LESS_EQUAL'.
            WHEN 'BT'.
              ICON_NAME = 'ICON_INTERVAL_INCLUDE'.
            WHEN 'NB'.
              ICON_NAME = 'ICON_INTERVAL_EXCLUDE'.
          ENDCASE.
        ELSEIF IT_PARAMETERS-SIGN = 'I'.
          CASE IT_PARAMETERS-OPTION.
            WHEN 'EQ'.
              ICON_NAME = 'ICON_EQUAL_GREEN'.
            WHEN 'NE'.
              ICON_NAME = 'ICON_NOT_EQUAL_GREEN'.
            WHEN 'GT'.
              ICON_NAME = 'ICON_GREATER_GREEN'.
            WHEN 'LT'.
              ICON_NAME = 'ICON_LESS_GREEN'.
            WHEN 'GE'.
              ICON_NAME = 'ICON_GREATER_EQUAL_GREEN'.
            WHEN 'LE'.
              ICON_NAME = 'ICON_LESS_EQUAL_GREEN'.
            WHEN 'BT'.
              ICON_NAME = 'ICON_INTERVAL_INCLUDE_GREEN'.
            WHEN 'NB'.
              ICON_NAME = 'ICON_INTERVAL_EXCLUDE_GREEN'.
          ENDCASE.
        ELSEIF IT_PARAMETERS-SIGN = 'E'.
          CASE IT_PARAMETERS-OPTION.
            WHEN 'EQ'.
              ICON_NAME = 'ICON_EQUAL_RED'.
            WHEN 'NE'.
              ICON_NAME = 'ICON_NOT_EQUAL_RED'.
            WHEN 'GT'.
              ICON_NAME = 'ICON_GREATER_RED'.
            WHEN 'LT'.
              ICON_NAME = 'ICON_LESS_RED'.
            WHEN 'GE'.
              ICON_NAME = 'ICON_GREATER_EQUAL_RED'.
            WHEN 'LE'.
              ICON_NAME = 'ICON_LESS_EQUAL_RED'.
            WHEN 'BT'.
              ICON_NAME = 'ICON_INTERVAL_INCLUDE_RED'.
            WHEN 'NB'.
              ICON_NAME = 'ICON_INTERVAL_EXCLUDE_RED'.
          ENDCASE.
        ENDIF.
        CALL METHOD COLUMN2-%GTADD_ICON
          EXPORTING
            SAP_ICON = ICON_NAME.
**************************
        OLD_LINE_TEXT = LINE_TEXT.
      ENDIF.
      CALL METHOD COLUMN1-%GTADD_GAP
        EXPORTING
          WIDTH = 3.
      CALL METHOD COLUMN3-%GTADD_GAP
        EXPORTING
          WIDTH = 3.
*     for checkboxes or radio-buttons, place a checked icon
*     in the value box instead of the X character
      IF LINE_CONCAT = 'X'.
        CALL METHOD COLUMN3-%GTADD_ICON
          EXPORTING
            SAP_ICON = 'ICON_CHECKED'.
      ELSE.
        LINE_TEXT = LINE_CONCAT.
        CALL METHOD COLUMN3-%GTADD_TEXT
          EXPORTING
            TEXT = LINE_TEXT.
      ENDIF.
      CALL METHOD COLUMN3-%GTADD_GAP
        EXPORTING
          WIDTH = 3.
      CALL METHOD TEXT_BOX_TOP-%GTNEW_LINE.
    ENDIF.
  ENDLOOP.
* get TOP-%GTHTML_TABLE ready
  CALL METHOD TEXT_BOX_TOP-%GTMERGE_DOCUMENT.
ENDFORM.                    " create_screen_header_man

*---------------------------------------------------------------------*
*       FORM OUTPUT_REPORT_HEADER                                     *
*---------------------------------------------------------------------*
*       Output Report Header                                          *
*---------------------------------------------------------------------*
*  --%GT  P_TITLE2                                                      *
*  --%GT  P_TITLE3                                                      *
*---------------------------------------------------------------------*
FORM OUTPUT_PAGE_HEADER USING P_TITLE2 P_TITLE3.
***
* Variables to control Column Header and Page # Printing
  DATA: PRINT_PAGES(1)  TYPE C VALUE 'X'.
* Control Page Description.  Displays '** Supplemental Page ** if value
* is not populated in ABAP program
  DATA: PAGE_DESC(23)   TYPE C.

  DATA: TITLE1(80) VALUE ' *** Company Confidential - My Company ***'.
* Report Title Lengths
  DATA: TITLE1_LENGTH TYPE I,
        TITLE2_LENGTH TYPE I,
        TITLE3_LENGTH TYPE I.
* Misc Report System Field Lengths
  DATA: CPROG_LENGTH  TYPE I,
        TCODE_LENGTH  TYPE I,
        SYSID_LENGTH  TYPE I.
* Report Field Starting Positions
  DATA: TITLE1_START  TYPE I,
        TITLE2_START  TYPE I,
        TITLE3_START  TYPE I,
        RIGHT_START   TYPE I.
  CONSTANTS: C_MAX_WIDTH TYPE I VALUE '255'.
  DATA: REPORT_WIDTH TYPE I VALUE 0.
* Misc Field Lengths
* Get Report Title Lengths
  TITLE1_LENGTH = STRLEN( TITLE1 ).
  TITLE2_LENGTH = STRLEN( P_TITLE2 ).
  TITLE3_LENGTH = STRLEN( P_TITLE3 ).
* Determine Report Title Starting Positions
  IF SY-LINSZ %GT '255'.
    REPORT_WIDTH = C_MAX_WIDTH.
  ELSE.
    REPORT_WIDTH = SY-LINSZ.
  ENDIF.
  TITLE1_START = REPORT_WIDTH / 2 - ( TITLE1_LENGTH / 2 ).
  TITLE2_START = REPORT_WIDTH / 2 - ( TITLE2_LENGTH / 2 ).
  TITLE3_START = REPORT_WIDTH / 2 - ( TITLE3_LENGTH / 2 ).
  RIGHT_START  = REPORT_WIDTH - 23.
* Determine actual field lengths for output
  CPROG_LENGTH = STRLEN( SY-CPROG ).
  TCODE_LENGTH = STRLEN( SY-TCODE ).
  SYSID_LENGTH = STRLEN( SY-SYSID ).
* Print page numbering  (Note: batch mode cannot print page x of x!)
  IF PRINT_PAGES = 'X'.
    WRITE: AT RIGHT_START 'Page:', SY-PAGNO.
  ELSE.
    IF PAGE_DESC = SPACE.
      WRITE: AT RIGHT_START '** Supplemental Page **'.
    ELSE.
      WRITE: AT RIGHT_START PAGE_DESC.
    ENDIF.
  ENDIF.
* Output 2nd Report Title Line
  WRITE: /1 'User:', 9 SY-UNAME.
  WRITE: AT TITLE2_START P_TITLE2.
  WRITE: AT RIGHT_START 'Date:', SY-DATUM.
* Output 3rd Report Title Line
  WRITE: /1 'Transaction:', SY-TCODE.
  WRITE: AT TITLE3_START P_TITLE3.
  WRITE: AT RIGHT_START 'Time:', SY-UZEIT.
  SKIP.
***
ENDFORM.                               " OUTPUT_REPORT_HEADER

*&---------------------------------------------------------------------*
*&      Form  print_list_header
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --%GT  p1        text
*  %LT--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_LIST_HEADER.
  DATA: MAX_LINES TYPE I VALUE 50,
        COUNTER TYPE I VALUE 0.
  TYPES: BEGIN OF S_INFOTAB,
          FLAG(1)    TYPE C,
          OLENGTH(1) TYPE X,
          LINE       TYPE RSVAR-INFOLINE,
         END OF S_INFOTAB.
  DATA: INFOTAB TYPE TABLE OF S_INFOTAB,
        WA_INFOTAB TYPE S_INFOTAB.
  CALL FUNCTION 'PRINT_SELECTIONS'
    EXPORTING
      MODE      = 1
      RNAME     = SY-CPROG
      RVARIANTE = SY-SLSET
    TABLES
      INFOTAB   = INFOTAB
    EXCEPTIONS
      OTHERS    = 1.
  IF NOT SY-SUBRC = 0.
    CALL FUNCTION 'POPUP_TO_INFORM'
      EXPORTING
        TITEL = G_REPID
        TXT2  = SY-SUBRC
        TXT1  = 'Error in FM PRINT_SELECTIONS - contact support'.
  ENDIF.
* if the page header extends beyond 57 lines, the entire page header
* will not fit on one page and a page header overflow results.  Limit
* the selection parameter section to 50 lines so that the combination
* of the pager header and the list header will not overflow and dump.
  LOOP AT INFOTAB INTO WA_INFOTAB.
    COUNTER = COUNTER + 1.
    IF NOT COUNTER %GT MAX_LINES.
      WRITE: / WA_INFOTAB-LINE.
    ELSE.
      WRITE: / '.....'.
      EXIT.
    ENDIF.
  ENDLOOP.

ENDFORM.                    " print_list_header
*&---------------------------------------------------------------------*
*&      Form  setup_splitter_container
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --%GT  p1        text
*  %LT--  p2        text
*----------------------------------------------------------------------*
FORM SETUP_SPLITTER_CONTAINER USING P_MODE TYPE STRING.
  CONSTANTS: C_TOP_HEIGHT  TYPE I VALUE 22,
             C_MAIN_HEIGHT TYPE I VALUE 50.

* create a custom container control
  CREATE OBJECT CUSTOM_CONTAINER
      EXPORTING
          CONTAINER_NAME = G_CONTAINER_NAME
      EXCEPTIONS
          CNTL_ERROR = 1
          CNTL_SYSTEM_ERROR = 2
          CREATE_ERROR = 3
          LIFETIME_ERROR = 4
          LIFETIME_DYNPRO_DYNPRO_LINK = 5.
  IF P_MODE = 'MODE1'.
    MAIN_CONTAINER = CUSTOM_CONTAINER.

  ELSEIF P_MODE = 'MODE2'.
* MODE2 - In mode 2 the screen is devided into into two seperate
* sections that are relative to the screen size. The top part to be
* used for displaying parameters takes 20% of the screen and the
* second section takes the remaining section of screen.
*   create the splitter container to divide the screen
    CREATE OBJECT EZ_SPLIT_CONTAINER
                  EXPORTING
                  PARENT = CUSTOM_CONTAINER
                  ORIENTATION = 0      " horizontal split
                  SASH_POSITION = 20.  " percent of top container
*   set the containers to the appropriate section of the screen
    TOP_CONTAINER = EZ_SPLIT_CONTAINER-%GTTOP_LEFT_CONTAINER.
    MAIN_CONTAINER = EZ_SPLIT_CONTAINER-%GTBOTTOM_RIGHT_CONTAINER.

  ELSEIF P_MODE = 'MODE3'.
* MODE3 - In mode 3 the screen is devided into into three seperate
* sections that are fixed sizes.  The top part to be
* used for displaying parameters takes 22 lines, the second takes 30
* lines and the third takes the remaining space in the screen
    CREATE OBJECT SPLITTER_CONTAINER
           EXPORTING
           PARENT = CUSTOM_CONTAINER
           ROWS = 3
           COLUMNS = 1.
    CALL METHOD SPLITTER_CONTAINER-%GTSET_BORDER
      EXPORTING
        BORDER = CL_GUI_CFW=%GTTRUE.
    CALL METHOD SPLITTER_CONTAINER-%GTSET_COLUMN_MODE
      EXPORTING
        MODE = SPLITTER_CONTAINER-%GTMODE_ABSOLUTE.
    CALL METHOD SPLITTER_CONTAINER-%GTSET_ROW_HEIGHT
      EXPORTING
        ID     = 1
        HEIGHT = C_TOP_HEIGHT.
    CALL METHOD SPLITTER_CONTAINER-%GTSET_ROW_HEIGHT
      EXPORTING
        ID     = 2
        HEIGHT = C_MAIN_HEIGHT.
    TOP_CONTAINER   =
      SPLITTER_CONTAINER-%GTGET_CONTAINER( ROW = 1 COLUMN = 1 ).
    MAIN_CONTAINER =
      SPLITTER_CONTAINER-%GTGET_CONTAINER( ROW = 2 COLUMN = 1 ).
    BOTTOM_CONTAINER =
      SPLITTER_CONTAINER-%GTGET_CONTAINER( ROW = 3 COLUMN = 1 ).

  ELSEIF P_MODE = 'MODE3B'.
* MODE3B - In this mode the screen is devided into three seperate
* sections that are relative to the screen size.  The top part to be
* used for displaying parameters takes 20% of the screen and the two
* other parts take equal amounts of the remaining space.
    CREATE OBJECT SPLITTER_CONTAINER
           EXPORTING
           PARENT = CUSTOM_CONTAINER
           ROWS = 3
           COLUMNS = 1.
    CALL METHOD SPLITTER_CONTAINER-%GTSET_BORDER
      EXPORTING
        BORDER = CL_GUI_CFW=%GTTRUE.
    CALL METHOD SPLITTER_CONTAINER-%GTSET_COLUMN_MODE
      EXPORTING
        MODE = SPLITTER_CONTAINER-%GTMODE_RELATIVE.
    CALL METHOD SPLITTER_CONTAINER-%GTSET_ROW_HEIGHT
      EXPORTING
        ID     = 1
        HEIGHT = 20.
    CALL METHOD SPLITTER_CONTAINER-%GTSET_ROW_HEIGHT
      EXPORTING
        ID     = 2
        HEIGHT = 38.
    TOP_CONTAINER   =
      SPLITTER_CONTAINER-%GTGET_CONTAINER( ROW = 1 COLUMN = 1 ).
    MAIN_CONTAINER =
      SPLITTER_CONTAINER-%GTGET_CONTAINER( ROW = 2 COLUMN = 1 ).
    BOTTOM_CONTAINER =
      SPLITTER_CONTAINER-%GTGET_CONTAINER( ROW = 3 COLUMN = 1 ).
  ENDIF.
ENDFORM.                    " setup_splitter_container

*&---------------------------------------------------------------------*
*&      Form  setup_splitter_container
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --%GT  p1        text
*  %LT--  p2        text
*----------------------------------------------------------------------*
FORM SETUP_SPLITTER_CONTAINER2 USING P_MODE TYPE STRING.
  CONSTANTS: C_TOP_HEIGHT  TYPE I VALUE 22,
             C_MAIN_HEIGHT TYPE I VALUE 50.

* create a custom container control
  CREATE OBJECT CUSTOM_CONTAINER2
      EXPORTING
          CONTAINER_NAME = G_CONTAINER_NAME2
      EXCEPTIONS
          CNTL_ERROR = 1
          CNTL_SYSTEM_ERROR = 2
          CREATE_ERROR = 3
          LIFETIME_ERROR = 4
          LIFETIME_DYNPRO_DYNPRO_LINK = 5.
  IF P_MODE = 'MODE1'.
    MAIN_CONTAINER2 = CUSTOM_CONTAINER2.

  ELSEIF P_MODE = 'MODE2'.
* MODE2 - In mode 2 the screen is devided into into two seperate
* sections that are relative to the screen size. The top part to be
* used for displaying parameters takes 20% of the screen and the
* second section takes the remaining section of screen.
*   create the splitter container to divide the screen
    CREATE OBJECT EZ_SPLIT_CONTAINER2
                  EXPORTING
                  PARENT = CUSTOM_CONTAINER2
                  ORIENTATION = 0      " horizontal split
                  SASH_POSITION = 20.  " percent of top container
*   set the containers to the appropriate section of the screen
    TOP_CONTAINER2 = EZ_SPLIT_CONTAINER2-%GTTOP_LEFT_CONTAINER.
    MAIN_CONTAINER2 = EZ_SPLIT_CONTAINER2-%GTBOTTOM_RIGHT_CONTAINER.

  ELSEIF P_MODE = 'MODE3'.
* MODE3 - In mode 3 the screen is devided into into three seperate
* sections that are fixed sizes.  The top part to be
* used for displaying parameters takes 22 lines, the second takes 30
* lines and the third takes the remaining space in the screen
    CREATE OBJECT SPLITTER_CONTAINER2
           EXPORTING
           PARENT = CUSTOM_CONTAINER2
           ROWS = 3
           COLUMNS = 1.
    CALL METHOD SPLITTER_CONTAINER2-%GTSET_BORDER
      EXPORTING
        BORDER = CL_GUI_CFW=%GTTRUE.
    CALL METHOD SPLITTER_CONTAINER2-%GTSET_COLUMN_MODE
      EXPORTING
        MODE = SPLITTER_CONTAINER2-%GTMODE_ABSOLUTE.
    CALL METHOD SPLITTER_CONTAINER2-%GTSET_ROW_HEIGHT
      EXPORTING
        ID     = 1
        HEIGHT = C_TOP_HEIGHT.
    CALL METHOD SPLITTER_CONTAINER2-%GTSET_ROW_HEIGHT
      EXPORTING
        ID     = 2
        HEIGHT = C_MAIN_HEIGHT.
    TOP_CONTAINER   =
      SPLITTER_CONTAINER2-%GTGET_CONTAINER( ROW = 1 COLUMN = 1 ).
    MAIN_CONTAINER =
      SPLITTER_CONTAINER2-%GTGET_CONTAINER( ROW = 2 COLUMN = 1 ).
    BOTTOM_CONTAINER =
      SPLITTER_CONTAINER2-%GTGET_CONTAINER( ROW = 3 COLUMN = 1 ).

  ELSEIF P_MODE = 'MODE3B'.
* MODE3B - In this mode the screen is devided into three seperate
* sections that are relative to the screen size.  The top part to be
* used for displaying parameters takes 20% of the screen and the two
* other parts take equal amounts of the remaining space.
    CREATE OBJECT SPLITTER_CONTAINER2
           EXPORTING
           PARENT = CUSTOM_CONTAINER2
           ROWS = 3
           COLUMNS = 1.
    CALL METHOD SPLITTER_CONTAINER2-%GTSET_BORDER
      EXPORTING
        BORDER = CL_GUI_CFW=%GTTRUE.
    CALL METHOD SPLITTER_CONTAINER2-%GTSET_COLUMN_MODE
      EXPORTING
        MODE = SPLITTER_CONTAINER2-%GTMODE_RELATIVE.
    CALL METHOD SPLITTER_CONTAINER2-%GTSET_ROW_HEIGHT
      EXPORTING
        ID     = 1
        HEIGHT = 20.
    CALL METHOD SPLITTER_CONTAINER2-%GTSET_ROW_HEIGHT
      EXPORTING
        ID     = 2
        HEIGHT = 38.
    TOP_CONTAINER   =
      SPLITTER_CONTAINER2-%GTGET_CONTAINER( ROW = 1 COLUMN = 1 ).
    MAIN_CONTAINER =
      SPLITTER_CONTAINER2-%GTGET_CONTAINER( ROW = 2 COLUMN = 1 ).
    BOTTOM_CONTAINER =
      SPLITTER_CONTAINER2-%GTGET_CONTAINER( ROW = 3 COLUMN = 1 ).
  ENDIF.
ENDFORM.                    " setup_splitter_container2
*&---------------------------------------------------------------------*
*&      Form  setup_alv_grid
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --%GT  p1        text
*  %LT--  p2        text
*----------------------------------------------------------------------*
FORM SETUP_ALV_GRID.
*   create an instance of alv control
  CREATE OBJECT GRID1
        EXPORTING I_PARENT = MAIN_CONTAINER.
  IF NOT G_STRUCTURE_NAME IS INITIAL.
    IF %LTGT_OUTPUT%GT IS ASSIGNED.
      CALL METHOD GRID1-%GTSET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME = G_STRUCTURE_NAME
          IS_VARIANT       = GS_VARIANT
          I_SAVE           = 'A'
          I_DEFAULT        = 'X'
          IS_PRINT         = GS_PRINT
          IS_LAYOUT        = GS_LAYOUT
        CHANGING
          IT_OUTTAB        = %LTGT_OUTPUT%GT
          IT_SORT          = GT_SORT.
    ELSE.
      CALL METHOD GRID1-%GTSET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME = G_STRUCTURE_NAME
          IS_VARIANT       = GS_VARIANT
          I_SAVE           = 'A'
          I_DEFAULT        = 'X'
          IS_PRINT         = GS_PRINT
          IS_LAYOUT        = GS_LAYOUT
        CHANGING
          IT_OUTTAB        = GT_OUTPUT[]
          IT_SORT          = GT_SORT.
    ENDIF.
  ELSE.
    IF %LTGT_OUTPUT%GT IS ASSIGNED.
      CALL METHOD GRID1-%GTSET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IS_VARIANT      = GS_VARIANT
          I_SAVE          = 'A'
          I_DEFAULT       = 'X'
          IS_PRINT        = GS_PRINT
          IS_LAYOUT       = GS_LAYOUT
        CHANGING
          IT_FIELDCATALOG = GT_FIELDCAT[]
          IT_OUTTAB       = %LTGT_OUTPUT%GT
          IT_SORT         = GT_SORT.
    ELSE.
      CALL METHOD GRID1-%GTSET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IS_VARIANT      = GS_VARIANT
          I_SAVE          = 'A'
          I_DEFAULT       = 'X'
          IS_PRINT        = GS_PRINT
          IS_LAYOUT       = GS_LAYOUT
        CHANGING
          IT_FIELDCATALOG = GT_FIELDCAT[]
          IT_OUTTAB       = GT_OUTPUT[]
          IT_SORT         = GT_SORT.
    ENDIF.
  ENDIF.
ENDFORM.                    " setup_alv_grid

*&---------------------------------------------------------------------*
*&      Form  setup_alv_grid
*&---------------------------------------------------------------------*
FORM SETUP_DYNAMIC_ALV_GRID.
*   create an instance of alv control
  CREATE OBJECT GRID1
        EXPORTING I_PARENT = MAIN_CONTAINER.
  IF NOT G_STRUCTURE_NAME IS INITIAL.
    CALL METHOD GRID1-%GTSET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
        I_STRUCTURE_NAME = G_STRUCTURE_NAME
        IS_VARIANT       = GS_VARIANT
        I_SAVE           = 'A'
        I_DEFAULT        = 'X'
        IS_PRINT         = GS_PRINT
        IS_LAYOUT        = GS_LAYOUT
      CHANGING
        IT_OUTTAB        = GT_OUTPUT[]
        IT_SORT          = GT_SORT.
  ELSE.
    CALL METHOD GRID1-%GTSET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
        IS_VARIANT      = GS_VARIANT
        I_SAVE          = 'A'
        I_DEFAULT       = 'X'
        IS_PRINT        = GS_PRINT
        IS_LAYOUT       = GS_LAYOUT
      CHANGING
        IT_FIELDCATALOG = GT_FIELDCAT[]
        IT_OUTTAB       = GT_OUTPUT[]
        IT_SORT         = GT_SORT.
  ENDIF.
ENDFORM.                    " setup_alv_grid

*&---------------------------------------------------------------------*
*&      Form  setup_screen_header
*&---------------------------------------------------------------------*
FORM SETUP_SCREEN_HEADER.
* create an instance of the document control
  CREATE OBJECT TEXT_BOX_TOP
    EXPORTING
       BACKGROUND_COLOR = 240.
  PERFORM CREATE_SCREEN_HEADER_MAN.
*  CALL METHOD text_box_top-%GTadd_picture
*    EXPORTING
*      picture_id       = 'ALV_BACKGROUND'
**      WIDTH            =
**      ALTERNATIVE_TEXT =
*      TABINDEX         = '2'
*      .
  CALL METHOD TEXT_BOX_TOP-%GTSET_DOCUMENT_BACKGROUND
    EXPORTING
      PICTURE_ID = 'ALV_BACKGROUND'.
* display the document in the upper container
  CALL METHOD TEXT_BOX_TOP-%GTDISPLAY_DOCUMENT
    EXPORTING
      PARENT             = TOP_CONTAINER
    EXCEPTIONS
      HTML_DISPLAY_ERROR = 1
      OTHERS             = 2.

*CAMO_COL_1594_735
ENDFORM.                    " setup_screen_header
*&---------------------------------------------------------------------*
*&      Form  set_event_handlers
*&---------------------------------------------------------------------*
FORM SET_EVENT_HANDLERS.
* Create Object to receive events and link them to handler methods.
* When the ALV Control raises the event for the specified instance
* the corresponding method is automatically called.
  CREATE OBJECT EVENT_RECEIVER.
  SET HANDLER EVENT_RECEIVER-%GTHANDLE_TOP_OF_LIST FOR GRID1.
  SET HANDLER EVENT_RECEIVER-%GTHANDLE_TOP_OF_PAGE FOR GRID1.
  SET HANDLER EVENT_RECEIVER-%GTHANDLE_END_OF_LIST FOR GRID1.
  SET HANDLER EVENT_RECEIVER-%GTHANDLE_END_OF_PAGE FOR GRID1.
  SET HANDLER EVENT_RECEIVER-%GTHANDLE_DOUBLE_CLICK FOR GRID1.
  SET HANDLER EVENT_RECEIVER-%GTHANDLE_DATA_CHANGED FOR GRID1.
  SET HANDLER EVENT_RECEIVER-%GTHANDLE_DATA_CHANGED_FINISHED FOR GRID1.
ENDFORM.                    " set_event_handlers
*&--------------------------------------------------------------------*
*&      Form  SET_MODIFIABLE_GRID
*&--------------------------------------------------------------------*
FORM SET_MODIFIABLE_GRID.
* this method will trigger the changed_data event as soon as the data
* is changed.  Without this method the changed_data event is only
* triggered when a second field is modified
  CALL METHOD GRID1-%GTREGISTER_EDIT_EVENT
    EXPORTING
      I_EVENT_ID = CL_GUI_ALV_GRID=%GTMC_EVT_ENTER.
ENDFORM.                    "SET_MODIFIABLE_GRID

****************************************************************
* LOCAL CLASSES: Implementation
****************************************************************
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
  METHOD HANDLE_TOP_OF_PAGE.
    IF NOT SY-PAGNO = 1.
      PERFORM OUTPUT_PAGE_HEADER
           USING G_REPORT_NAME
                 ''.
    ENDIF.
  ENDMETHOD.                           "handle_top_of_page
*-------------------------------------------
  METHOD HANDLE_END_OF_PAGE.
  ENDMETHOD.                           "handle_end_of_page
*-------------------------------------------
  METHOD HANDLE_TOP_OF_LIST.
    PERFORM PRINT_LIST_HEADER.
  ENDMETHOD.                           "handle_top_of_list
*-------------------------------------------
  METHOD HANDLE_END_OF_LIST.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = IT_LIST_COMMENTARY
        I_LOGO                   = 'CAMO_COL_1594_735'
*       I_END_OF_LIST_GRID       =
              .
  ENDMETHOD.                           "handle_end_of_list
*-------------------------------------------
  METHOD HANDLE_DOUBLE_CLICK.
  ENDMETHOD.                           "handle_double_click
*-------------------------------------------
  METHOD HANDLE_DATA_CHANGED.
  ENDMETHOD.                    "handle_data_changed
  METHOD HANDLE_DATA_CHANGED_FINISHED.
    DATA: LT_GOOD          LIKE LINE OF ET_GOOD_CELLS,
          WA_OUTPUT        LIKE LINE OF GT_OUTPUT,
          L_FIELDNAME1(60) TYPE C,
          L_FIELDNAME2(30) TYPE C.
    FIELD-SYMBOLS: %LTFS1%GT TYPE ANY,
                   %LTFS2%GT TYPE ANY.
    IF NOT E_MODIFIED IS INITIAL.
      LOOP AT ET_GOOD_CELLS INTO LT_GOOD.
        CONCATENATE 'wa_output-' LT_GOOD-FIELDNAME INTO L_FIELDNAME1.
        ASSIGN (L_FIELDNAME1) TO %LTFS1%GT.
        L_FIELDNAME2 = LT_GOOD-FIELDNAME.
        SHIFT LT_GOOD-VALUE LEFT DELETING LEADING SPACE.
        %LTFS1%GT = LT_GOOD-VALUE.
        MODIFY GT_OUTPUT INDEX LT_GOOD-ROW_ID FROM WA_OUTPUT
               TRANSPORTING (L_FIELDNAME2).
      ENDLOOP.
    ENDIF.
  ENDMETHOD.                    "HANDLE_DATA_CHANGED_FINISHED
ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
************************************************************************
* INITIALIZATION
************************************************************************
INITIALIZATION.
  G_REPORT_NAME        = TEXT-002.
  G_CONTAINER_NAME     = 'CONTAINER1'.
* g_structure_name     = 'ZPPLAN_DOWNL_UPL_STRUCT1'.
  G_REPID              = SY-REPID.
  GS_PRINT-RESERVELNS  = '2'.    "reserved lines for end of page
  GS_LAYOUT-CWIDTH_OPT = 'X'.    "optimize column width flag
  GS_LAYOUT-ZEBRA      = 'X'.    "zebra color patern
* DI1K907032 Madhu 20/08/2008 - Begin - PP-0414 - for customized style
  GS_LAYOUT-STYLEFNAME = 'XYZSTYLEZYX'.
* DI1K907032 Madhu 20/08/2008 - End
  GS_VARIANT-REPORT    = G_REPORT_NAME.
  S_BWART-LOW = '261'.
  S_BWART-SIGN = 'I'.
  S_BWART-OPTION = 'EQ'.
  APPEND S_BWART.
  S_BWART-LOW = '262'.
  S_BWART-SIGN = 'I'.
  S_BWART-OPTION = 'EQ'.
  APPEND S_BWART.
  S_BWART-LOW = '551'.
  S_BWART-SIGN = 'I'.
  S_BWART-OPTION = 'EQ'.
  APPEND S_BWART.
  S_BWART-LOW = '552'.
  S_BWART-SIGN = 'I'.
  S_BWART-OPTION = 'EQ'.
  APPEND S_BWART.
  S_BWART-LOW = '553'.
  S_BWART-SIGN = 'I'.
  S_BWART-OPTION = 'EQ'.
  APPEND S_BWART.
  S_BWART-LOW = '554'.
  S_BWART-SIGN = 'I'.
  S_BWART-OPTION = 'EQ'.
  APPEND S_BWART.
  S_BWART-LOW = '555'.
  S_BWART-SIGN = 'I'.
  S_BWART-OPTION = 'EQ'.
  APPEND S_BWART.
  S_BWART-LOW = '556'.
  S_BWART-SIGN = 'I'.
  S_BWART-OPTION = 'EQ'.
  APPEND S_BWART.
  S_BWART-LOW = '543'.
  S_BWART-SIGN = 'I'.
  S_BWART-OPTION = 'EQ'.
  APPEND S_BWART.
  S_BWART-LOW = '544'.
  S_BWART-SIGN = 'I'.
  S_BWART-OPTION = 'EQ'.
  APPEND S_BWART.
* Pour restreindre aux administrateurs seulement (incluant BATCH)
* PERFORM superuser(zssecur1) USING 'X'.
* Verifie si l'utilisateur a acces au programme
*  PERFORM transaction_check(zssecur1) USING sy-tcode.
*
************************************************************************
* START-OF-SELECTION
************************************************************************
START-OF-SELECTION.
  IF NOT RB_DOWNL IS INITIAL.
*   DOWNLOAD
* Everybody will have access in DL mode
*    AUTHORITY-CHECK OBJECT 'ZM_ZMM02_D'
*           ID 'ACTVT' FIELD 'DL'.
*    IF sy-subrc NE 0.
*      MESSAGE text-102 TYPE 'I'.
*      LEAVE LIST-PROCESSING.
*    endif.
* DI1K907032 Madhu 20/08/2008 - Begin - PP-0414 - for exploding the bom
    PERFORM EXPLODE_ACTIVE_BOMS.
* DI1K907032 Madhu 20/08/2008 - End
    PERFORM GET_MATERIAL_LIST.
    PERFORM GET_MATERIAL_PLANT_DATA.
* DI1K907032 Madhu 20/08/2008 - Begin - PP-0414 - for creating & filling
* dynamic table
    PERFORM CREATE_DYNAMIC_TABLE.
    PERFORM FILL_DYNAMIC_COLUMNS.
* DI1K907032 Madhu 20/08/2008 - End
    IF SY-BATCH EQ 'X'.
      PERFORM EXPORT_TO_EXCEL.
    ELSE.
      CALL SCREEN 100.
    ENDIF.
  ELSE.
*   UPLOAD

    AUTHORITY-CHECK OBJECT 'ZM_ZMM02_D'
           ID 'ACTVT' FIELD 'UL'.
    IF SY-SUBRC NE 0.
      MESSAGE TEXT-102 TYPE 'I'.
      LEAVE LIST-PROCESSING.
    ENDIF.
    IF NOT S_BESKZ-LOW CO 'F'.
      MESSAGE TEXT-101 TYPE 'I'.
      LEAVE LIST-PROCESSING.
    ENDIF.
    PERFORM UPLOAD_EXCEL_FILE.
    IF SY-BATCH EQ 'X'.
      PERFORM UPLOAD_MODIFICATIONS.
    ELSE.
* DI1K907032 Madhu 20/08/2008 - Begin - PP-0414 - for creating & filling
* dynamic table
      PERFORM CREATE_DYNAMIC_TABLE.
* DI1K907032 Madhu 20/08/2008 - End
      CALL SCREEN 100.
    ENDIF.
  ENDIF.
END-OF-SELECTION.

*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'STATUS_100'.
  SET TITLEBAR 'TITLE_100'.
  IF CUSTOM_CONTAINER IS INITIAL.
    PERFORM SETUP_SPLITTER_CONTAINER USING 'MODE2'.
    PERFORM SETUP_FIELDCAT.
    PERFORM SET_CUSTOM_EDITABLE_GRID.
    PERFORM SETUP_ALV_GRID.
    PERFORM SETUP_SCREEN_HEADER.
    PERFORM SET_EVENT_HANDLERS.
    PERFORM SET_EVENT_HANDLERS_LOCAL.
    PERFORM SET_MODIFIABLE_GRID.
  ENDIF.    "IF custom_container IS INITIAL

* Controls are not integrated into the TAB-Order
* Call "set_focus" if you want to make sure that 'the cursor'
* is active in your control.
  CALL METHOD CL_GUI_CONTROL=%GTSET_FOCUS
    EXPORTING
      CONTROL = GRID1.
ENDMODULE.                 " STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
  DATA: OK_CODE LIKE SY-UCOMM,
        E_VALID TYPE CHAR01.
  CALL METHOD GRID1-%GTCHECK_CHANGED_DATA
    IMPORTING
      E_VALID = E_VALID.
  IF E_VALID = 'X'.
    MOVE SY-UCOMM TO OK_CODE.
    CASE OK_CODE.
      WHEN 'EXIT'.
        PERFORM EXIT_PROGRAM.
      WHEN 'BACK'.
        LEAVE TO SCREEN 0.
      WHEN 'CMD_UPLOAD'.
*        AUTHORITY-CHECK OBJECT 'ZM_ZMM02_D'
*         ID 'ACTVT' FIELD 'UL'.
*        IF sy-subrc NE 0.
*          MESSAGE text-102 TYPE 'I'.
*          RETURN.
*        ENDIF.
        PERFORM UPLOAD_MODIFICATIONS.
      WHEN 'DLEXCEL'.
        PERFORM EXPORT_TO_EXCEL.
    ENDCASE.
  ENDIF.
  CLEAR OK_CODE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

*&---------------------------------------------------------------------*
*&      Form  exit_program
*&---------------------------------------------------------------------*
FORM EXIT_PROGRAM.
  CALL METHOD CUSTOM_CONTAINER-%GTFREE.
  CALL METHOD CL_GUI_CFW=%GTFLUSH.
  IF SY-SUBRC NE 0.
    CALL FUNCTION 'POPUP_TO_INFORM'
      EXPORTING
        TITEL = G_REPID
        TXT2  = SY-SUBRC
        TXT1  = 'Error in Flush(009) - contact support'.
  ENDIF.
  LEAVE PROGRAM.
ENDFORM.                    "exit_program

*&---------------------------------------------------------------------*
*&  Include           ZPIPLANNING_DOWNL_UPL_INC1
*&---------------------------------------------------------------------*
*----------------------------------------------------------------------*
***INCLUDE ZPIPLANNING_DOWNL_UPL_INC1 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  get_material_plant_data
*&---------------------------------------------------------------------*
FORM GET_MATERIAL_PLANT_DATA .
  IF NOT P_LGNUM IS INITIAL.
    SELECT MATNR FROM MLGN INTO TABLE GT_MLGN
                                 FOR ALL ENTRIES IN IT_MATNR_LIST
                                 WHERE MATNR = IT_MATNR_LIST-MATNR
                                   AND LGNUM = P_LGNUM.
    IT_MATNR_LIST[] = GT_MLGN[].
  ENDIF.

  LOOP AT IT_MATNR_LIST ASSIGNING %LTFS_MATNR_LIST%GT.
    PERFORM GET_MATERIAL_DATA.

    IF NOT S_WERKS IS INITIAL.
      DELETE IT_MARC FROM 1
       WHERE NOT WERKS IN S_WERKS.
    ENDIF.
    LOOP AT IT_MARC ASSIGNING %LTFS_MARC%GT.
      CLEAR WA_IMP_EXP.
* DI1K907032 Madhu 03/09/2008 - Begin - PP-0414 - Fetching DChain spec
* status.
      PERFORM GET_SALES_STATUS.
      IF WA_IMP_EXP-VMSTA IS INITIAL.
        CONTINUE.
      ENDIF.
* DI1K907032 Madhu 20/08/2008 - End
      PERFORM GET_INFO_RECORD_DATA.
      PERFORM GET_MRP_DATA.
      PERFORM GET_PRICE_DATA.
      PERFORM GET_CLASSIFICATION_DATA.
      PERFORM READ_MAT_MASTER_DATA.
      PERFORM READ_MATERIAL_TEXTS.
      PERFORM READ_PLANT_MATERIAL_DATA.
* DI1K907032 Madhu 20/08/2008 - Begin - PP-0414 - Fetching Warehouse,
* Classification,
*                                      Consumption, SupplyArea details.
      PERFORM GET_WAREHOUSE_DATA.
      PERFORM GET_CLASSIFICATION.
      PERFORM GET_CONSUMPTION.
      PERFORM GET_SUPPLY_AREA.
* DI1K907032 Madhu 20/08/2008 - End
* DI1K907032 Madhu 20/08/2008 - Begin - PP-0414 - Commented as
* gt_imp_exp is already filling in get_supply_area
*
*      APPEND wa_imp_exp TO gt_imp_exp.
* DI1K907032 Madhu 20/08/2008 - End of comment
    ENDLOOP.
  ENDLOOP.

  IF GT_OUTPUT[] IS INITIAL.
    GT_OUTPUT[] = GT_IMP_EXP.
  ENDIF.
ENDFORM.                    " get_material_plant_data

*&---------------------------------------------------------------------*
*&      Form  get_info_record_data
*&---------------------------------------------------------------------*
FORM GET_INFO_RECORD_DATA .
  DATA: L_ESOKZ TYPE ESOKZ,
        L_KONP  TYPE KONP.
  DATA: L_TEXT1(70) TYPE C,
        L_TEXT2(70) TYPE C,
        L_LINES TYPE I.
  DATA: L_PLNNR TYPE MAPL-PLNNR,
        L_BESKZ TYPE MARC-BESKZ,
        L_ARBID TYPE PLPO-ARBID.
  G_INFOREC_FOUND = 0.
  G_INFOREC_COND_FOUND = 0.
* DI1K907032 Madhu 20/08/2008 - Begin - PP-0414 - Fetching the
* SupplyArea for supplier for 'E' Procurement type.
  SELECT SINGLE BESKZ FROM MARC INTO L_BESKZ WHERE MATNR =
%LTFS_MARC%GT-MATNR
                                               AND WERKS =
%LTFS_MARC%GT-WERKS.
  IF L_BESKZ = 'E'.
    CLEAR WA_BOM_COMP.
    READ TABLE GT_BOM_COMP INTO WA_BOM_COMP WITH KEY MAT_COMP =
%LTFS_MARC%GT-MATNR.
    IF SY-SUBRC EQ 0.
      SELECT SINGLE PLNNR FROM MAPL INTO L_PLNNR WHERE MATNR =
  WA_BOM_COMP-MAT_BOM
                                                   AND WERKS IN S_WERKS.
      SELECT PLNAL STATU DATUV FROM PLKO INTO TABLE GT_PLKO
                                      WHERE PLNNR = L_PLNNR
                                        AND PLNTY = 'N'.
      CLEAR WA_PLKO.
      LOOP AT GT_PLKO INTO WA_PLKO WHERE STATU = '4'
                                 AND DATUV %LT= SY-DATUM.
        EXIT.
      ENDLOOP.

      SELECT PLNKN FROM PLAS INTO TABLE GT_PLAS WHERE PLNTY = 'N'
                                                  AND PLNNR = L_PLNNR
                                                  AND PLNAL =
  WA_PLKO-PLNAL
                                                  AND LOEKZ NE 'X'.
      DESCRIBE TABLE GT_PLAS LINES L_LINES.
      CLEAR WA_PLAS.
      READ TABLE GT_PLAS INTO WA_PLAS INDEX L_LINES.
      SELECT SINGLE ARBID FROM PLPO INTO L_ARBID
                    WHERE PLNTY = 'N'
                      AND PLNNR = L_PLNNR
                      AND PLNKN = WA_PLAS-PLNKN.

      SELECT SINGLE ARBPL FROM CRHD
             INTO WA_IMP_EXP-LIFNR WHERE OBJTY = 'A'
                                     AND OBJID = L_ARBID.
      SELECT SINGLE KTEXT FROM CRTX INTO WA_IMP_EXP-NAME1 WHERE OBJTY =
  'A'
                                                            AND OBJID =
  L_ARBID
                                                            AND SPRAS =
  SY-LANGU.
    ENDIF.
* DI1K907032 Madhu 20/08/2008 - End
  ELSE.
    REFRESH IT_EORD.
    CALL FUNCTION 'MD_CHECK_SINGLE_SOURCE'
      EXPORTING
        MATNR         = %LTFS_MARC%GT-MATNR
        WERK          = %LTFS_MARC%GT-WERKS
        DATUM         = SY-DATUM
*     ORDCK         =
*   IMPORTING
*     SINGLE        =
      TABLES
        EORDX         = IT_EORD.
* Kevin Norris 2008/04/29 - MM-0236
* we now want to manage autet 1 and 2 since
* GRBY is now using scheduling agreements
    IF NOT IT_EORD IS INITIAL.
*    DELETE it_eord
*      FROM 1
*     WHERE NOT flifn = 'X'
*        or not ( autet = '1' or
*                 autet = '2' ).
      DELETE IT_EORD
        FROM 1
       WHERE ( AUTET %LT 1 ) OR
             ( AUTET = '1' AND NOT FLIFN = 'X' ) OR
             ( AUTET = '2' AND NOT FEBEL = 'X').
      DESCRIBE TABLE IT_EORD LINES SY-TABIX.
      IF SY-TABIX %GT 0.
        READ TABLE IT_EORD ASSIGNING %LTFS_EORD%GT INDEX 1.
        CLEAR WA_LFA1.
        CALL FUNCTION 'LFA1_READ_SINGLE'
          EXPORTING
            ID_LIFNR            = %LTFS_EORD%GT-LIFNR
          IMPORTING
            ES_LFA1             = WA_LFA1
          EXCEPTIONS
            NOT_FOUND           = 1
            INPUT_NOT_SPECIFIED = 2
            OTHERS              = 3.
        IF SY-SUBRC %LT%GT 0.
*        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ELSE.
          WA_IMP_EXP-LIFNR = %LTFS_EORD%GT-LIFNR.
          WA_IMP_EXP-NAME1 = WA_LFA1-NAME1.
          WA_IMP_EXP-LAND1 = WA_LFA1-LAND1.
          WA_IMP_EXP-REGIO = WA_LFA1-REGIO.
* DI1K907032 Madhu 20/08/2008 - Begin - PP-0414 - Fetching Vendor
* details
          WA_IMP_EXP-ORT01 = WA_LFA1-ORT01.
          WA_IMP_EXP-STRAS = WA_LFA1-STRAS.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              INPUT  = %LTFS_EORD%GT-LIFNR
            IMPORTING
              OUTPUT = %LTFS_EORD%GT-LIFNR.

          SELECT TDSPRAS FROM STXH INTO TABLE GT_STXH
                              WHERE TDOBJECT = 'LFA1'
                                AND TDNAME = %LTFS_EORD%GT-LIFNR
                                AND TDID = '0003'.
          IF SY-SUBRC EQ 0.
            REFRESH GT_TLINE.
            CLEAR : WA_TLINE, WA_STXH, L_TEXT1, L_TEXT2.
            READ TABLE GT_STXH INTO WA_STXH INDEX 1.
            MOVE %LTFS_EORD%GT-LIFNR TO L_TEXT1.
            CALL FUNCTION 'READ_TEXT'
              EXPORTING
                CLIENT   = SY-MANDT
                ID       = '0003'
                LANGUAGE = WA_STXH-TDSPRAS
                NAME     = L_TEXT1
                OBJECT   = 'LFA1'
              TABLES
                LINES    = GT_TLINE.
            READ TABLE GT_TLINE INTO WA_TLINE INDEX 1.
            CLEAR : L_TEXT1 , L_TEXT2.
            SPLIT WA_TLINE-TDLINE AT ' ' INTO L_TEXT1 L_TEXT2.
            SPLIT L_TEXT2 AT ' ' INTO L_TEXT1 L_TEXT2.
            SELECT TDSPRAS FROM STXH INTO TABLE GT_STXH
                          WHERE TDOBJECT = 'TEXT'
                            AND TDNAME = L_TEXT1
                            AND TDID = 'ST'.
            IF SY-SUBRC EQ 0.
              DESCRIBE TABLE GT_STXH LINES L_LINES.
              REFRESH GT_TLINE.
              CLEAR : WA_STXH, WA_TLINE.
              IF L_LINES EQ 1.
                READ TABLE GT_STXH INTO WA_STXH INDEX 1.
              ELSE.
                READ TABLE GT_STXH INTO WA_STXH WITH KEY TDSPRAS =
SY-LANGU.
              ENDIF.
              CALL FUNCTION 'READ_TEXT'
                EXPORTING
                  CLIENT   = SY-MANDT
                  ID       = 'ST'
                  LANGUAGE = WA_STXH-TDSPRAS
                  NAME     = L_TEXT1
                  OBJECT   = 'TEXT'
                TABLES
                  LINES    = GT_TLINE.
              READ TABLE GT_TLINE INTO WA_TLINE INDEX 1.
              WA_IMP_EXP-CARRIER1 = WA_TLINE-TDLINE.
              CLEAR WA_TLINE.
              READ TABLE GT_TLINE INTO WA_TLINE INDEX 2.
              WA_IMP_EXP-CARRIER2 = WA_TLINE-TDLINE.
            ENDIF.
          ENDIF.
* DI1K907032 Madhu 20/08/2008 - End
        ENDIF.
        CLEAR WA_EINA.
        CALL FUNCTION 'ME_EINA_SINGL_READ_MATNR_LIFNR'
          EXPORTING
            PI_MATNR               = %LTFS_MARC%GT-MATNR
            PI_LIFNR               = %LTFS_EORD%GT-LIFNR
*         RELIF_ONLY             =
*         REFRESH_BUFFER         =
          IMPORTING
            PO_EINA                = WA_EINA
          EXCEPTIONS
            NO_RECORDS_FOUND       = 1
            OTHERS                 = 2.
        IF SY-SUBRC %LT%GT 0.
*       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ELSE.
          WA_IMP_EXP-MAHN1 = WA_EINA-MAHN1.
          WA_IMP_EXP-MAHN2 = WA_EINA-MAHN2.
          WA_IMP_EXP-MAHN3 = WA_EINA-MAHN3.
          G_INFOREC_FOUND = 1.
        ENDIF.
        IF %LTFS_MARC%GT-SOBSL = 'SC'.
          L_ESOKZ = '3'.
        ELSE.
          L_ESOKZ = '0'.
        ENDIF.
        REFRESH IT_EINE.
        CALL FUNCTION 'SELECT_EINE_ALL_FIELDS_FOR'
          EXPORTING
            I_SELECT_TYPE           = '1'
            IS_INFNR                = 'X'
            I_INFNR                 = WA_EINA-INFNR
            IS_EKORG                = 'X'
            I_EKORG                 = %LTFS_EORD%GT-EKORG
            IS_ESOKZ                = 'X'
            I_ESOKZ                 = L_ESOKZ
*         IS_WERKS                =
*         I_WERKS                 =
*         I_REALLY_EXIST          =
            I_BYPASS                = 'X'
          TABLES
*         T_WHERE_CLAUSE_IN       =
            T_EINE                  = IT_EINE
        CHANGING
          DB_COUNT                = SY-TABIX
        EXCEPTIONS
          NOT_FOUND               = 1
          ERROR_IN_SELECT         = 2
          OTHERS                  = 3.
        IF SY-SUBRC %LT%GT 0.
*       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ELSE.
          CLEAR WA_EINE.
          READ TABLE IT_EINE INTO WA_EINE INDEX 1.
          WA_IMP_EXP-PLIFZ = WA_EINE-APLFZ.
          WA_IMP_EXP-EKGRP = WA_EINE-EKGRP.
          WA_IMP_EXP-ACKNO = WA_EINE-KZABS.
        ENDIF.
        REFRESH IT_A018.
        SELECT DATAB DATBI KNUMH
          FROM A018
          INTO (WA_A018-DATAB, WA_A018-DATBI, WA_A018-KNUMH)
         WHERE KAPPL = 'M'
           AND KSCHL = 'PB00'
           AND LIFNR = %LTFS_EORD%GT-LIFNR
           AND MATNR = %LTFS_MARC%GT-MATNR.
          APPEND WA_A018 TO IT_A018.
        ENDSELECT.
        IF NOT IT_A018[] IS INITIAL.
          G_INFOREC_COND_FOUND = 1.
        ENDIF.
* if no conditions exist in validity dates, select the last valid
* condition
        IT_A018_TMP[] = IT_A018.
        DELETE IT_A018_TMP FROM 1
         WHERE NOT DATAB %LT= SY-DATUM
            OR NOT DATBI %GT= SY-DATUM.
        DESCRIBE TABLE IT_A018_TMP LINES SY-TABIX.
        IF SY-TABIX = 0.
          IT_A018_TMP[] = IT_A018.
        ENDIF.
        DESCRIBE TABLE IT_A018_TMP LINES SY-TABIX.
        IF SY-TABIX %GT 0.
          REFRESH: IT_CONDNUM, IT_KONP, IT_CONDSCALE.
          CLEAR WA_CONDNUM.
          SORT IT_A018_TMP BY DATBI DESCENDING.
          READ TABLE IT_A018_TMP INTO WA_A018 INDEX 1.
          IF SY-SUBRC = 0.
            WA_CONDNUM-SIGN   = 'I'.
            WA_CONDNUM-OPTION = 'EQ'.
            WA_CONDNUM-LOW    = WA_A018-KNUMH.
            APPEND WA_CONDNUM TO IT_CONDNUM.
          ENDIF.
          CALL FUNCTION 'SD_KONP_SELECT'
            EXPORTING
              SCALE_READ             = 'X'
*           LONG_TEXT_READ         = 'X'
            TABLES
             CONDITION_ITEM         = IT_KONP
             CONDITION_NUMBER       = IT_CONDNUM
             CONDITION_SCALE        = IT_CONDSCALE.
          DELETE IT_KONP FROM 1
           WHERE NOT LOEVM_KO IS INITIAL.

* get setup price
          LOOP AT IT_KONP ASSIGNING %LTFS_CONP%GT WHERE KSCHL = 'ZAD2'.
            WA_IMP_EXP-SETUP = %LTFS_CONP%GT-KBETR.
            IF NOT %LTFS_CONP%GT-KONWS = 'CAD'.
              PERFORM CONVERT_CURRENCY USING %LTFS_CONP%GT-KBETR
                                             %LTFS_CONP%GT-KONWA
                                       CHANGING WA_IMP_EXP-SETUP.
            ENDIF.
            EXIT.
          ENDLOOP.
* get treatment costs
          LOOP AT IT_KONP ASSIGNING %LTFS_CONP%GT WHERE KSCHL = 'ZAD6'.
            WA_IMP_EXP-TRAITM = %LTFS_CONP%GT-KBETR.
            IF NOT %LTFS_CONP%GT-KONWS = 'CAD'.
              PERFORM CONVERT_CURRENCY USING %LTFS_CONP%GT-KBETR
                                             %LTFS_CONP%GT-KONWA
                                       CHANGING WA_IMP_EXP-TRAITM.
            ENDIF.
            EXIT.
          ENDLOOP.
* get condition price
          LOOP AT IT_KONP ASSIGNING %LTFS_CONP%GT WHERE KSCHL = 'PB00'.
            WA_IMP_EXP-VERPR = %LTFS_CONP%GT-KBETR.
            WA_IMP_EXP-PEINH = %LTFS_CONP%GT-KPEIN.
            WA_IMP_EXP-BSTME = %LTFS_CONP%GT-MEINS.
            IF NOT %LTFS_CONP%GT-KONWS = 'CAD'.
              PERFORM CONVERT_CURRENCY USING %LTFS_CONP%GT-KBETR
                                             %LTFS_CONP%GT-KONWA
                                       CHANGING WA_IMP_EXP-VERPR.
            ENDIF.
* PRICE IN BASE UNIT OF MEASURE
            WA_IMP_EXP-VERPR_UOM = ( WA_IMP_EXP-VERPR *
                                     WA_EINA-UMREN ) /
                                     %LTFS_CONP%GT-KPEIN /
                                     WA_EINA-UMREZ.
* validate if scales exist
            READ TABLE IT_CONDSCALE INTO WA_CONDSCALE WITH KEY
              KNUMH = %LTFS_CONP%GT-KNUMH
              KOPOS = %LTFS_CONP%GT-KOPOS.
            IF SY-SUBRC = 0.
              WA_IMP_EXP-KOSTKZ = 'X'.
            ELSE.
              WA_IMP_EXP-KOSTKZ = ' '.
            ENDIF.
            EXIT.
          ENDLOOP.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
ENDFORM.                    " get_info_record_data

*&---------------------------------------------------------------------*
*&      Form  read_mat_master_data
*&---------------------------------------------------------------------*
FORM READ_MAT_MASTER_DATA .
  WA_IMP_EXP-MEINS = WA_MARA-MEINS.
  WA_IMP_EXP-BISMT = WA_MARA-BISMT.
  WA_IMP_EXP-LABOR = WA_MARA-LABOR.
  WA_IMP_EXP-BRGEW = WA_MARA-BRGEW.
  WA_IMP_EXP-GEWEI = WA_MARA-GEWEI.
  WA_IMP_EXP-NTGEW = WA_MARA-NTGEW.
  WA_IMP_EXP-GROES = WA_MARA-GROES.
  WA_IMP_EXP-VOLUM = WA_MARA-VOLUM.
  WA_IMP_EXP-VOLEH = WA_MARA-VOLEH.
  WA_IMP_EXP-EKWSL = WA_MARA-EKWSL.
* DI1K907032 Madhu 20/08/2008 - Begin - PP-0414 - Filling additional
* Material details
  WA_IMP_EXP-NORMT = WA_MARA-NORMT.
  WA_IMP_EXP-MFRPN = WA_MARA-MFRPN.
  WA_IMP_EXP-FERTH = WA_MARA-FERTH.
* DI1K907032 Madhu 20/08/2008 - End

  IF G_INFOREC_FOUND = 0.
* Reminder 1
    IF WA_IMP_EXP-MAHN1 IS INITIAL.
      WA_IMP_EXP-MAHN1 = WA_T405-MAHN1.
    ENDIF.
* Reminder 2
    IF WA_IMP_EXP-MAHN2 IS INITIAL.
      WA_IMP_EXP-MAHN2 = WA_T405-MAHN2.
    ENDIF.
* Reminder 3
    IF WA_IMP_EXP-MAHN3 IS INITIAL.
      WA_IMP_EXP-MAHN3 = WA_T405-MAHN3.
    ENDIF.
* Ackno required
    IF WA_IMP_EXP-ACKNO IS INITIAL.
      WA_IMP_EXP-ACKNO = WA_T405-KZABS.
    ENDIF.
    IF WA_IMP_EXP-BSTME IS INITIAL.
      WA_IMP_EXP-BSTME = WA_MARA-BSTME.
    ENDIF.
  ENDIF.
ENDFORM.                    " get_mat_master_data

*&---------------------------------------------------------------------*
*&      Form  read_plant_material_data
*&---------------------------------------------------------------------*
FORM READ_PLANT_MATERIAL_DATA .
  IF G_INFOREC_FOUND = 0.
    IF WA_IMP_EXP-PLIFZ IS INITIAL.
      WA_IMP_EXP-PLIFZ = %LTFS_MARC%GT-PLIFZ. " GR Lead Time
    ENDIF.
    IF WA_IMP_EXP-EKGRP IS INITIAL.
      WA_IMP_EXP-EKGRP = %LTFS_MARC%GT-EKGRP. " Buyer
    ENDIF.
  ENDIF.
  WA_IMP_EXP-WERKS = %LTFS_MARC%GT-WERKS. " Plant
  WA_IMP_EXP-MATNR = %LTFS_MARC%GT-MATNR. " Material
  WA_IMP_EXP-DISPO = %LTFS_MARC%GT-DISPO. " MRP Controller
  WA_IMP_EXP-MMSTA = %LTFS_MARC%GT-MMSTA. " Plant-Specific Material Status
  WA_IMP_EXP-WEBAZ = %LTFS_MARC%GT-WEBAZ. " GR Lead Time
  WA_IMP_EXP-EISBE = %LTFS_MARC%GT-EISBE. " Safty Stock
  WA_IMP_EXP-EISLO = %LTFS_MARC%GT-EISLO. " Min Safty stock
  WA_IMP_EXP-DISMM = %LTFS_MARC%GT-DISMM. " MRP Type
  WA_IMP_EXP-SHZET = %LTFS_MARC%GT-SHZET. " Safty Time
  WA_IMP_EXP-SHFLG = %LTFS_MARC%GT-SHFLG. " Safty Time indicator
  WA_IMP_EXP-MAABC = %LTFS_MARC%GT-MAABC. " ABC Code
  WA_IMP_EXP-DISGR = %LTFS_MARC%GT-DISGR. " MRP Group
  WA_IMP_EXP-MRPPP = %LTFS_MARC%GT-MRPPP. " Planning Calendar
  WA_IMP_EXP-RWPRO = %LTFS_MARC%GT-RWPRO. " Coverage Profile
  WA_IMP_EXP-BSTRF = %LTFS_MARC%GT-BSTRF. " Rounding Value
  WA_IMP_EXP-DISLS = %LTFS_MARC%GT-DISLS. " Lot Size
  WA_IMP_EXP-BSTMI = %LTFS_MARC%GT-BSTMI. " Min. Lot Size
  WA_IMP_EXP-SOBSL = %LTFS_MARC%GT-SOBSL. " Spec. Proc. Type
  WA_IMP_EXP-BESKZ = %LTFS_MARC%GT-BESKZ. " Procurement Type
  WA_IMP_EXP-QMATV = %LTFS_MARC%GT-QMATV. " Inspection Setup
  WA_IMP_EXP-SCHGT = %LTFS_MARC%GT-SCHGT. " Bulk Indicator
  WA_IMP_EXP-EKGRP = %LTFS_MARC%GT-EKGRP. " Purchasing Group
* DI1K907032 Madhu 20/08/2008 - Begin - PP-0414 - Filling additional
* plant details
  WA_IMP_EXP-BSTMA = %LTFS_MARC%GT-BSTMA. " Maximum lot size
  WA_IMP_EXP-MINBE = %LTFS_MARC%GT-MINBE. " Reorder Point
  WA_IMP_EXP-MABST = %LTFS_MARC%GT-MABST. " Maximum stock level
* DI1K907032 Madhu 20/08/2008 - End

ENDFORM.                    " get_plant_material_data

*&---------------------------------------------------------------------*
*&      Form  read_material_texts
*&---------------------------------------------------------------------*
FORM READ_MATERIAL_TEXTS .
  READ TABLE IT_MAKT ASSIGNING %LTFS_MAKT%GT
       WITH KEY MATNR = %LTFS_MATNR_LIST%GT-MATNR
                SPRAS = SY-LANGU.
  IF SY-SUBRC = 0.
    WA_IMP_EXP-MAKTX = %LTFS_MAKT%GT-MAKTX..
  ENDIF.
ENDFORM.                    " get_material_texts

*&---------------------------------------------------------------------*
*&      Form  get_material_list
*&---------------------------------------------------------------------*
FORM GET_MATERIAL_LIST .
  DATA: LPAD18(18) TYPE C VALUE '000000000000000000'.
  REFRESH GT_IMP_EXP.
* DI1K907032 Madhu 20/08/2008 - Begin of Comment - PP-0414 - Need to
* pick bom components also
*  IF NOT rb_downl IS INITIAL.
  SELECT MATNR
    FROM MARA
    INTO TABLE IT_MATNR_LIST
   WHERE MATNR IN S_MATNR.
*  ELSE.
*    LOOP AT gt_output ASSIGNING %LTfs_output%GT.
*      wa_matnr_list-matnr = %LTfs_output%GT-matnr.
*      wa_matnr_list-werks = %LTfs_output%GT-werks.
*      IF wa_matnr_list-matnr CO '0123456789. '.
*        SHIFT wa_matnr_list-matnr RIGHT DELETING TRAILING space.
*        OVERLAY wa_matnr_list-matnr WITH lpad18.
*      ENDIF.
*      APPEND wa_matnr_list TO it_matnr_list.
*    ENDLOOP.
*  ENDIF.
*
* DI1K907032 Madhu 20/08/2008 - End
ENDFORM.                    " get_material_list
*&---------------------------------------------------------------------*
*&      Form  get_material_data
*&---------------------------------------------------------------------*
FORM GET_MATERIAL_DATA .
  CLEAR WA_MARA.
  CALL FUNCTION 'MARA_SINGLE_READ'
    EXPORTING
*     KZRFB                   = ' '
*     MAXTZ                   = 0
      MATNR                   = %LTFS_MATNR_LIST%GT-MATNR
*     SPERRMODUS              = ' '
*     STD_SPERRMODUS          = ' '
*     OUTPUT_NO_MESSAGE       =
    IMPORTING
      WMARA                   = WA_MARA
    EXCEPTIONS
      LOCK_ON_MATERIAL        = 1
      LOCK_SYSTEM_ERROR       = 2
      WRONG_CALL              = 3
      NOT_FOUND               = 4
      OTHERS                  = 5.
  IF SY-SUBRC %LT%GT 0.
*     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  CLEAR:   IT_MAKT.
  REFRESH: IT_MAKT.
  CALL FUNCTION 'MAKT_GENERIC_READ_WITH_MATNR'
    EXPORTING
*     KZRFB            = ' '
      MATNR            = %LTFS_MATNR_LIST%GT-MATNR
    TABLES
*     KTEXT            =
      MAKT_TAB         = IT_MAKT
    EXCEPTIONS
      WRONG_CALL       = 1
      NOT_FOUND        = 2
      OTHERS           = 3.
  IF SY-SUBRC %LT%GT 0.
*     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  CLEAR:   IT_MARC.
  REFRESH: IT_MARC.
  CALL FUNCTION 'MARC_READ_WITH_MATNR'
    EXPORTING
      MATNR                      = %LTFS_MATNR_LIST%GT-MATNR
*     KZRFB                      = ' '
*     SPERRMODUS                 = ' '
*     STD_SPERRMODUS             = ' '
    TABLES
      MARC_TAB                   = IT_MARC
    EXCEPTIONS
      NOT_FOUND                  = 1
      LOCK_ON_MARC               = 2
      LOCK_SYSTEM_ERROR          = 3
      ENQUEUE_MODE_CHANGED       = 4
      OTHERS                     = 5.
  IF G_BOM_COMPONENTS NE 'X'.
    IF NOT RB_DOWNL IS INITIAL.
      DELETE IT_MARC FROM 1
       WHERE NOT DISPO IN S_DISPO.
      DELETE IT_MARC FROM 1
       WHERE NOT WERKS IN S_WERKS.
      DELETE IT_MARC FROM 1
       WHERE NOT BESKZ IN S_BESKZ.
      DELETE IT_MARC FROM 1
       WHERE NOT SOBSL IN S_SOBSL.
      DELETE IT_MARC FROM 1
       WHERE NOT EKGRP IN S_EKGRP.
    ENDIF.
  ELSE.
    IF NOT RB_DOWNL IS INITIAL.
      DELETE IT_MARC FROM 1
       WHERE NOT DISPO IN S_DISPO.
      DELETE IT_MARC FROM 1
       WHERE NOT WERKS IN S_WERKS.
*    DELETE it_marc FROM 1
*     WHERE NOT beskz IN s_beskz.
*    DELETE it_marc FROM 1
*     WHERE NOT sobsl IN s_sobsl.
      DELETE IT_MARC FROM 1
       WHERE NOT EKGRP IN S_EKGRP.
    ENDIF.
  ENDIF.
  CLEAR WA_T405.
  CALL FUNCTION 'T405_SINGLE_READ'
    EXPORTING
*     KZRFB            = ' '
      T405_EKWSL       = WA_MARA-EKWSL
    IMPORTING
      WT405            = WA_T405
    EXCEPTIONS
      NOT_FOUND        = 1
      OTHERS           = 2.
  IF SY-SUBRC %LT%GT 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " get_material_data

*&---------------------------------------------------------------------*
*&      Form  GET_MRP_DATA
*&---------------------------------------------------------------------*
FORM GET_MRP_DATA .
  DATA: MDTBX  LIKE MDTB  OCCURS 0.
  DATA: BEGIN OF MDKPX OCCURS 0,
          MATNR LIKE MDKP-MATNR,
          MEINS LIKE MDKP-MEINS,
          DTNUM LIKE MDKP-DTNUM,
          CFLAG LIKE MDKP-CFLAG,
          DSDAT LIKE MDKP-DSDAT,
        END OF MDKPX.
  G_ERROR_FLAG = 0.
  SELECT MATNR MEINS DTNUM CFLAG DSDAT
    INTO CORRESPONDING FIELDS OF TABLE MDKPX
    FROM MDKP
   WHERE PLWRK EQ %LTFS_MARC%GT-WERKS
     AND DISPO EQ %LTFS_MARC%GT-DISPO
     AND MATNR EQ %LTFS_MARC%GT-MATNR
     AND DTART EQ 'MD'
     AND SOBSL IN S_SOBSL.
  LOOP AT MDKPX.
    REFRESH MDTBX.
    IF MDKPX-CFLAG EQ 'X'.
      IMPORT MDTBX FROM DATABASE MDTC(AR) ID MDKPX-DTNUM.
    ELSE.
      SELECT * FROM MDTB INTO TABLE MDTBX WHERE  DTNUM = MDKPX-DTNUM .
    ENDIF.
    LOOP AT MDTBX INTO MDTB WHERE DELKZ IN S_DELKZ
                              AND DAT00 IN S_DSDAT
                              AND PLAAB %LT%GT '26'.
      IF MDTB-PLUMI = '-'.
        MDTB-MNG01 = MDTB-MNG01 * -1.
      ENDIF.
      WA_IMP_EXP-MNG01 = WA_IMP_EXP-MNG01 + MDTB-MNG01.
    ENDLOOP.
  ENDLOOP.

ENDFORM.                    " GET_MRP_DATA

*&---------------------------------------------------------------------*
*&      Form  GET_PRICE_DATA
*&---------------------------------------------------------------------*
FORM GET_PRICE_DATA .
*  IF wa_imp_exp-verpr IS INITIAL AND g_inforec_found = 0.
  IF G_INFOREC_FOUND = 0.
    REFRESH IT_MBEW.
    CALL FUNCTION 'MBEW_READ_WITH_MATNR'
      EXPORTING
        MATNR                      = %LTFS_MARC%GT-MATNR
*       KZRFB                      = ' '
*       SPERRMODUS                 = ' '
*       STD_SPERRMODUS             = ' '
      TABLES
        MBEW_TAB                   = IT_MBEW
      EXCEPTIONS
        NOT_FOUND                  = 1
        LOCK_ON_MBEW               = 2
        LOCK_SYSTEM_ERROR          = 3
        ENQUEUE_MODE_CHANGED       = 4
        OTHERS                     = 5.
    IF SY-SUBRC %LT%GT 0.
*     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ELSE.
      LOOP AT IT_MBEW  ASSIGNING %LTFS_MBEW%GT
          WHERE BWKEY = %LTFS_MARC%GT-WERKS.
* kevin Norris 2008/01/10 - Begin - MM-0236
* always take mbew-stprs
*        IF %LTfs_mbew%GT-vprsv = 'V'.
*          wa_imp_exp-verpr = %LTfs_mbew%GT-verpr.
*          wa_imp_exp-peinh = %LTfs_mbew%GT-peinh.
*        ELSEIF %LTfs_mbew%GT-vprsv = 'S'.
        WA_IMP_EXP-VERPR = %LTFS_MBEW%GT-STPRS.
        WA_IMP_EXP-PEINH = %LTFS_MBEW%GT-PEINH.
*        ENDIF.
* kevin Norris 2008/01/10 - End - MM-0236
*PRICE IN BASE UNIT OF MEASURE
* kevin Norris 2008/01/10 - Begin - MM-0236
* always take mbew-stprs
*        wa_imp_exp-verpr_uom = %LTfs_mbew%GT-verpr /
*                               %LTfs_mbew%GT-peinh.
        WA_IMP_EXP-VERPR_UOM = %LTFS_MBEW%GT-STPRS /
                               %LTFS_MBEW%GT-PEINH.
* kevin Norris 2008/01/10 - End - MM-0236
        EXIT.
      ENDLOOP.
    ENDIF.

  ENDIF.
ENDFORM.                    " GET_PRICE_DATA

*&---------------------------------------------------------------------*
*&      Form  get_classification_data
*&---------------------------------------------------------------------*
FORM GET_CLASSIFICATION_DATA.
  DATA BEGIN OF ALLOCVALUESNUMNEW OCCURS 0.
          INCLUDE STRUCTURE BAPI1003_ALLOC_VALUES_NUM.
  DATA END OF ALLOCVALUESNUMNEW.
  DATA BEGIN OF ALLOCVALUESCHARNEW OCCURS 0.
          INCLUDE STRUCTURE BAPI1003_ALLOC_VALUES_CHAR.
  DATA END OF ALLOCVALUESCHARNEW.
  DATA BEGIN OF ALLOCVALUESCURRNEW OCCURS 0.
          INCLUDE STRUCTURE BAPI1003_ALLOC_VALUES_CURR.
  DATA END OF ALLOCVALUESCURRNEW.
  DATA:
        L_CLINT         LIKE KSSK-CLINT.  "internal class number
  DATA:
       OBJECTKEY         LIKE BAPI1003_KEY-OBJECT,
       OBJECTTABLE       LIKE BAPI1003_KEY-OBJECTTABLE VALUE 'EQUI',
       CLASSNUM          LIKE BAPI1003_KEY-CLASSNUM,
       CLASSTYPE         LIKE BAPI1003_KEY-CLASSTYPE VALUE '002',
       STATUS            LIKE BAPI1003_KEY-STATUS,
       STANDARDCLASS     LIKE BAPI1003_KEY-STDCLASS,
       KEYDATE           LIKE BAPI1003_KEY-KEYDATE.
  DATA: CLASS_RANGE TYPE TABLE OF BAPI1003_CLASS_NUM_RANGE,
        ALLOCLIST   TYPE TABLE OF BAPI1003_ALLOC_LIST.
  DATA BEGIN OF RETURN OCCURS 0.
          INCLUDE STRUCTURE BAPIRET2.
  DATA END OF RETURN.
  REFRESH:
    ALLOCVALUESNUMNEW ,
    ALLOCVALUESCHARNEW,
    ALLOCVALUESCURRNEW,
    RETURN.
  CLEAR:
     ALLOCVALUESNUMNEW ,
     ALLOCVALUESCHARNEW,
     ALLOCVALUESCURRNEW,
     RETURN.
**  Get class name
  SELECT SINGLE CLINT
    FROM KLAH
    INTO L_CLINT
   WHERE KLART EQ '001'
     AND CLASS EQ '94'.
* get internal class number
  SELECT SINGLE CLINT FROM KSSK
    INTO L_CLINT
   WHERE OBJEK EQ %LTFS_MARC%GT-MATNR
     AND MAFID EQ 'O'
     AND KLART EQ '001'
     AND CLINT EQ L_CLINT.
  IF SY-SUBRC EQ 0.
*   DETERMINER LA CLASSE A METTRE A JOUR
    MOVE  %LTFS_MARC%GT-MATNR    TO OBJECTKEY.
    WRITE '94'       TO CLASSNUM.
    MOVE  '1'        TO STATUS.
    MOVE  SY-DATUM   TO KEYDATE.
    MOVE 'MARA'      TO OBJECTTABLE.
    MOVE '001'       TO CLASSTYPE.
    CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
      EXPORTING
        OBJECTKEY        = OBJECTKEY
        OBJECTTABLE      = OBJECTTABLE
        CLASSNUM         = CLASSNUM
        CLASSTYPE        = CLASSTYPE
        KEYDATE          = SY-DATUM
        UNVALUATED_CHARS = ' '
      IMPORTING
        STATUS           = STATUS
        STANDARDCLASS    = STANDARDCLASS
      TABLES
        ALLOCVALUESNUM   = ALLOCVALUESNUMNEW
        ALLOCVALUESCHAR  = ALLOCVALUESCHARNEW
        ALLOCVALUESCURR  = ALLOCVALUESCURRNEW
        RETURN           = RETURN.
    LOOP AT ALLOCVALUESCHARNEW WHERE CHARACT = 'PIECE_PEINTURE'.
      IF ALLOCVALUESCHARNEW-VALUE_NEUTRAL = '1'.
        WA_IMP_EXP-PAINT = 'X'.
      ENDIF.
    ENDLOOP.

  ENDIF.

ENDFORM.                    " get_classification_data
*&---------------------------------------------------------------------*
*&      Form  SETUP_FIELDCAT
*&---------------------------------------------------------------------*
FORM SETUP_FIELDCAT .
  REFRESH R_FIELDN.
  PERFORM INCLUDE_MODIF_FIELD USING 'WEBAZ'.
  PERFORM INCLUDE_MODIF_FIELD USING 'EISBE'.
  PERFORM INCLUDE_MODIF_FIELD USING 'EISLO'.
* PERFORM include_modif_field USING 'DISMM'.  " MM-0236
  PERFORM INCLUDE_MODIF_FIELD USING 'SHZET'.
  PERFORM INCLUDE_MODIF_FIELD USING 'SHFLG'.
  PERFORM INCLUDE_MODIF_FIELD USING 'MAABC'.
* PERFORM include_modif_field USING 'DISGR'.  " MM-0236
  PERFORM INCLUDE_MODIF_FIELD USING 'MRPPP'.
* PERFORM include_modif_field USING 'RWPRO'.  " MM-0236
  PERFORM INCLUDE_MODIF_FIELD USING 'BSTRF'.
  PERFORM INCLUDE_MODIF_FIELD USING 'DISLS'.
  PERFORM INCLUDE_MODIF_FIELD USING 'BSTMI'.
  PERFORM INCLUDE_MODIF_FIELD USING 'EKWSL'.
  PERFORM INCLUDE_MODIF_FIELD USING 'DISPO'.                " MM-0236
  PERFORM INCLUDE_MODIF_FIELD USING 'EKGRP'.                " MM-0236
* DI1K907032 Madhu 20/08/2008 - Begin - PP-0414 - Additional columns for
* update
  PERFORM INCLUDE_MODIF_FIELD USING 'MINBE'.
  PERFORM INCLUDE_MODIF_FIELD USING 'MABST'.
  PERFORM INCLUDE_MODIF_FIELD USING 'DISGR'.
  PERFORM INCLUDE_MODIF_FIELD USING 'BSTMA'.
  PERFORM INCLUDE_MODIF_FIELD USING 'LTKZE'.
  PERFORM INCLUDE_MODIF_FIELD USING 'LTKZA'.
  PERFORM INCLUDE_MODIF_FIELD USING 'LGBKZ'.
  PERFORM INCLUDE_MODIF_FIELD USING 'LGPLA'.
  PERFORM INCLUDE_MODIF_FIELD USING 'BSSKZ'.
  PERFORM INCLUDE_MODIF_FIELD USING 'SOBSL'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_CONS_SERVICE'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_ABC_CONSOMMATION'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_PIECE_KIT'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_RACK'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_FREQUENCY'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_ROUTE'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_QTE_MAX_CONTENANT'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_CONTENANT'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_CONT_FOURN_PROFONDEUR'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_CONT_FOURN_LARGEUR'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_CONT_FOURN_HAUTEUR'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_PIECE_PROFONDEUR'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_PIECE_LARGEUR'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_PIECE_HAUTEUR'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_CONT_INTERNE_PROFONDEUR'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_CONT_INTERNE_LARGEUR'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_CONT_INTERNE_HAUTEUR'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_OCCURENCE_MAX'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_METHODE_TRANSPORT'.
  PERFORM INCLUDE_MODIF_FIELD USING 'PFEP_REVISION_DATE'.
* DI1K907032 Madhu 20/08/2008 - End

*  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
*    EXPORTING
*      i_structure_name = 'ZPPLAN_DOWNL_UPL_STRUCT1'
*    CHANGING
*      ct_fieldcat      = gt_fieldcat[].
  GT_FIELDCAT[] = IFC[].
  LOOP AT GT_FIELDCAT.
    IF GT_FIELDCAT-FIELDNAME IN R_FIELDN.
      GT_FIELDCAT-EDIT = 'X'.
      MODIFY GT_FIELDCAT.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " SETUP_FIELDCAT

*&---------------------------------------------------------------------*
*&      Form  EXCLUDE_MODIF_FIELD
*&---------------------------------------------------------------------*
FORM INCLUDE_MODIF_FIELD  USING    VALUE(P_1220) TYPE LVC_FNAME.
  R_FIELDN-SIGN   = 'I'.
  R_FIELDN-OPTION = 'EQ'.
  R_FIELDN-LOW   = P_1220.
  APPEND R_FIELDN.
ENDFORM.                    " EXCLUDE_MODIF_FIELD

*&---------------------------------------------------------------------*
*&      Form  upload_excel_file
*&---------------------------------------------------------------------*
FORM UPLOAD_EXCEL_FILE .
  DATA : L_SCOL   TYPE I VALUE '1',
         L_SROW   TYPE I VALUE '1',
         L_ECOL   TYPE I VALUE '114',
         L_EROW   TYPE I VALUE '65536'.
  DATA : LD_INDEX TYPE I,
         L_BOM_COUNT TYPE I,
         L_COL_POS TYPE I,
         L_BOM_FLAG TYPE C VALUE SPACE,
         L_BOM TYPE MARA-MATNR,
         F_TYPE,
         L_FIELD(50) TYPE C,
         LPAD18(18)  TYPE C VALUE '000000000000000000'.
*  DATA : lt_intern TYPE  kcde_cells OCCURS 0 WITH HEADER LINE.
  DATA : LT_INTERN TYPE  ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
  FIELD-SYMBOLS: %LTFS%GT.
  CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      FILENAME                = P_FILE
      I_BEGIN_COL             = L_SCOL
      I_BEGIN_ROW             = L_SROW
      I_END_COL               = L_ECOL
      I_END_ROW               = L_EROW
    TABLES
      INTERN                  = LT_INTERN
    EXCEPTIONS
      INCONSISTENT_PARAMETERS = 1
      UPLOAD_OLE              = 2
      OTHERS                  = 3.
  IF SY-SUBRC %LT%GT 0.
*  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  IF LT_INTERN[] IS INITIAL.
    FORMAT COLOR COL_BACKGROUND INTENSIFIED.
    MESSAGE W037(ZZ) WITH 'No Data Uploaded'.
    EXIT.
  ELSE.
*    SORT lt_intern BY row col.
    LOOP AT LT_INTERN.
      MOVE : LT_INTERN-COL TO LD_INDEX.
* Picking the dynamic bom columns & creating dynamic bom table
      IF LT_INTERN-ROW = 1 AND LT_INTERN-COL = 35.
        L_BOM_COUNT = 0.
        REFRESH IFC_BOMS.
        L_COL_POS = 35.
        LOOP AT LT_INTERN FROM 35.
          IF LT_INTERN-VALUE = 'Common'.
            EXIT.
          ENDIF.
          L_BOM_COUNT = L_BOM_COUNT + 1.
          CLEAR XFC_BOMS.
          XFC_BOMS-FIELDNAME = LT_INTERN-VALUE.
          CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
            EXPORTING
              INPUT  = LT_INTERN-VALUE
            IMPORTING
              OUTPUT = L_BOM.
          XFC_BOMS-SCRTEXT_L = L_BOM.
          XFC_BOMS-DATATYPE = 'C'.
          XFC_BOMS-INTTYPE = 'C'.
          XFC_BOMS-INTLEN = 3.
          XFC_BOMS-DECIMALS = 0.
          XFC_BOMS-COL_POS = L_COL_POS.
          APPEND XFC_BOMS TO IFC_BOMS.
          L_COL_POS = L_COL_POS + 1.
        ENDLOOP.
        CALL METHOD CL_ALV_TABLE_CREATE=%GTCREATE_DYNAMIC_TABLE
          EXPORTING
            IT_FIELDCATALOG = IFC_BOMS
          IMPORTING
            EP_TABLE        = DY_BOMS_TABLE.
        ASSIGN DY_BOMS_TABLE-%GT* TO %LTGT_BOMS%GT.
        CREATE DATA DY_BOMS_LINE LIKE LINE OF %LTGT_BOMS%GT.
        ASSIGN DY_BOMS_LINE-%GT* TO %LTWA_BOMS%GT.
        L_BOM_COUNT = L_BOM_COUNT + 35.
      ENDIF.
      IF NOT CHK_FIR IS INITIAL AND LT_INTERN-ROW = 1.
        CONTINUE.
      ENDIF.
* assigning both static & dynamic content to work areas.
      IF LT_INTERN-COL %LT 35 OR LT_INTERN-COL %GT= L_BOM_COUNT.
        IF LT_INTERN-COL %GT= 35.
          LD_INDEX = LD_INDEX - ( L_BOM_COUNT - 35 ).
        ENDIF.
        ASSIGN COMPONENT LD_INDEX OF STRUCTURE WA_IMP_EXP TO %LTFS%GT.
        IF SY-SUBRC = 0.
          DESCRIBE FIELD %LTFS%GT TYPE F_TYPE.
          IF NOT F_TYPE = 'C'.
            REPLACE ALL OCCURRENCES OF ',' IN LT_INTERN-VALUE WITH ''.
            CONDENSE LT_INTERN-VALUE NO-GAPS.
          ENDIF.
          MOVE : LT_INTERN-VALUE TO %LTFS%GT.
          UNASSIGN %LTFS%GT.
        ENDIF.
      ELSE.
        LD_INDEX = LD_INDEX - 34.
        ASSIGN COMPONENT LD_INDEX OF STRUCTURE %LTWA_BOMS%GT TO %LTFS%GT.
        IF SY-SUBRC = 0.
          MOVE LT_INTERN-VALUE TO %LTFS%GT.
*           l_bom_flag = 'X'.
          UNASSIGN %LTFS%GT.
        ENDIF.
      ENDIF.
* filling the internal tables at end of each row
      AT END OF ROW.
*        CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
*          EXPORTING
*            input          = wa_imp_exp-meins
*            language       = sy-langu
*          IMPORTING
*            output         = wa_imp_exp-meins
*          EXCEPTIONS
*            unit_not_found = 1
*            OTHERS         = 2.
*        IF sy-subrc %LT%GT 0.
**         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
**            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*        ENDIF.
        CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
          EXPORTING
            INPUT          = WA_IMP_EXP-BSTME
            LANGUAGE       = SY-LANGU
          IMPORTING
            OUTPUT         = WA_IMP_EXP-BSTME
          EXCEPTIONS
            UNIT_NOT_FOUND = 1
            OTHERS         = 2.
        IF SY-SUBRC %LT%GT 0.
*         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
          EXPORTING
            INPUT          = WA_IMP_EXP-GEWEI
            LANGUAGE       = SY-LANGU
          IMPORTING
            OUTPUT         = WA_IMP_EXP-GEWEI
          EXCEPTIONS
            UNIT_NOT_FOUND = 1
            OTHERS         = 2.
        IF SY-SUBRC %LT%GT 0.
*         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
          EXPORTING
            INPUT          = WA_IMP_EXP-VOLEH
            LANGUAGE       = SY-LANGU
          IMPORTING
            OUTPUT         = WA_IMP_EXP-VOLEH
          EXCEPTIONS
            UNIT_NOT_FOUND = 1
            OTHERS         = 2.
        IF SY-SUBRC %LT%GT 0.
*         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        IF WA_IMP_EXP-MATNR CO '0123456789 '.
          SHIFT WA_IMP_EXP-MATNR RIGHT DELETING TRAILING SPACE.
          OVERLAY WA_IMP_EXP-MATNR WITH LPAD18.
        ENDIF.
        APPEND WA_IMP_EXP TO GT_OUTPUT.
*        if l_bom_flag = 'X'.
        APPEND %LTWA_BOMS%GT TO %LTGT_BOMS%GT.
*        endif.
        CLEAR WA_IMP_EXP.
      ENDAT.
    ENDLOOP.
  ENDIF.
ENDFORM.                    " upload_excel_file

*&---------------------------------------------------------------------*
*&      Form  UPLOAD_MODIFICATIONS
*&---------------------------------------------------------------------*
FORM UPLOAD_MODIFICATIONS .
  PERFORM EXPLODE_ACTIVE_BOMS.
*     gt_bom_comp[] = gt_bom_comp_temp[].
  PERFORM GET_MATERIAL_LIST.
  PERFORM GET_MATERIAL_PLANT_DATA.
  PERFORM DETERMINE_CHANGES.
ENDFORM.                    " UPLOAD_MODIFICATIONS

*&---------------------------------------------------------------------*
*&      Form  DETERMINE_CHANGES
*&---------------------------------------------------------------------*
FORM DETERMINE_CHANGES .
  DATA: BAPIMATHEAD     LIKE BAPIMATHEAD,
        BAPI_MARA       LIKE BAPI_MARA,
        BAPI_MARAX      LIKE BAPI_MARAX,
        BAPI_MARC       LIKE BAPI_MARC,
        BAPI_MARCX      LIKE BAPI_MARCX,
        BAPI_MPOP       LIKE BAPI_MPOP,
        BAPI_MPGD       LIKE BAPI_MPGD,
        BAPI_MARD       LIKE BAPI_MARD,
        BAPI_MBEW       LIKE BAPI_MBEW,
        BAPI_MLGN       LIKE BAPI_MLGN,
        BAPI_MLGNX      LIKE BAPI_MLGNX,
        BAPI_MVKE       LIKE BAPI_MVKE,
        BAPI_MLGT       LIKE BAPI_MLGT,
        BAPI_MLGTX      LIKE BAPI_MLGTX,
        BAPIRET2        LIKE BAPIRET2.
  DATA: BAPI_MAKT       LIKE BAPI_MAKT OCCURS 0 WITH HEADER LINE,
        BAPI_MARM       LIKE BAPI_MARM OCCURS 0 WITH HEADER LINE,
        BAPI_MEAN       LIKE BAPI_MEAN OCCURS 0 WITH HEADER LINE,
        BAPI_MLAN       LIKE BAPI_MLAN OCCURS 0 WITH HEADER LINE,
        BAPI_MATRETURN2 LIKE BAPI_MATRETURN2,
        L_MSGTXT        LIKE BAPIRET2-MESSAGE,
        TEXT_FORMAT     LIKE BAPITGA-TEXTFORMAT.
  DATA: CHANGE_FLAG     TYPE I VALUE 0,
        MIN_1_CHANGE    TYPE I VALUE 0,
        MIN_1_CHANGE1    TYPE I VALUE 0,
        L_PAD4(4)       TYPE C VALUE '0000',
        L_CHANGE_FLAG   TYPE C,
        L_ERROR_FLAG    TYPE C,
        L_T_PFEP        TYPE C,
        L_CL_PFEP       TYPE C.
  DATA: IT_RETURN TYPE TABLE OF BAPI_MATRETURN2.
  FIELD-SYMBOLS: %LTFS_RETURN%GT LIKE LINE OF IT_RETURN.
  SORT GT_IMP_EXP.
  DELETE ADJACENT DUPLICATES FROM GT_IMP_EXP.
  CLEAR: G_TOTAL_GOOD,
         G_TOTAL_BAD,
         G_NOCHANGE.

  LOOP AT GT_OUTPUT ASSIGNING %LTFS_OUTPUT%GT.
    CHANGE_FLAG = 0.
    CLEAR: L_CHANGE_FLAG, L_ERROR_FLAG.
    CLEAR: BAPIMATHEAD, BAPI_MARA, BAPI_MARAX, BAPI_MARC, BAPI_MARCX.
    READ TABLE GT_IMP_EXP ASSIGNING %LTFS_IMP_EXP%GT
         WITH KEY MATNR = %LTFS_OUTPUT%GT-MATNR
                  WERKS = %LTFS_OUTPUT%GT-WERKS
                  PRVBE = %LTFS_OUTPUT%GT-PRVBE.
    IF %LTFS_OUTPUT%GT-WEBAZ NE %LTFS_IMP_EXP%GT-WEBAZ.
      BAPI_MARC-GR_PR_TIME = %LTFS_OUTPUT%GT-WEBAZ.
      BAPI_MARCX-GR_PR_TIME = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'WEBAZ (GR Lead Time)'
                    %LTFS_IMP_EXP%GT-WEBAZ %LTFS_OUTPUT%GT-WEBAZ.
    ENDIF.
    IF %LTFS_OUTPUT%GT-EISBE NE %LTFS_IMP_EXP%GT-EISBE.
      BAPI_MARC-SAFETY_STK = %LTFS_OUTPUT%GT-EISBE.
      BAPI_MARCX-SAFETY_STK = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'EISBE (Safety Stock)'
                     %LTFS_IMP_EXP%GT-EISBE %LTFS_OUTPUT%GT-EISBE.
    ENDIF.
    IF %LTFS_OUTPUT%GT-EISLO NE %LTFS_IMP_EXP%GT-EISLO.
      BAPI_MARC-MIN_SAFETY_STK = %LTFS_OUTPUT%GT-EISLO.
      BAPI_MARCX-MIN_SAFETY_STK = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'EISLO (Min. Safety Stock)'
                    %LTFS_IMP_EXP%GT-EISLO %LTFS_OUTPUT%GT-EISLO.
    ENDIF.
* Kevin Norris 2008/01/19 - Begin - MM-0236 - Block upload of this field
*    IF %LTfs_output%GT-dismm NE %LTfs_imp_exp%GT-dismm.
*      bapi_marc-mrp_type = %LTfs_output%GT-dismm.
*      bapi_marcx-mrp_type = 'X'.
*      change_flag = 1.
*      PERFORM write_change
*              USING 'DISMM (MRP Type)'
*                    %LTfs_imp_exp%GT-dismm %LTfs_output%GT-dismm.
*    ENDIF.
* Kevin Norris 2008/01/19 - Begin - MM-0236 - Add new fields for update
    IF %LTFS_OUTPUT%GT-DISPO NE %LTFS_IMP_EXP%GT-DISPO.
      BAPI_MARC-MRP_CTRLER = %LTFS_OUTPUT%GT-DISPO.
      BAPI_MARCX-MRP_CTRLER = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'DISPO (MRP Controller)'
                    %LTFS_IMP_EXP%GT-DISPO %LTFS_OUTPUT%GT-DISPO.
    ENDIF.
    IF %LTFS_OUTPUT%GT-EKGRP NE %LTFS_IMP_EXP%GT-EKGRP.
      BAPI_MARC-PUR_GROUP = %LTFS_OUTPUT%GT-EKGRP.
      BAPI_MARCX-PUR_GROUP = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'EKGRP (Purchasing Group)'
                    %LTFS_IMP_EXP%GT-EKGRP %LTFS_OUTPUT%GT-EKGRP.
    ENDIF.

    IF %LTFS_OUTPUT%GT-SHZET NE %LTFS_IMP_EXP%GT-SHZET.
      BAPI_MARC-SAFETYTIME = %LTFS_OUTPUT%GT-SHZET.
      BAPI_MARCX-SAFETYTIME = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'SHZET (Safty Time)'
                    %LTFS_IMP_EXP%GT-SHZET %LTFS_OUTPUT%GT-SHZET.
    ENDIF.
    IF %LTFS_OUTPUT%GT-SHFLG NE %LTFS_IMP_EXP%GT-SHFLG.
      BAPI_MARC-SAFTY_T_ID = %LTFS_OUTPUT%GT-SHFLG.
      BAPI_MARCX-SAFTY_T_ID = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'SHFLG (Safty Time Indicator)'
                    %LTFS_IMP_EXP%GT-SHFLG %LTFS_OUTPUT%GT-SHFLG.
    ENDIF.
    IF %LTFS_OUTPUT%GT-MAABC NE %LTFS_IMP_EXP%GT-MAABC.
      BAPI_MARC-ABC_ID = %LTFS_OUTPUT%GT-MAABC.
      BAPI_MARCX-ABC_ID = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'MAABC (ABC Code)'
                    %LTFS_IMP_EXP%GT-MAABC %LTFS_OUTPUT%GT-MAABC.
    ENDIF.
* Kevin Norris 2008/01/19 - Begin - MM-0236 - Block upload of this field
*    SHIFT %LTfs_imp_exp%GT-disgr RIGHT DELETING TRAILING space.
*    SHIFT %LTfs_output%GT-disgr  RIGHT DELETING TRAILING space.
*    OVERLAY %LTfs_imp_exp%GT-disgr WITH l_pad4.
*    OVERLAY %LTfs_output%GT-disgr WITH l_pad4.
*    IF %LTfs_output%GT-disgr NE %LTfs_imp_exp%GT-disgr.
*      bapi_marc-mrp_group = %LTfs_output%GT-disgr.
*      bapi_marcx-mrp_group = 'X'.
*      change_flag = 1.
*      PERFORM write_change
*              USING 'DISGR (MRP Group)'
*                    %LTfs_imp_exp%GT-disgr %LTfs_output%GT-disgr.
*    ENDIF.
    IF %LTFS_OUTPUT%GT-MRPPP NE %LTFS_IMP_EXP%GT-MRPPP.
      BAPI_MARC-PPC_PL_CAL = %LTFS_OUTPUT%GT-MRPPP.
      BAPI_MARCX-PPC_PL_CAL = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'MRPPP (Plann. Calendar)'
                    %LTFS_IMP_EXP%GT-MRPPP %LTFS_OUTPUT%GT-MRPPP.
    ENDIF.
* Kevin Norris 2008/01/19 - Begin - MM-0236 - Block upload of this field
*    IF %LTfs_output%GT-rwpro NE %LTfs_imp_exp%GT-rwpro.
*      bapi_marc-covprofile = %LTfs_output%GT-rwpro.
*      bapi_marcx-covprofile = 'X'.
*      change_flag = 1.
*      PERFORM write_change
*      USING 'RWPRO (Coverage Profile)'
*            %LTfs_imp_exp%GT-rwpro %LTfs_output%GT-rwpro.
*    ENDIF.
    IF %LTFS_OUTPUT%GT-BSTRF NE %LTFS_IMP_EXP%GT-BSTRF.
      BAPI_MARC-ROUND_VAL = %LTFS_OUTPUT%GT-BSTRF.
      BAPI_MARCX-ROUND_VAL = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'BSTRF (Rounding Value)'
                    %LTFS_IMP_EXP%GT-BSTRF %LTFS_OUTPUT%GT-BSTRF.
    ENDIF.
    IF %LTFS_OUTPUT%GT-DISLS NE %LTFS_IMP_EXP%GT-DISLS.
      BAPI_MARC-LOTSIZEKEY = %LTFS_OUTPUT%GT-DISLS.
      BAPI_MARCX-LOTSIZEKEY = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'DISLS (Lot Size)'
                    %LTFS_IMP_EXP%GT-DISLS %LTFS_OUTPUT%GT-DISLS.
    ENDIF.
    IF %LTFS_OUTPUT%GT-BSTMI NE %LTFS_IMP_EXP%GT-BSTMI.
      BAPI_MARC-MINLOTSIZE = %LTFS_OUTPUT%GT-BSTMI.
      BAPI_MARCX-MINLOTSIZE = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'BSTMI (Min. lot size)'
                    %LTFS_IMP_EXP%GT-BSTMI %LTFS_OUTPUT%GT-BSTMI.
    ENDIF.
    IF %LTFS_OUTPUT%GT-EKWSL NE %LTFS_IMP_EXP%GT-EKWSL.
      BAPI_MARA-PUR_VALKEY = %LTFS_OUTPUT%GT-EKWSL.
      BAPI_MARAX-PUR_VALKEY = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'EKWSL (Purch. Key Value)'
                    %LTFS_IMP_EXP%GT-EKWSL %LTFS_OUTPUT%GT-EKWSL.
    ENDIF.
*   if %LTfs_output%GT- ne %LTfs_imp_exp%GT-.
*     BAPI_MARC- = %LTfs_output%GT-.
*     BAPI_MARCX- = 'X'.
*   endif.
* DI1K907032 Madhu 20/08/2008 - Begin - PP-0414 - changes on additional
* columns
    IF %LTFS_OUTPUT%GT-MINBE NE %LTFS_IMP_EXP%GT-MINBE.
      BAPI_MARC-REORDER_PT = %LTFS_OUTPUT%GT-MINBE.
      BAPI_MARCX-REORDER_PT = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'MINBE (Reorder Point)'
                    %LTFS_IMP_EXP%GT-MINBE %LTFS_OUTPUT%GT-MINBE.
    ENDIF.
    IF %LTFS_OUTPUT%GT-MABST NE %LTFS_IMP_EXP%GT-MABST.
      BAPI_MARC-MAX_STOCK = %LTFS_OUTPUT%GT-MABST.
      BAPI_MARCX-MAX_STOCK = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'MABST (Maximum stock level)'
                    %LTFS_IMP_EXP%GT-MABST %LTFS_OUTPUT%GT-MABST.
    ENDIF.
    IF %LTFS_OUTPUT%GT-DISGR NE %LTFS_IMP_EXP%GT-DISGR.
      BAPI_MARC-MRP_GROUP = %LTFS_OUTPUT%GT-DISGR.
      BAPI_MARCX-MRP_GROUP = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'DISGR (MRP Group)'
                    %LTFS_IMP_EXP%GT-DISGR %LTFS_OUTPUT%GT-DISGR.
    ENDIF.
    IF %LTFS_OUTPUT%GT-BSTMA NE %LTFS_IMP_EXP%GT-BSTMA.
      BAPI_MARC-MAXLOTSIZE = %LTFS_OUTPUT%GT-BSTMA.
      BAPI_MARCX-MAXLOTSIZE = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'BSTMA (Maximum lot size)'
                    %LTFS_IMP_EXP%GT-BSTMA %LTFS_OUTPUT%GT-BSTMA.
    ENDIF.
    IF %LTFS_OUTPUT%GT-SOBSL NE %LTFS_IMP_EXP%GT-SOBSL.
      BAPI_MARC-SPPROCTYPE = %LTFS_OUTPUT%GT-SOBSL.
      BAPI_MARCX-SPPROCTYPE = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'SOBSL (Special procurement type)'
                    %LTFS_IMP_EXP%GT-SOBSL %LTFS_OUTPUT%GT-SOBSL.
    ENDIF.
    IF %LTFS_OUTPUT%GT-LTKZA NE %LTFS_IMP_EXP%GT-LTKZA.
      BAPI_MLGN-WITHDRAWAL = %LTFS_OUTPUT%GT-LTKZA.
      BAPI_MLGNX-WITHDRAWAL = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'LTKZA (St typ Ind - StockRemoval)'
                    %LTFS_IMP_EXP%GT-LTKZA %LTFS_OUTPUT%GT-LTKZA.
    ENDIF.
    IF %LTFS_OUTPUT%GT-LTKZE NE %LTFS_IMP_EXP%GT-LTKZE.
      BAPI_MLGN-PLACEMENT = %LTFS_OUTPUT%GT-LTKZE.
      BAPI_MLGNX-PLACEMENT = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'LTKZE (St typ Ind - StockPlacement)'
                    %LTFS_IMP_EXP%GT-LTKZE %LTFS_OUTPUT%GT-LTKZE.
    ENDIF.
    IF %LTFS_OUTPUT%GT-LGBKZ NE %LTFS_IMP_EXP%GT-LGBKZ.
      BAPI_MLGN-STGESECTOR = %LTFS_OUTPUT%GT-LGBKZ.
      BAPI_MLGNX-STGESECTOR = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'LGBKZ (Storage section indicator)'
                    %LTFS_IMP_EXP%GT-LGBKZ %LTFS_OUTPUT%GT-LGBKZ.
    ENDIF.
    IF %LTFS_OUTPUT%GT-BSSKZ NE %LTFS_IMP_EXP%GT-BSSKZ.
      BAPI_MLGN-SPEC_MVMT = %LTFS_OUTPUT%GT-BSSKZ.
      BAPI_MLGNX-SPEC_MVMT = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'BSSKZ (Special Mvt Ind for WM)'
                    %LTFS_IMP_EXP%GT-BSSKZ %LTFS_OUTPUT%GT-BSSKZ.
    ENDIF.
    IF %LTFS_OUTPUT%GT-LGPLA NE %LTFS_IMP_EXP%GT-LGPLA.
      BAPI_MLGT-STGE_BIN = %LTFS_OUTPUT%GT-LGPLA.
      BAPI_MLGTX-STGE_BIN = 'X'.
      CHANGE_FLAG = 1.
      PERFORM WRITE_CHANGE
              USING 'LGPLA (Storage Bin)'
                    %LTFS_IMP_EXP%GT-LGPLA %LTFS_OUTPUT%GT-LGPLA.
    ENDIF.

    IF %LTFS_OUTPUT%GT-PFEP_ROUTE NE %LTFS_IMP_EXP%GT-PFEP_ROUTE.
      L_CHANGE_FLAG = 'X'.
      IF L_T_PFEP NE 'X'.
        CONCATENATE TEXT-010 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE....
      ENDIF.
      PERFORM WRITE_CHANGE
             USING 'PFEP_ROUTE (Route)'
                   %LTFS_IMP_EXP%GT-PFEP_ROUTE %LTFS_OUTPUT%GT-PFEP_ROUTE.
      CLEAR G_ERROR.
      PERFORM MODIFY_T_PFEP USING %LTFS_OUTPUT%GT-PFEP_ROUTE
                                  %LTFS_IMP_EXP%GT-PFEP_ROUTE
                                  %LTFS_OUTPUT%GT-MATNR
                                  %LTFS_OUTPUT%GT-PRVBE
                                  'PFEP_ROUTE'.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_ROUTE' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_ROUTE' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_T_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_FREQUENCY NE %LTFS_IMP_EXP%GT-PFEP_FREQUENCY.
      L_CHANGE_FLAG = 'X'.
      IF L_T_PFEP NE 'X'.
        CONCATENATE TEXT-010 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ENDIF.
      PERFORM WRITE_CHANGE
             USING 'PFEP_FREQUENCY (Frequency)'
                   %LTFS_IMP_EXP%GT-PFEP_FREQUENCY
  %LTFS_OUTPUT%GT-PFEP_FREQUENCY.
      CLEAR G_ERROR.
      PERFORM MODIFY_T_PFEP USING %LTFS_OUTPUT%GT-PFEP_FREQUENCY
                                  %LTFS_IMP_EXP%GT-PFEP_FREQUENCY
                                  %LTFS_OUTPUT%GT-MATNR
                                  %LTFS_OUTPUT%GT-PRVBE
                                  'PFEP_FREQUENCY'.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_FREQUENCY' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_FREQUENCY' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_T_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_RACK NE %LTFS_IMP_EXP%GT-PFEP_RACK.
      L_CHANGE_FLAG = 'X'.
      IF L_T_PFEP NE 'X'.
        CONCATENATE TEXT-010 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ENDIF.
      PERFORM WRITE_CHANGE
             USING 'PFEP_RACK (Rack)'
                   %LTFS_IMP_EXP%GT-PFEP_RACK %LTFS_OUTPUT%GT-PFEP_RACK.
      CLEAR G_ERROR.
      PERFORM MODIFY_T_PFEP USING %LTFS_OUTPUT%GT-PFEP_RACK
                                  %LTFS_IMP_EXP%GT-PFEP_RACK
                                  %LTFS_OUTPUT%GT-MATNR
                                  %LTFS_OUTPUT%GT-PRVBE
                                  'PFEP_RACK'.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_RACK' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_RACK' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_T_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_CONTENANT NE %LTFS_IMP_EXP%GT-PFEP_CONTENANT.
      L_CHANGE_FLAG = 'X'.
      IF L_T_PFEP NE 'X'.
        CONCATENATE TEXT-010 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ENDIF.
      PERFORM WRITE_CHANGE
             USING 'PFEP_CONTENANT (Contenant)'
                   %LTFS_IMP_EXP%GT-PFEP_CONTENANT
  %LTFS_OUTPUT%GT-PFEP_CONTENANT.
      CLEAR G_ERROR.
      PERFORM MODIFY_T_PFEP USING %LTFS_OUTPUT%GT-PFEP_CONTENANT
                                  %LTFS_IMP_EXP%GT-PFEP_CONTENANT
                                  %LTFS_OUTPUT%GT-MATNR
                                  %LTFS_OUTPUT%GT-PRVBE
                                  'PFEP_CONTENANT'.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_CONTENANT' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_CONTENANT' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_T_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_QTY_MAX_CONTENANT NE
       %LTFS_IMP_EXP%GT-PFEP_QTY_MAX_CONTENANT.
      L_CHANGE_FLAG = 'X'.
      IF L_T_PFEP NE 'X'.
        CONCATENATE TEXT-010 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ENDIF.
      PERFORM WRITE_CHANGE
             USING 'PFEP_QTE_MAX_CONTENANT (Max qty by container)'
                   %LTFS_IMP_EXP%GT-PFEP_QTY_MAX_CONTENANT
                   %LTFS_OUTPUT%GT-PFEP_QTY_MAX_CONTENANT.
      CLEAR G_ERROR.
      PERFORM MODIFY_T_PFEP USING %LTFS_OUTPUT%GT-PFEP_QTY_MAX_CONTENANT
                                  %LTFS_IMP_EXP%GT-PFEP_QTY_MAX_CONTENANT
                                  %LTFS_OUTPUT%GT-MATNR
                                  %LTFS_OUTPUT%GT-PRVBE
                                  'PFEP_QTE_MAX_CONTENANT'.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_QTE_MAX_CONTENANT' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_QTE_MAX_CONTENANT' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_T_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_PIECE_KIT NE %LTFS_IMP_EXP%GT-PFEP_PIECE_KIT.
      L_CHANGE_FLAG = 'X'.
      IF L_T_PFEP NE 'X'.
        CONCATENATE TEXT-010 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE....
      ENDIF.
      PERFORM WRITE_CHANGE
             USING 'PFEP_PIECE_KIT (Part include in a kit)'
                   %LTFS_IMP_EXP%GT-PFEP_PIECE_KIT
  %LTFS_OUTPUT%GT-PFEP_PIECE_KIT.
      CLEAR G_ERROR.
      PERFORM MODIFY_T_PFEP USING %LTFS_OUTPUT%GT-PFEP_PIECE_KIT
                                  %LTFS_IMP_EXP%GT-PFEP_PIECE_KIT
                                  %LTFS_OUTPUT%GT-MATNR
                                  %LTFS_OUTPUT%GT-PRVBE
                                  'PFEP_PIECE_KIT'.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_PIECE_KIT' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_PIECE_KIT' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_T_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_METHOD_TRANSPORT NE
       %LTFS_IMP_EXP%GT-PFEP_METHOD_TRANSPORT.
      L_CHANGE_FLAG = 'X'.
      IF L_CL_PFEP NE 'X'.
        CONCATENATE TEXT-012 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE....
      ENDIF.
      PERFORM WRITE_CHANGE
             USING 'PFEP_METHODE_TRANSPORT (Transport Method)'
                   %LTFS_IMP_EXP%GT-PFEP_METHOD_TRANSPORT
                   %LTFS_OUTPUT%GT-PFEP_METHOD_TRANSPORT.
      CLEAR G_ERROR.
      PERFORM MODIFY_CLASSIFICATION USING
                   %LTFS_OUTPUT%GT-PFEP_METHOD_TRANSPORT
                                          'PFEP_METHOD_TRANSPORT'
                                          %LTFS_OUTPUT%GT-MATNR.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_METHODE_TRANSPORT' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_METHODE_TRANSPORT' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_CL_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_OCCURENCE_MAX NE %LTFS_IMP_EXP%GT-PFEP_OCCURENCE_MAX
  .
      L_CHANGE_FLAG = 'X'.
      IF L_CL_PFEP NE 'X'.
        CONCATENATE TEXT-012 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE....
      ENDIF.
      PERFORM WRITE_CHANGE
             USING 'PFEP_OCCURENCE_MAX (Max instance)'
                   %LTFS_IMP_EXP%GT-PFEP_OCCURENCE_MAX
  %LTFS_OUTPUT%GT-PFEP_OCCURENCE_MAX.
      CLEAR G_ERROR.
      PERFORM MODIFY_CLASSIFICATION USING
  %LTFS_OUTPUT%GT-PFEP_OCCURENCE_MAX
                                          'PFEP_OCCURENCE_MAX'
                                          %LTFS_OUTPUT%GT-MATNR.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_OCCURENCE_MAX' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_OCCURENCE_MAX' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_CL_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_REVISON_DATE NE %LTFS_IMP_EXP%GT-PFEP_REVISON_DATE
  .
      L_CHANGE_FLAG = 'X'.
      IF L_CL_PFEP NE 'X'.
        CONCATENATE TEXT-012 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE....
      ENDIF.
      PERFORM WRITE_CHANGE
            USING 'PFEP_REVISON_DATE (Last Revision)'
                  %LTFS_IMP_EXP%GT-PFEP_REVISON_DATE
                  %LTFS_OUTPUT%GT-PFEP_REVISON_DATE.
      CLEAR G_ERROR.
      PERFORM MODIFY_CLASSIFICATION USING
                  %LTFS_OUTPUT%GT-PFEP_REVISON_DATE
                  'PFEP_REVISON_DATE'
                  %LTFS_OUTPUT%GT-MATNR.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_REVISON_DATE' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_REVISON_DATE' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_CL_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_CONS_SERVICE NE %LTFS_IMP_EXP%GT-PFEP_CONS_SERVICE.
      L_CHANGE_FLAG = 'X'.
      IF L_CL_PFEP NE 'X'.
        CONCATENATE TEXT-012 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE....
      ENDIF.
      PERFORM WRITE_CHANGE
             USING 'PFEP_CONS_SERVICE (Service Consumption)'
                   %LTFS_IMP_EXP%GT-PFEP_CONS_SERVICE
  %LTFS_OUTPUT%GT-PFEP_CONS_SERVICE.
      CLEAR G_ERROR.
      PERFORM MODIFY_CLASSIFICATION USING %LTFS_OUTPUT%GT-PFEP_CONS_SERVICE
                                          'PFEP_CONS_SERVICE'
                                          %LTFS_OUTPUT%GT-MATNR.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_CONS_SERVICE' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_CONS_SERVICE' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_CL_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_CONT_INTERNE_HAUTEUR NE
  %LTFS_IMP_EXP%GT-PFEP_CONT_INTERNE_HAUTEUR.
      L_CHANGE_FLAG = 'X'.
      IF L_CL_PFEP NE 'X'.
        CONCATENATE TEXT-012 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ENDIF.
      PERFORM WRITE_CHANGE
      USING 'PFEP_CONT_INTERNE_HAUTEUR (Internal container Height)'
                   %LTFS_IMP_EXP%GT-PFEP_CONT_INTERNE_HAUTEUR
            %LTFS_OUTPUT%GT-PFEP_CONT_INTERNE_HAUTEUR.
      CLEAR G_ERROR.
      PERFORM MODIFY_CLASSIFICATION USING
            %LTFS_OUTPUT%GT-PFEP_CONT_INTERNE_HAUTEUR
            'PFEP_CONT_INTERNE_HAUTEUR'
            %LTFS_OUTPUT%GT-MATNR.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_CONT_INTERNE_HAUTEUR' INTO
  WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_CONT_INTERNE_HAUTEUR' INTO
  WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_CL_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_CONT_INTERNE_LARGUER NE
       %LTFS_IMP_EXP%GT-PFEP_CONT_INTERNE_LARGUER.
      L_CHANGE_FLAG = 'X'.
      IF L_CL_PFEP NE 'X'.
        CONCATENATE TEXT-012 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ENDIF.
      PERFORM WRITE_CHANGE
      USING 'PFEP_CONT_INTERNE_LARGUER (Internal Container width)'
                   %LTFS_IMP_EXP%GT-PFEP_CONT_INTERNE_LARGUER
                   %LTFS_OUTPUT%GT-PFEP_CONT_INTERNE_LARGUER.
      CLEAR G_ERROR.
      PERFORM MODIFY_CLASSIFICATION USING
                  %LTFS_OUTPUT%GT-PFEP_CONT_INTERNE_LARGUER
                                          'PFEP_CONT_INTERNE_LARGUER'
                                          %LTFS_OUTPUT%GT-MATNR.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_CONT_INTERNE_LARGEUR' INTO
  WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_CONT_INTERNE_LARGEUR' INTO
  WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_CL_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_CONT_INTERNE_PROFONDUER NE
  %LTFS_IMP_EXP%GT-PFEP_CONT_INTERNE_PROFONDUER.
      L_CHANGE_FLAG = 'X'.
      IF L_CL_PFEP NE 'X'.
        CONCATENATE TEXT-012 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ENDIF.
      PERFORM WRITE_CHANGE
      USING 'PFEP_CONT_INTERNE_PROFONDUER (Internal container depth)'
                   %LTFS_IMP_EXP%GT-PFEP_CONT_INTERNE_PROFONDUER
                   %LTFS_OUTPUT%GT-PFEP_CONT_INTERNE_PROFONDUER.
      CLEAR G_ERROR.
      PERFORM MODIFY_CLASSIFICATION USING
      %LTFS_OUTPUT%GT-PFEP_CONT_INTERNE_PROFONDUER
  'PFEP_CONT_INTERNE_PROFONDEUR'
                                          %LTFS_OUTPUT%GT-MATNR.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_CONT_INTERNE_PROFONDUER' INTO
  WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_CONT_INTERNE_PROFONDUER' INTO
  WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_CL_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_PIECE_HAUTEUR NE %LTFS_IMP_EXP%GT-PFEP_PIECE_HAUTEUR
  .
      L_CHANGE_FLAG = 'X'.
      IF L_CL_PFEP NE 'X'.
        CONCATENATE TEXT-012 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ENDIF.
      PERFORM WRITE_CHANGE
             USING 'PFEP_PIECE_HAUTEUR (Part Height)'
                   %LTFS_IMP_EXP%GT-PFEP_PIECE_HAUTEUR
  %LTFS_OUTPUT%GT-PFEP_PIECE_HAUTEUR.
      CLEAR G_ERROR.
      PERFORM MODIFY_CLASSIFICATION USING
  %LTFS_OUTPUT%GT-PFEP_PIECE_HAUTEUR
                                          'PFEP_PIECE_HAUTEUR'
                                          %LTFS_OUTPUT%GT-MATNR.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_PIECE_HAUTEUR' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_PIECE_HAUTEUR' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_CL_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_PIECE_LARGEUR NE %LTFS_IMP_EXP%GT-PFEP_PIECE_LARGEUR
  .
      L_CHANGE_FLAG = 'X'.
      IF L_CL_PFEP NE 'X'.
        CONCATENATE TEXT-012 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ENDIF.
      PERFORM WRITE_CHANGE
             USING 'PFEP_PIECE_LARGEUR (Part width)'
                   %LTFS_IMP_EXP%GT-PFEP_PIECE_LARGEUR
  %LTFS_OUTPUT%GT-PFEP_PIECE_LARGEUR.
      CLEAR G_ERROR.
      PERFORM MODIFY_CLASSIFICATION USING
  %LTFS_OUTPUT%GT-PFEP_PIECE_LARGEUR
                                          'PFEP_PIECE_LARGEUR'
                                          %LTFS_OUTPUT%GT-MATNR.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_PIECE_LARGEUR' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_PIECE_LARGEUR' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_CL_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_PIECE_PROFONDEUR NE
       %LTFS_IMP_EXP%GT-PFEP_PIECE_PROFONDEUR.
      L_CHANGE_FLAG = 'X'.
      IF L_CL_PFEP NE 'X'.
        CONCATENATE TEXT-012 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ENDIF.
      PERFORM WRITE_CHANGE
             USING 'PFEP_PIECE_PROFONDEUR (Part depth)'
                   %LTFS_IMP_EXP%GT-PFEP_PIECE_PROFONDEUR
  %LTFS_OUTPUT%GT-PFEP_PIECE_PROFONDEUR.
      CLEAR G_ERROR.
      PERFORM MODIFY_CLASSIFICATION USING
  %LTFS_OUTPUT%GT-PFEP_PIECE_PROFONDEUR
                                          'PFEP_PIECE_PROFONDEUR'
                                          %LTFS_OUTPUT%GT-MATNR.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_PIECE_PROFONDEUR' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_PIECE_PROFONDEUR' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_CL_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_CONT_FOURN_HAUTEUR NE
  %LTFS_IMP_EXP%GT-PFEP_CONT_FOURN_HAUTEUR.
      L_CHANGE_FLAG = 'X'.
      IF L_CL_PFEP NE 'X'.
        CONCATENATE TEXT-012 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ENDIF.
      PERFORM WRITE_CHANGE
      USING 'PFEP_CONT_FOURN_HAUTEUR (Supplier container Height)'
                   %LTFS_IMP_EXP%GT-PFEP_CONT_FOURN_HAUTEUR
            %LTFS_OUTPUT%GT-PFEP_CONT_FOURN_HAUTEUR.
      CLEAR G_ERROR.
      PERFORM MODIFY_CLASSIFICATION USING
           %LTFS_OUTPUT%GT-PFEP_CONT_FOURN_HAUTEUR
                                          'PFEP_CONT_FOURN_HAUTEUR'
                                          %LTFS_OUTPUT%GT-MATNR.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_CONT_FOURN_HAUTEUR' INTO WA_TXTLINE
  .
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_CONT_FOURN_HAUTEUR' INTO WA_TXTLINE
  .
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_CL_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_CONT_FOURN_LARGEUR NE
       %LTFS_IMP_EXP%GT-PFEP_CONT_FOURN_LARGEUR.
      L_CHANGE_FLAG = 'X'.
      IF L_CL_PFEP NE 'X'.
        CONCATENATE TEXT-012 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ENDIF.
      PERFORM WRITE_CHANGE
             USING 'PFEP_CONT_FOURN_LARGEUR (Supplier container width)'
                   %LTFS_IMP_EXP%GT-PFEP_CONT_FOURN_LARGEUR
  %LTFS_OUTPUT%GT-PFEP_CONT_FOURN_LARGEUR.
      CLEAR G_ERROR.
      PERFORM MODIFY_CLASSIFICATION USING
  %LTFS_OUTPUT%GT-PFEP_CONT_FOURN_LARGEUR
                                          'PFEP_CONT_FOURN_LARGEUR'
                                          %LTFS_OUTPUT%GT-MATNR.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_CONT_FOURN_LARGEUR' INTO WA_TXTLINE
  .
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_CONT_FOURN_LARGEUR' INTO WA_TXTLINE
  .
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_CL_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_CONT_FOURN_PROFONDEUR NE
       %LTFS_IMP_EXP%GT-PFEP_CONT_FOURN_PROFONDEUR.
      L_CHANGE_FLAG = 'X'.
      IF L_CL_PFEP NE 'X'.
        CONCATENATE TEXT-012 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ENDIF.
      PERFORM WRITE_CHANGE
      USING 'PFEP_CONT_FOURN_PROFONDEUR (Supplier container depth)'
                   %LTFS_IMP_EXP%GT-PFEP_CONT_FOURN_PROFONDEUR
                   %LTFS_OUTPUT%GT-PFEP_CONT_FOURN_PROFONDEUR.
      CLEAR G_ERROR.
      PERFORM MODIFY_CLASSIFICATION USING
                   %LTFS_OUTPUT%GT-PFEP_CONT_FOURN_PROFONDEUR
                   'PFEP_CONT_FOURN_PROFONDEUR'
                   %LTFS_OUTPUT%GT-MATNR.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_CONT_FOURN_PROFONDEUR' INTO
  WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_CONT_FOURN_PROFONDEUR' INTO
  WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_CL_PFEP = 'X'.
    ENDIF.
    IF %LTFS_OUTPUT%GT-PFEP_ABC_CONSOMMATION NE
  %LTFS_IMP_EXP%GT-PFEP_ABC_CONSOMMATION.
      L_CHANGE_FLAG = 'X'.
      IF L_CL_PFEP NE 'X'.
        CONCATENATE TEXT-012 TEXT-011 %LTFS_OUTPUT%GT-MATNR
                    INTO WA_TXTLINE
                    SEPARATED BY SPACE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ENDIF.
      PERFORM WRITE_CHANGE
             USING 'PFEP_ABC_CONSOMMATION (ABC CONSUMPTION)'
                   %LTFS_IMP_EXP%GT-PFEP_ABC_CONSOMMATION
  %LTFS_OUTPUT%GT-PFEP_ABC_CONSOMMATION.
      CLEAR G_ERROR.
      PERFORM MODIFY_CLASSIFICATION USING
  %LTFS_OUTPUT%GT-PFEP_ABC_CONSOMMATION
                                          'PFEP_ABC_CONSOMMATION'
                                          %LTFS_OUTPUT%GT-MATNR.
      IF G_ERROR NE 'X'.
        CONCATENATE TEXT-014 'PFEP_ABC_CONSOMMATION' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
      ELSE.
        CONCATENATE TEXT-013 'PFEP_ABC_CONSOMMATION' INTO WA_TXTLINE.
        APPEND WA_TXTLINE TO IT_TXTTABLE.
        L_ERROR_FLAG = 'X'.
      ENDIF.
      L_CL_PFEP = 'X'.
    ENDIF.
    IF CHANGE_FLAG NE 1 AND L_CHANGE_FLAG EQ 'X'.
      IF L_ERROR_FLAG NE 'X'.
        G_TOTAL_GOOD = G_TOTAL_GOOD + 1.
      ELSE.
        G_TOTAL_BAD = G_TOTAL_BAD + 1.
      ENDIF.
    ENDIF.

    BAPIMATHEAD-MATERIAL = %LTFS_OUTPUT%GT-MATNR.
    BAPI_MARC-PLANT = %LTFS_OUTPUT%GT-WERKS.
    BAPI_MARCX-PLANT = %LTFS_OUTPUT%GT-WERKS.
    BAPI_MLGN-WHSE_NO = P_LGNUM.
    BAPI_MLGNX-WHSE_NO = P_LGNUM.
    BAPI_MLGT-WHSE_NO = P_LGNUM.
    BAPI_MLGT-STGE_TYPE = %LTFS_OUTPUT%GT-LTKZE.
    BAPI_MLGTX-WHSE_NO = P_LGNUM.
    BAPI_MLGTX-STGE_TYPE = %LTFS_OUTPUT%GT-LTKZE.
* DI1K907032 Madhu 20/08/2008 - End.
    IF CHANGE_FLAG = 1.
      MIN_1_CHANGE = 1.
      CLEAR  BAPI_MATRETURN2.
      CONCATENATE TEXT-009 %LTFS_OUTPUT%GT-MATNR
             INTO WA_TXTLINE
        SEPARATED BY SPACE.
      APPEND WA_TXTLINE TO IT_TXTTABLE.
      CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
        EXPORTING
          HEADDATA                   = BAPIMATHEAD
          CLIENTDATA                 = BAPI_MARA
          CLIENTDATAX                = BAPI_MARAX
          PLANTDATA                  = BAPI_MARC
          PLANTDATAX                 = BAPI_MARCX
*         FORECASTPARAMETERS         =
*         FORECASTPARAMETERSX        =
*         PLANNINGDATA               =
*         PLANNINGDATAX              =
*         STORAGELOCATIONDATA        =
*         STORAGELOCATIONDATAX       =
*         VALUATIONDATA              =
*         VALUATIONDATAX             =
         WAREHOUSENUMBERDATA        = BAPI_MLGN
         WAREHOUSENUMBERDATAX       = BAPI_MLGNX
*         SALESDATA                  =
*         SALESDATAX                 =
         STORAGETYPEDATA            = BAPI_MLGT
         STORAGETYPEDATAX           = BAPI_MLGTX
*          FLAG_ONLINE               = 'X'
*         flag_cad_call              = 'X'
*         no_dequeue                 = 'X'
        IMPORTING
          RETURN                     = BAPI_MATRETURN2
        TABLES
*         MATERIALDESCRIPTION        =
*         UNITSOFMEASURE             =
*         UNITSOFMEASUREX            =
*         INTERNATIONALARTNOS        =
*         MATERIALLONGTEXT           =
*         TAXCLASSIFICATIONS         =
          RETURNMESSAGES             = IT_RETURN
*         PRTDATA                    =
*         PRTDATAX                   =
*         EXTENSIONIN                =
*         EXTENSIONINX               =
                .
      TEXT_FORMAT = 'ASC'.
      CLEAR L_MSGTXT.
*     message M3801 is a confirmation that the material was sucessfully
*     changed if this message is not found something wrong happened.
      READ TABLE IT_RETURN ASSIGNING %LTFS_RETURN%GT WITH KEY
        TYPE    = 'S'
        ID      = 'M3'
        NUMBER  = '801'.
      IF SY-SUBRC = 0.
        G_TOTAL_GOOD = G_TOTAL_GOOD + 1.
        REFRESH IT_TXTTABLE.
      ELSE.
        LOOP AT IT_RETURN ASSIGNING %LTFS_RETURN%GT.
          CALL FUNCTION 'BAPI_MESSAGE_GETDETAIL'
                    EXPORTING
                      ID                = %LTFS_RETURN%GT-ID
                      NUMBER            = %LTFS_RETURN%GT-NUMBER
*                     LANGUAGE          = SY-LANGU
                      TEXTFORMAT        = TEXT_FORMAT
*                     LINKPATTERN       =
                      MESSAGE_V1        = %LTFS_RETURN%GT-MESSAGE_V1
                      MESSAGE_V2        = %LTFS_RETURN%GT-MESSAGE_V2
                      MESSAGE_V3        = %LTFS_RETURN%GT-MESSAGE_V3
                      MESSAGE_V4        = %LTFS_RETURN%GT-MESSAGE_V4
                    IMPORTING
                      MESSAGE           =  L_MSGTXT.
          LOOP AT IT_TXTTABLE INTO WA_TXTLINE.
            WRITE: / WA_TXTLINE.
          ENDLOOP.
          REFRESH IT_TXTTABLE.
          CONCATENATE 'Error:' WA_TXTLINE INTO WA_TXTLINE.
          WRITE: / L_MSGTXT.
        ENDLOOP.
        G_TOTAL_BAD = G_TOTAL_BAD + 1.
        SKIP.
      ENDIF.

    ELSE.
      IF L_CHANGE_FLAG NE 'X'.
        G_NOCHANGE = G_NOCHANGE + 1.
      ENDIF.
    ENDIF.
    IF L_CHANGE_FLAG EQ 'X'.
      MIN_1_CHANGE1 = 1.
    ENDIF.
  ENDLOOP.
  IF MIN_1_CHANGE = 1.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        WAIT          = 'X'
*     IMPORTING
*       RETURN        =
              .
  ENDIF.
  IF MIN_1_CHANGE = 1 OR MIN_1_CHANGE1 = 1.
    WRITE: / TEXT-003, 50 G_TOTAL_BAD,
           / TEXT-004, 50 G_TOTAL_GOOD,
           / TEXT-005, 50 G_NOCHANGE.
    LEAVE TO LIST-PROCESSING.
  ELSE.
    MESSAGE I037(ZZ) WITH 'No changes were made'.
  ENDIF.

ENDFORM.                    " DETERMINE_CHANGES

*&---------------------------------------------------------------------*
*&      Form  write_change
*&---------------------------------------------------------------------*
*      --%GTP_1866   text
*      --%GTP_%LTFS_IMP_EXP%GT_BSTMI  text
*      --%GTP_%LTFS_OUTPUT%GT_BSTMI  text
*----------------------------------------------------------------------*
FORM WRITE_CHANGE  USING    VALUE(P_1866)
                            P_OLDVAL
                            P_NEWVAL.
  DATA: C_OLDVAL(75) TYPE C,
        C_NEWVAL(75) TYPE C.
  WRITE P_OLDVAL TO C_OLDVAL.
  WRITE P_NEWVAL TO C_NEWVAL.
  CLEAR WA_TXTLINE.
  CONCATENATE TEXT-006 P_1866 TEXT-007 C_OLDVAL
              TEXT-008 C_NEWVAL INTO WA_TXTLINE
    SEPARATED BY SPACE.
  APPEND WA_TXTLINE TO IT_TXTTABLE.
ENDFORM.                    " write_change

*&---------------------------------------------------------------------*
*&      Form  convert_currency
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --%GTP_%LTFS_CONP%GT_KBETR  text
*      --%GTP_%LTFS_CONP%GT_KONWS  text
*      %LT--P_WA_IMP_EXP_SETUP  text
*      %LT--P_ENDIF  text
*----------------------------------------------------------------------*
FORM CONVERT_CURRENCY  USING    P_FOREIGN_AMNT
                                P_FOREIGN_CURR
                       CHANGING P_LOCL_AMNT.
  CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
    EXPORTING
*     CLIENT                  = SY-MANDT
      DATE                    = SY-DATUM
      FOREIGN_AMOUNT          = P_FOREIGN_AMNT
      FOREIGN_CURRENCY        = P_FOREIGN_CURR
      LOCAL_CURRENCY          = 'CAD'
*     RATE                    = 0
*     TYPE_OF_RATE            = 'M'
*     READ_TCURR              = 'X'
    IMPORTING
*     EXCHANGE_RATE           =
*     FOREIGN_FACTOR          =
      LOCAL_AMOUNT            = P_LOCL_AMNT
*     LOCAL_FACTOR            =
*     EXCHANGE_RATEX          =
*     FIXED_RATE              =
*     DERIVED_RATE_TYPE       =
    EXCEPTIONS
      NO_RATE_FOUND           = 1
      OVERFLOW                = 2
      NO_FACTORS_FOUND        = 3
      NO_SPREAD_FOUND         = 4
      DERIVED_2_TIMES         = 5
      OTHERS                  = 6.
  IF SY-SUBRC %LT%GT 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

ENDFORM.                    " convert_currency

*&---------------------------------------------------------------------*
*&      Form  export_to_excel
*&---------------------------------------------------------------------*
FORM EXPORT_TO_EXCEL .
  DATA : L_INDEX TYPE I.
  PERFORM DEFINE_XLS_HEADER USING:
*     Titre    Sorting  Data  Format Col no   Currency
*              Column   Type         in DATA  Type
      TEXT-X01 'S'      'STR' 'DFT'      1       0,
      TEXT-X02 'C'      'STR' 'DFT'      2       0,
      TEXT-X03 'C'      'STR' 'DFT'      3       0,
      TEXT-X04 'C'      'STR' 'DFT'      4       0,
      TEXT-X05 'C'      'NUM' 'NOP'      5       0,
      TEXT-X06 'C'      'STR' 'DFT'      6       0,
      TEXT-X07 'C'      'NUM' 'NOP'      7       0,
      TEXT-X08 'C'      'STR' 'DFT'      8       0,
      TEXT-X09 'C'      'STR' 'DFT'      9       0,
      TEXT-X10 'C'      'STR' 'DFT'     10       0,
      TEXT-X11 'C'      'STR' 'DFT'     11       0,
      TEXT-X12 'C'      'STR' 'DFT'     12       0,
      TEXT-X13 'C'      'STR' 'DFT'     13       0,
      TEXT-X14 'C'      'STR' 'DFT'     14       0,
      TEXT-X15 'C'      'STR' 'DFT'     15       0,
      TEXT-X16 'C'      'STR' 'DFT'     16       0,
      TEXT-X17 'C'      'STR' 'DFT'     17       0,
      TEXT-X18 'C'      'STR' 'DFT'     18       0,
      TEXT-X19 'C'      'STR' 'DFT'     19       0,
      TEXT-X20 'C'      'STR' 'DFT'     20       0,
      TEXT-X21 'C'      'NUM' 'NOP'     21       0,
      TEXT-X22 'C'      'STR' 'DFT'     22       0,
      TEXT-X23 'C'      'NUM' 'NOP'     23       0,
      TEXT-X24 'C'      'STR' 'DFT'     24       0,
      TEXT-X25 'C'      'STR' 'DFT'     25       0,
      TEXT-X26 'C'      'STR' 'DFT'     26       0,
      TEXT-X27 'C'      'STR' 'DFT'     27       0,
      TEXT-X28 'C'      'STR' 'DFT'     28       0,
      TEXT-X29 'C'      'STR' 'DFT'     29       0,
      TEXT-X30 'C'      'STR' 'DFT'     30       0,
      TEXT-X31 'C'      'STR' 'DFT'     31       0,
      TEXT-X32 'C'      'STR' 'DFT'     32       0,
      TEXT-X33 'C'      'STR' 'DFT'     33       0,
      TEXT-X34 'C'      'STR' 'DFT'     34       0.
  L_INDEX = 35.
  LOOP AT GT_MAST INTO WA_MAST.
    PERFORM DEFINE_XLS_HEADER USING
    WA_MAST-MATNR 'C' 'STR' 'DFT'     L_INDEX  0.
    L_INDEX = L_INDEX + 1.
  ENDLOOP.
*"35
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X35 'C'      'STR' 'DFT'     L_INDEX       0.
*"36
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X36 'C'      'STR' 'DFT'     L_INDEX       0.
*"37
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X37 'C'      'STR' 'DFT'     L_INDEX       0.
*"38
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X38 'C'      'STR' 'DFT'     L_INDEX       0.
*"39
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X39 'C'      'STR' 'DFT'     L_INDEX       0.
*"40
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X40 'C'      'STR' 'DFT'     L_INDEX       0.
*"41
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X41 'C'      'STR' 'DFT'     L_INDEX       0.
*”42
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X42  'C' 'NUM' 'NOP'  L_INDEX   0.
*”43
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X43 'C'      'NUM' 'NOP'     L_INDEX       0.
*“44
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X44 'C'      'NUM' 'NOP'     L_INDEX       0.
*“45
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X45 'C'      'NUM' 'NOP'     L_INDEX       0.
*“46
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X46 'C'      'STR' 'DFT'     L_INDEX       0.
*“47
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X47 'C'      'NUM' 'NOP'     L_INDEX       0.
*“48
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X48 'C'      'NUM' 'NOP'     L_INDEX       0.
*“49
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X49 'C'      'NUM' 'NOP'     L_INDEX       0.
*“50
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X50 'C'      'STR' 'DFT'     L_INDEX       0.
*“51
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X51 'C'      'STR' 'DFT'     L_INDEX       0.
*“52
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X52 'C'      'STR' 'DFT'     L_INDEX       0.
*“53
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X53 'C'      'STR' 'DFT'     L_INDEX       0.
*“54
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X54 'C'      'STR' 'DFT'     L_INDEX       0.
*“55
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X55 'C'      'STR' 'DFT'     L_INDEX       0.
*“56
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X56 'C'      'NUM' 'NOP'     L_INDEX       0.
*“57
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X57 'C'      'STR' 'DFT'     L_INDEX       0.
*“58
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X58 'C'      'NUM' 'NOP'     L_INDEX       0.
*“59
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X59 'C'      'NUM' 'NOP'     L_INDEX       0.
*“60
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X60 'C'      'STR' 'DFT'     L_INDEX       0.
*“61
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X61 'C'      'STR' 'DFT'     L_INDEX       0.
*“62
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X62 'C'      'STR' 'DFT'     L_INDEX       0.
*“63
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X63 'C'      'STR' 'DFT'     L_INDEX       0.
*“64
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X64 'C'      'STR' 'DFT'     L_INDEX       0.
*“65
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X65 'C'      'STR' 'DFT'     L_INDEX       0.
*“66
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X66 'C'      'STR' 'DFT'     L_INDEX       0.
*“67
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X67 'C'      'STR' 'DFT'     L_INDEX       0.
*“68
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X68 'C'      'STR' 'DFT'     L_INDEX       0.
*“69
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X69 'C'      'STR' 'DFT'     L_INDEX       0.
*“70
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X70 'C'      'STR' 'DFT'     L_INDEX       0.
*“71
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X71 'C'      'STR' 'DFT'     L_INDEX       0.
*“72
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X72 'C'      'STR' 'DFT'     L_INDEX       0.
*“73
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X73 'C'      'STR' 'DFT'     L_INDEX       0.
*“74
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X74 'C'      'STR' 'DFT'     L_INDEX       0.
*“75
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X75 'C'      'STR' 'DFT'     L_INDEX       0.
*“76
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X76 'C'      'STR' 'DFT'     L_INDEX       0.
*“77
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X77 'C'      'STR' 'DFT'     L_INDEX       0.
*“78
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X78 'C'      'NUM' 'NOP'     L_INDEX       0.
*“79
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X79 'C'      'NUM' 'NOP'     L_INDEX       0.
*“80
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X80 'C'      'STR' 'DFT'     L_INDEX       0.
*“81
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X81 'C'      'NUM' 'NOP'     L_INDEX       0.
*“82
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X82 'C'      'STR' 'DFT'     L_INDEX       0.
*“83
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X83 'C'      'NUM' 'NOP'     L_INDEX       0.
*“84
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X84 'C'      'NUM' 'NOP'     L_INDEX       0.
*“85
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X85 'C'      'NUM' 'NOP'     L_INDEX       0.
*“86
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X86 'C'      'NUM' 'NOP'     L_INDEX       0.
*“87
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X87 'C'      'STR' 'DFT'     L_INDEX       0.
*“88
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X88 'C'      'NUM' 'NOP'     L_INDEX       0.
*“89
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X89 'C'      'STR' 'DFT'     L_INDEX       0.
*“90
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X90 'C'      'NUM' 'NOP'     L_INDEX       0.
*“91
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X91 'C'      'NUM' 'NOP'     L_INDEX       0.
*“92
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X92 'C'      'NUM' 'NOP'     L_INDEX       0.
*“93
  L_INDEX = L_INDEX + 1.
  PERFORM DEFINE_XLS_HEADER USING
      TEXT-X93 'C'      'STR' 'DFT'     L_INDEX       0.
  CONCATENATE SY-REPID SY-DATUM SY-UZEIT INTO XTITLE
                                         SEPARATED BY SPACE.
  PERFORM TRANSFER_TO_XLS TABLES %LTGT_OUTPUT%GT
    USING 1 -1
          SY-REPID(8)
          SPACE
          SPACE
          XTITLE.
ENDFORM.                    " export_to_excel

*&---------------------------------------------------------------------*
*&      Form  TRANSFER_TO_XLS
*&---------------------------------------------------------------------*
*       Transferer dans Excel
*----------------------------------------------------------------------*
*      --%GTXMPLT_D        Donnees (table)
*      --%GTFROM           A partir de ce no de rangee
*      --%GTTO             A ce numero de rangee
*      --%GTFNAME          Nom du fichier
*      --%GTXMPL_HEADER1   Entete dans Propriete
*      --%GTXMPL_HEADER2   Entete dans Propriete
*      --%GTXTITLE         Nom pour SAP Office
*----------------------------------------------------------------------*
FORM TRANSFER_TO_XLS TABLES   XMPLT_D
                     USING    VALUE(FROM)
                              VALUE(TO)
                              VALUE(FNAME)
                              VALUE(XMPL_HEADER1)
                              VALUE(XMPL_HEADER2)
                              VALUE(XTITLE).
  CALL FUNCTION 'XXL_FULL_API'
    EXPORTING
      DATA_ENDING_AT    = TO
      DATA_STARTING_AT  = FROM
      N_HRZ_KEYS        = 1
      N_VRT_KEYS        = SCOLNO
      N_ATT_COLS        = CCOLNO
      FILENAME          = FNAME
      HEADER_1          = XMPL_HEADER1
      HEADER_2          = XMPL_HEADER2
      NO_DIALOG         = ' '
      NO_START          = ' '
      SO_TITLE          = XTITLE
    TABLES
      VKEY              = XMPLT_V
      HKEY              = XMPLT_H
      DATA              = XMPLT_D
      SEMA              = XMPLT_S
      ONLINE_TEXT       = XMPLT_O
      PRINT_TEXT        = XMPLT_P
    EXCEPTIONS
      CANCELLED_BY_USER = 1
      DATA_TOO_BIG      = 2
      DIM_MISMATCH_DATA = 3
      DIM_MISMATCH_SEMA = 4
      DIM_MISMATCH_VKEY = 5
      ERROR_IN_HKEY     = 6
      ERROR_IN_SEMA     = 7
      FILE_OPEN_ERROR   = 8
      FILE_WRITE_ERROR  = 9
      INV_DATA_RANGE    = 10
      INV_WINSYS        = 11
      INV_XXL           = 12
      OTHERS            = 13.
  WRITE: / 'XXL_FULL_API:', SY-SUBRC .
ENDFORM.                    " TRANSFER_TO_XLS
*&---------------------------------------------------------------------*
*&      Form  DEFINE_XLS_HEADER
*&---------------------------------------------------------------------*
*       Definir les colonnes pour Excel
*----------------------------------------------------------------------*
*      --%GTTEXT   Texte de l'entete
*      --%GTXLSCT  Type de colonne (Trier "S" ou non "C")
*      --%GTXLSTP  Type de donnees
*      --%GTXLSOP  Compression
*      --%GTXLSSC  No colonne dans Data
*      --%GTXLSCR  Type de monnaie
*----------------------------------------------------------------------*
FORM DEFINE_XLS_HEADER USING VALUE(TEXT)
                             VALUE(XLSCT)
                             VALUE(XLSTP)
                             VALUE(XLSOP)
                             VALUE(XLSSC)
                             VALUE(XLSCR).
  CASE XLSCT.
    WHEN 'S'.
      ADD 1 TO SCOLNO.
      XMPLT_V-COL_NO     = SCOLNO.
      XMPLT_V-COL_NAME   = TEXT.
      APPEND XMPLT_V.
    WHEN 'C'.
      ADD 1 TO CCOLNO.
      XMPLT_H-ROW_NO     = 1.
      XMPLT_H-COL_NO     = CCOLNO.
      XMPLT_H-COL_NAME   = TEXT.
      APPEND XMPLT_H.
  ENDCASE.
  ADD 1 TO XCOLNO.
  XMPLT_S-COL_NO     = XCOLNO.
  XMPLT_S-COL_TYP    = XLSTP.
  XMPLT_S-COL_OPS    = XLSOP.
  XMPLT_S-COL_SRC    = XLSSC.
  XMPLT_S-COL_CUR    = XLSCR.
  APPEND XMPLT_S.
ENDFORM.                    " DEFINE_XLS_HEADER

*&---------------------------------------------------------------------*
*&      Form  set_event_handlers_local
*&---------------------------------------------------------------------*
FORM SET_EVENT_HANDLERS_LOCAL .
*  set handler event_receiver-%GTon_user_command              for grid1.
ENDFORM.                    " set_event_handlers_local

*&---------------------------------------------------------------------*
*&      Form  get_warehouse_data
*&---------------------------------------------------------------------*
FORM GET_WAREHOUSE_DATA .
  SELECT SINGLE LGBKZ LTKZE LTKZA BSSKZ FROM MLGN INTO
                           (WA_IMP_EXP-LGBKZ, WA_IMP_EXP-LTKZE,
                             WA_IMP_EXP-LTKZA, WA_IMP_EXP-BSSKZ)
                             WHERE MATNR EQ %LTFS_MARC%GT-MATNR
                               AND LGNUM EQ P_LGNUM.
  SELECT SINGLE LGPLA FROM MLGT INTO WA_IMP_EXP-LGPLA
                             WHERE MATNR EQ %LTFS_MARC%GT-MATNR
                               AND LGNUM EQ P_LGNUM
                               AND LGTYP EQ WA_IMP_EXP-LTKZE.
ENDFORM.                    " get_warehouse_data

*&---------------------------------------------------------------------*
*&      Form  create_dynamic_table
*&---------------------------------------------------------------------*
FORM CREATE_DYNAMIC_TABLE .
  FIELD-SYMBOLS : %LTL_FIELD%GT TYPE ANY.
  DATA : L_COL_POS TYPE I VALUE 1,
         L_SPCHAR TYPE C.
  DATA : L_INDEX_TO TYPE I,
         L_INDEX_FROM TYPE I,
         L_TABIX TYPE I.
  FIELD-SYMBOLS : %LTFS%GT, %LTFS1%GT.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      I_STRUCTURE_NAME       = 'ZPPLAN_DOWNL_UPL_STRUCT1'
    CHANGING
      CT_FIELDCAT            = IDETAILS
    EXCEPTIONS
      INCONSISTENT_INTERFACE = 1
      PROGRAM_ERROR          = 2
      OTHERS                 = 3.
  IF SY-SUBRC %LT%GT 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
*ref_table_des ?=
*      cl_abap_typedescr=%GTdescribe_by_name( 'YPPLAN_DOWNL_UPL_STRUCT1' )
  .
*      idetails[] = ref_table_des-%GTcomponents[].
  LOOP AT IDETAILS INTO XDETAILS FROM 1 TO 34.
    CLEAR XFC.
*    xfc-fieldname = xdetails-name .
*    xfc-scrtext_l = xdetails-name.
*    xfc-datatype = xdetails-type_kind.
*    xfc-inttype = xdetails-type_kind.
*    xfc-intlen = xdetails-length.
*    xfc-decimals = xdetails-decimals.
    MOVE XDETAILS TO XFC.
    XFC-COL_POS = L_COL_POS.
    APPEND XFC TO IFC.
    L_COL_POS = L_COL_POS + 1.
  ENDLOOP.
  IF NOT RB_DOWNL IS INITIAL.
    LOOP AT GT_MAST INTO WA_MAST.
      CLEAR XFC.
      DO.
        IF WA_MAST-MATNR CA '.@!^&(),:;/|\=`~[]{}'.
          L_SPCHAR = WA_MAST-MATNR+SY-FDPOS(1).
          REPLACE L_SPCHAR WITH '-' INTO WA_MAST-MATNR.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.

      XFC-FIELDNAME = WA_MAST-MATNR.
      CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
        EXPORTING
          INPUT  = WA_MAST-MATNR
        IMPORTING
          OUTPUT = WA_MAST-MATNR.

      XFC-SCRTEXT_L = WA_MAST-MATNR.
      XFC-DATATYPE = 'C'.
      XFC-INTTYPE = 'C'.
      XFC-INTLEN = 3.
      XFC-DECIMALS = 0.
      XFC-COL_POS = L_COL_POS.
      APPEND XFC TO IFC.
      L_COL_POS = L_COL_POS + 1.
    ENDLOOP.
  ELSE.
    CLEAR XFC_BOMS.
    LOOP AT IFC_BOMS INTO XFC_BOMS.
      CLEAR XFC.
      MOVE XFC_BOMS TO XFC.
      APPEND XFC TO IFC.
      L_COL_POS = L_COL_POS + 1.
      CLEAR XFC_BOMS.
    ENDLOOP.
  ENDIF.
  LOOP AT IDETAILS INTO XDETAILS FROM 35 TO 93.
    CLEAR XFC.
*    xfc-fieldname = xdetails-name .
*    xfc-scrtext_l = xdetails-name.
*    xfc-datatype = xdetails-type_kind.
*    xfc-inttype = xdetails-type_kind.
*    xfc-intlen = xdetails-length.
*    xfc-decimals = xdetails-decimals.
    MOVE XDETAILS TO XFC.
    XFC-COL_POS = L_COL_POS.
    APPEND XFC TO IFC.
    L_COL_POS = L_COL_POS + 1.
  ENDLOOP.
  DESCRIBE TABLE IFC LINES L_INDEX_TO.
  L_INDEX_FROM = L_INDEX_TO - 3.
  LOOP AT IFC INTO XFC FROM L_INDEX_FROM TO L_INDEX_TO.
    XFC-NO_OUT = ' '.
    MODIFY IFC FROM XFC.
  ENDLOOP.
  CALL METHOD CL_ALV_TABLE_CREATE=%GTCREATE_DYNAMIC_TABLE
    EXPORTING
      I_STYLE_TABLE   = 'X'
      IT_FIELDCATALOG = IFC
    IMPORTING
      EP_TABLE        = DY_TABLE.
  ASSIGN DY_TABLE-%GT* TO %LTGT_OUTPUT%GT.
  CREATE DATA DY_LINE LIKE LINE OF %LTGT_OUTPUT%GT.
  ASSIGN DY_LINE-%GT* TO %LTWA_OUTPUT%GT.
*sort gt_output by matnr prvbe.
  CLEAR WA_OUTPUT.
  LOOP AT GT_OUTPUT INTO WA_OUTPUT.
    CLEAR %LTWA_OUTPUT%GT.
    MOVE-CORRESPONDING WA_OUTPUT TO %LTWA_OUTPUT%GT.
    APPEND %LTWA_OUTPUT%GT TO %LTGT_OUTPUT%GT.
    CLEAR WA_OUTPUT.
  ENDLOOP.
  IF RB_DOWNL IS INITIAL.
    LOOP AT %LTGT_BOMS%GT ASSIGNING %LTWA_BOMS%GT.
      L_TABIX = SY-TABIX.
      READ TABLE %LTGT_OUTPUT%GT ASSIGNING %LTWA_OUTPUT%GT INDEX L_TABIX.
      LOOP AT IFC_BOMS INTO XFC_BOMS.
        ASSIGN COMPONENT XFC_BOMS-FIELDNAME OF STRUCTURE %LTWA_BOMS%GT TO
%LTFS%GT.
        ASSIGN COMPONENT XFC_BOMS-FIELDNAME OF STRUCTURE %LTWA_OUTPUT%GT
TO %LTFS1%GT.
        IF %LTFS%GT IS ASSIGNED AND %LTFS1%GT IS ASSIGNED.
          %LTFS1%GT = %LTFS%GT.
        ENDIF.
      ENDLOOP.
      MODIFY %LTGT_OUTPUT%GT FROM %LTWA_OUTPUT%GT INDEX L_TABIX.
    ENDLOOP.
  ENDIF.
ENDFORM.                    " create_dynamic_table

*&---------------------------------------------------------------------*
*&      Form  explode_active_boms
*&---------------------------------------------------------------------*
FORM EXPLODE_ACTIVE_BOMS .

  DATA : L_BASE_STUFE TYPE STPOX-STUFE,
         L_BOM_USAGE TYPE STZU-STLAN VALUE '1',
         L_INDEX TYPE I,
         L_TABIX TYPE I,
         L_EXPLODE(1) TYPE C VALUE SPACE,
         L_VALID(1) TYPE C VALUE SPACE.

  SELECT MATNR FROM MAST INTO TABLE GT_MAST WHERE MATNR IN S_AMATNR.
  SORT GT_MAST BY MATNR.
* delete gt_mast from 21.
  DELETE ADJACENT DUPLICATES FROM GT_MAST.                  "from 21.

  L_TABIX = 1.
  REFRESH GT_BOM_COMP.
  LOOP AT GT_MAST INTO WA_MAST.
    REFRESH : GT_STPOX, GT_PROCUREMENT.
    CLEAR WA_STPOX.
    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
     EXPORTING
       AUMNG                       = 0
       CAPID                       = P_CAPID
       DATUV                       = P_DATUV
       MKTLS                       = 'X'
       MEHRS                       = 'X'
       MKMAT                       = ' '
       MTNRV                       = WA_MAST-MATNR
       STLAN                       = L_BOM_USAGE
       WERKS                       = S_WERKS-LOW
      TABLES
       STB                         = GT_STPOX
*   MATCAT                      =
     EXCEPTIONS
       ALT_NOT_FOUND               = 1
       CALL_INVALID                = 2
       MATERIAL_NOT_FOUND          = 3
       MISSING_AUTHORIZATION       = 4
       NO_BOM_FOUND                = 5
       NO_PLANT_DATA               = 6
       NO_SUITABLE_BOM_FOUND       = 7
       CONVERSION_ERROR            = 8
       OTHERS                      = 9
              .
    LOOP AT GT_STPOX INTO WA_STPOX.
      WA_STPOX-INDEX = L_TABIX.
      MODIFY GT_STPOX FROM WA_STPOX.
      CLEAR WA_BOM_COMP.
      WA_BOM_COMP-MAT_BOM = WA_MAST-MATNR.
      WA_BOM_COMP-MAT_COMP = WA_STPOX-IDNRK.
      WA_BOM_COMP-PRVBE = WA_STPOX-PRVBE.
      WA_BOM_COMP-VALID = ' '.
      APPEND WA_BOM_COMP TO GT_BOM_COMP.
      CLEAR WA_STPOX.
      L_TABIX = L_TABIX + 1.
    ENDLOOP.
*sort gt_stpox by index.
    SELECT MATNR BESKZ SOBSL FROM MARC INTO TABLE GT_PROCUREMENT
                                     FOR ALL ENTRIES IN GT_STPOX
                                       WHERE MATNR = GT_STPOX-IDNRK
                                         AND WERKS = S_WERKS-LOW.
    CLEAR : WA_STPOX.
    LOOP AT GT_STPOX INTO WA_STPOX.
      IF SY-TABIX = 1 OR WA_STPOX-STUFE = 1.
        CLEAR WA_BOM_COMP.
        READ TABLE GT_BOM_COMP INTO WA_BOM_COMP INDEX WA_STPOX-INDEX.
        IF WA_BOM_COMP-MAT_BOM = WA_MAST-MATNR AND
           WA_BOM_COMP-MAT_COMP = WA_STPOX-IDNRK.
          WA_BOM_COMP-VALID = 'X'.
          MODIFY GT_BOM_COMP FROM WA_BOM_COMP INDEX WA_STPOX-INDEX.
        ENDIF.
      ENDIF.
      L_BASE_STUFE = WA_STPOX-STUFE + 1.
      L_INDEX = WA_STPOX-INDEX.
      CLEAR WA_PROCUREMENT.
      READ TABLE GT_PROCUREMENT INTO WA_PROCUREMENT WITH KEY
                                     MATNR = WA_STPOX-IDNRK.
      IF WA_PROCUREMENT-BESKZ NE 'F' OR ( WA_PROCUREMENT-BESKZ EQ 'F' AND
                                      ( WA_PROCUREMENT-SOBSL EQ 'SC' OR
                                        WA_PROCUREMENT-SOBSL EQ 'S2' ) ).
        L_EXPLODE = 'X'.
      ENDIF.
      CLEAR WA_BOM_COMP.
      READ TABLE GT_BOM_COMP INTO WA_BOM_COMP INDEX WA_STPOX-INDEX.
      IF WA_BOM_COMP-MAT_BOM = WA_MAST-MATNR AND
         WA_BOM_COMP-MAT_COMP = WA_STPOX-IDNRK AND
         WA_BOM_COMP-VALID = 'X'.
        L_VALID = 'X'.
      ENDIF.
      CLEAR WA_STPOX.
      LOOP AT GT_STPOX INTO WA_STPOX WHERE INDEX %GT L_INDEX.
        IF WA_STPOX-STUFE = L_BASE_STUFE.
          IF L_EXPLODE = 'X' AND L_VALID = 'X'.
            CLEAR WA_BOM_COMP.
            READ TABLE GT_BOM_COMP INTO WA_BOM_COMP INDEX
WA_STPOX-INDEX.
            IF WA_BOM_COMP-MAT_BOM = WA_MAST-MATNR AND
               WA_BOM_COMP-MAT_COMP = WA_STPOX-IDNRK.
              WA_BOM_COMP-VALID = 'X'.
              MODIFY GT_BOM_COMP FROM WA_BOM_COMP INDEX
WA_STPOX-INDEX.
            ENDIF.
          ENDIF.
        ELSEIF WA_STPOX-STUFE %LT= L_BASE_STUFE.
          EXIT.
        ENDIF.
        CLEAR WA_STPOX.
      ENDLOOP.
      CLEAR : WA_STPOX, L_EXPLODE, L_VALID.
    ENDLOOP.
  ENDLOOP.
  IF NOT GT_BOM_COMP[] IS INITIAL.
    DELETE GT_BOM_COMP FROM 1 WHERE NOT VALID EQ 'X'.
  ENDIF.
ENDFORM.                    " explode_active_boms

*&---------------------------------------------------------------------*
*&      Form  fill_dynamic_columns
*&---------------------------------------------------------------------*
FORM FILL_DYNAMIC_COLUMNS .
  FIELD-SYMBOLS : %LTL_MATNR%GT TYPE ANY,
                  %LTL_PRVBE%GT TYPE ANY,
                  %LTL_FIELD%GT TYPE ANY,
                  %LTL_COMMON%GT TYPE ANY.
  TYPES : BEGIN OF TY_COMMON,
            MATNR TYPE MARA-MATNR,
          END OF TY_COMMON.
  DATA : GT_COMMON TYPE TABLE OF TY_COMMON,
         WA_COMMON LIKE LINE OF GT_COMMON.
  DATA : L_MATNR TYPE MARA-MATNR,
         L_COMMON TYPE I VALUE 0,
         L_SPCHAR TYPE C.
  CLEAR L_MATNR.
  LOOP AT %LTGT_OUTPUT%GT ASSIGNING %LTWA_OUTPUT%GT.
    ASSIGN COMPONENT 'MATNR' OF STRUCTURE %LTWA_OUTPUT%GT TO %LTL_MATNR%GT.
    ASSIGN COMPONENT 'PRVBE' OF STRUCTURE %LTWA_OUTPUT%GT TO %LTL_PRVBE%GT.
    IF SY-TABIX = 1.
      L_MATNR = %LTL_MATNR%GT.
    ELSEIF L_MATNR NE %LTL_MATNR%GT.
      IF L_COMMON GT 1.
        CLEAR WA_COMMON.
        WA_COMMON-MATNR = L_MATNR.
        APPEND WA_COMMON TO GT_COMMON.
      ENDIF.
      L_MATNR = %LTL_MATNR%GT.
      L_COMMON = 0.
    ENDIF.
    CLEAR WA_MAST.
    LOOP AT GT_MAST INTO WA_MAST.
      CLEAR WA_BOM_COMP.
      READ TABLE GT_BOM_COMP INTO WA_BOM_COMP
                            WITH KEY MAT_BOM = WA_MAST-MATNR
                                     MAT_COMP = %LTL_MATNR%GT
                                     PRVBE = %LTL_PRVBE%GT.
      IF SY-SUBRC EQ 0.
*           CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
*             EXPORTING
*               INPUT         = wa_bom_comp-mat_bom
*             IMPORTING
*               OUTPUT        = wa_bom_comp-mat_bom
*                      .

        DO.
          IF WA_BOM_COMP-MAT_BOM CA '.@!^&(),:;/|\=`~[]{}'.
            L_SPCHAR = WA_BOM_COMP-MAT_BOM+SY-FDPOS(1).
            REPLACE L_SPCHAR WITH '-' INTO WA_BOM_COMP-MAT_BOM.
          ELSE.
            EXIT.
          ENDIF.
        ENDDO.
        ASSIGN COMPONENT WA_BOM_COMP-MAT_BOM OF STRUCTURE
                                    %LTWA_OUTPUT%GT TO %LTL_FIELD%GT.
        IF SY-SUBRC EQ 0.
          %LTL_FIELD%GT = 'X'.
          L_COMMON = L_COMMON + 1.
        ENDIF.
      ENDIF.
      CLEAR WA_MAST.
    ENDLOOP.
  ENDLOOP.
  LOOP AT %LTGT_OUTPUT%GT ASSIGNING %LTWA_OUTPUT%GT.
    ASSIGN COMPONENT 'MATNR' OF STRUCTURE %LTWA_OUTPUT%GT TO %LTL_MATNR%GT.
    READ TABLE GT_COMMON INTO WA_COMMON WITH KEY MATNR = %LTL_MATNR%GT
                              TRANSPORTING NO FIELDS.
    IF SY-SUBRC EQ 0.
      ASSIGN COMPONENT 'COMMON' OF STRUCTURE
                                   %LTWA_OUTPUT%GT TO %LTL_COMMON%GT.
      IF SY-SUBRC EQ 0.
        %LTL_COMMON%GT = 'X'.
      ENDIF.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " fill_dynamic_columns

*&---------------------------------------------------------------------*
*&      Form  get_supply_area
*&---------------------------------------------------------------------*
FORM GET_SUPPLY_AREA .
  REFRESH R_PRVBE.
  CLEAR: WA_BOM_COMP, R_PRVBE.
  LOOP AT GT_BOM_COMP INTO WA_BOM_COMP WHERE MAT_COMP = %LTFS_MARC%GT-MATNR.
    IF SY-TABIX = 1.
      WA_IMP_EXP-PRVBE = WA_BOM_COMP-PRVBE.
      PERFORM GET_T_PFEP.
      PERFORM GET_LPK3_DATA.
      APPEND WA_IMP_EXP TO GT_IMP_EXP.
      CLEAR R_PRVBE.
      R_PRVBE-SIGN = 'I'.
      R_PRVBE-OPTION = 'EQ'.
      R_PRVBE-LOW = WA_BOM_COMP-PRVBE.
      APPEND R_PRVBE.
    ELSEIF ( NOT WA_BOM_COMP-PRVBE IN R_PRVBE ) OR R_PRVBE IS INITIAL.
      WA_IMP_EXP-PRVBE = WA_BOM_COMP-PRVBE.
      PERFORM GET_T_PFEP.
      PERFORM GET_LPK3_DATA.
      APPEND WA_IMP_EXP TO GT_IMP_EXP.
      CLEAR R_PRVBE.
      R_PRVBE-SIGN = 'I'.
      R_PRVBE-OPTION = 'EQ'.
      R_PRVBE-LOW = WA_BOM_COMP-PRVBE.
      APPEND R_PRVBE.
    ENDIF.
  ENDLOOP.
  IF R_PRVBE IS INITIAL.
    APPEND WA_IMP_EXP TO GT_IMP_EXP.
  ENDIF.

*refresh gt_stpo1.
*select datuv prvbe from stpo into table gt_stpo1
*                   where idnrk = %LTfs_marc%GT-matnr.
*if sy-subrc eq 0.
*  sort gt_stpo1 by datuv descending.
*  clear wa_stpo1.
*  read table gt_stpo1 into wa_stpo1 index 1.
*  wa_imp_exp-prvbe = wa_stpo1-prvbe.
*endif.

*clear wa_stpo.
*wa_stpo-matnr = %LTfs_marc%GT-matnr.
*wa_stpo-prvbe = wa_stpo1-prvbe.
*append wa_stpo to gt_stpo.

ENDFORM.                    " get_supply_area

*&---------------------------------------------------------------------*
*&      Form  get_t_pfep
*&---------------------------------------------------------------------*
FORM GET_T_PFEP .
  DATA : L_VTLIN TYPE VTENTRIES-VTLINNOINT,
         L_MATNR TYPE MARA-MATNR.
  CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
    EXPORTING
      INPUT  = %LTFS_MARC%GT-MATNR
    IMPORTING
      OUTPUT = L_MATNR.

  CALL FUNCTION 'CARD_TABLE_READ_ENTRIES'
    EXPORTING
      VAR_TABLE             = 'T_PFEP'
*   CHANGE_NO             =
*   DATE                  =
    TABLES
      VAR_TAB_ENTRIES       = GT_VTENTRIES
* EXCEPTIONS
*   ERROR                 = 1
*   OTHERS                = 2
            .
  IF SY-SUBRC %LT%GT 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  CLEAR WA_VTENTRIES.
  LOOP AT GT_VTENTRIES INTO WA_VTENTRIES WHERE VTVALUE = L_MATNR.
    L_VTLIN = WA_VTENTRIES-VTLINNOINT.
    IF NOT WA_IMP_EXP-PRVBE IS INITIAL.
      READ TABLE GT_VTENTRIES INTO WA_VTENTRIES WITH KEY VTLINNOINT =
    L_VTLIN
                             VTVALUE = WA_IMP_EXP-PRVBE TRANSPORTING NO
    FIELDS.
      IF SY-SUBRC EQ 0.
        EXIT.
      ENDIF.
    ELSE.
      EXIT.
    ENDIF.
    CLEAR WA_VTENTRIES.
  ENDLOOP.
  CLEAR : WA_IMP_EXP-PFEP_FREQUENCY,
          WA_IMP_EXP-PFEP_RACK,
          WA_IMP_EXP-PFEP_ROUTE,
          WA_IMP_EXP-PFEP_CONTENANT,
          WA_IMP_EXP-PFEP_QTE_MAX_CONTENANT,
          WA_IMP_EXP-PFEP_PIECE_KIT.
  LOOP AT GT_VTENTRIES INTO WA_VTENTRIES WHERE VTLINNOINT EQ L_VTLIN.
    CASE WA_VTENTRIES-VTCHARACT.
      WHEN 'PFEP_FREQUENCY'.
        WA_IMP_EXP-PFEP_FREQUENCY = WA_VTENTRIES-VTVALUE.
      WHEN 'PFEP_RACK'.
        WA_IMP_EXP-PFEP_RACK = WA_VTENTRIES-VTVALUE.
      WHEN 'PFEP_ROUTE'.
        WA_IMP_EXP-PFEP_ROUTE = WA_VTENTRIES-VTVALUE.
      WHEN 'PFEP_CONTENANT'.
        WA_IMP_EXP-PFEP_CONTENANT = WA_VTENTRIES-VTVALUE.
      WHEN 'PFEP_QTE_MAX_CONTENANT'.
        WA_IMP_EXP-PFEP_QTE_MAX_CONTENANT = WA_VTENTRIES-VTVALUE.
      WHEN 'PFEP_PIECE_KIT'.
        WA_IMP_EXP-PFEP_PIECE_KIT = WA_VTENTRIES-VTVALUE.
    ENDCASE.
  ENDLOOP.
ENDFORM.                    " get_t_pfep
*&---------------------------------------------------------------------*
*&      Form  get_supplier
*&---------------------------------------------------------------------*
FORM GET_SUPPLIER .
*data : l_plnnr type mapl-plnnr,
*       l_plnkn type plas-plnkn,
*       l_lines type i.
*
*select single plnnr from mapl into l_plnnr where matnr =
* %LTfs_marc%GT-matnr and werks = s_werks-low.
*
*select plnal statu datuv from plko into table gt_plko
*                                    where plnnr = l_plnnr
*                                      and plnty = 'N'.
*
*clear wa_plko.
*loop at gt_plko into wa_plko where statu = '4'
*                               and datuv %LT= sy-datum.
*exit.
*endloop.
*
*select single plnkn from plas into l_plnkn where plnty = 'N'
*                                      and plnnr = l_plnnr
*                                      and plnal = wa_plko-plnal
*                                      and loekz ne 'X'.
*
*select arbid from plpo into table gt_plpo where plnty = 'N'
*                                            and plnnr = l_plnnr
*                                            and plnkn = l_plnkn.
*
*describe table gt_plpo lines l_lines.
*read table gt_plpo into wa_plpo index l_lines.
*
*select single arbpl from crhd into wa_imp_exp-supplier where objty =
* 'A'
*and objid =  wa_plpo-arbid.
*
ENDFORM.                    " get_supplier

*&---------------------------------------------------------------------*
*&      Form  get_classification
*&---------------------------------------------------------------------*
FORM GET_CLASSIFICATION .
  DATA : GT_CLASS TYPE TABLE OF SCLASS,
         GT_OBJECTDATA TYPE TABLE OF CLOBJDAT,
         WA_OBJECTDATA LIKE LINE OF GT_OBJECTDATA.
  DATA : L_OBJECT TYPE AUSP-OBJEK.
  CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
    EXPORTING
      INPUT        = %LTFS_MARC%GT-MATNR
    IMPORTING
      OUTPUT       = %LTFS_MARC%GT-MATNR
    EXCEPTIONS
      LENGTH_ERROR = 1
      OTHERS       = 2.
  IF SY-SUBRC %LT%GT 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  MOVE %LTFS_MARC%GT-MATNR TO L_OBJECT.
  CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
    EXPORTING
      CLASS                      = 'CL_PFEP'
      CLASSTEXT                  = 'X'
      CLASSTYPE                  = '001'
      CLINT                      = 0
      FEATURES                   = 'X'
      LANGUAGE                   = SY-LANGU
      OBJECT                     = L_OBJECT
      KEY_DATE                   = SY-DATUM
      INITIAL_CHARACT            = 'X'
      CHANGE_SERVICE_CLF         = 'X'
    TABLES
      T_CLASS                    = GT_CLASS
      T_OBJECTDATA               = GT_OBJECTDATA
*   I_SEL_CHARACTERISTIC       =
*   T_NO_AUTH_CHARACT          =
   EXCEPTIONS
     NO_CLASSIFICATION          = 1
     NO_CLASSTYPES              = 2
     INVALID_CLASS_TYPE         = 3
     OTHERS                     = 4
            .
  IF SY-SUBRC %LT%GT 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

*CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
*  EXPORTING
*   CLASS                      = 'CL_PFEP'
*   CLASSTEXT                  = 'X'
*   CLASSTYPE                  = '001'
*   CLINT                      = 0
*   FEATURES                   = 'X'
*   LANGUAGE                   = sy-langu
*   OBJECT                     = l_object
*   KEY_DATE                   = sy-datum
*   INITIAL_CHARACT            = 'X'
*   CHANGE_SERVICE_CLF         = 'X'
*  TABLES
*    T_CLASS                    = gt_class
*    T_OBJECTDATA               = gt_objectdata
**   I_SEL_CHARACTERISTIC       =
**   T_NO_AUTH_CHARACT          =
*                    .
*IF SY-SUBRC %LT%GT 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
**         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
  CLEAR WA_OBJECTDATA.
  LOOP AT GT_OBJECTDATA INTO WA_OBJECTDATA.
    CASE WA_OBJECTDATA-ATNAM.
      WHEN 'PFEP_METHOD_TRANSPORT'.
        WA_IMP_EXP-PFEP_METHOD_TRANSPORT = WA_OBJECTDATA-AUSP1.
      WHEN 'PFEP_OCCURENCE_MAX'.
        WA_IMP_EXP-PFEP_OCCURENCE_MAX = WA_OBJECTDATA-AUSP1.
      WHEN 'PFEP_REVISON_DATE'.
        WA_IMP_EXP-PFEP_REVISON_DATE = WA_OBJECTDATA-AUSP1.
      WHEN 'PFEP_CONS_SERVICE'.
        WA_IMP_EXP-PFEP_CONS_SERVICE = WA_OBJECTDATA-AUSP1.
      WHEN 'PFEP_ABC_CONSOMMATION'.
        WA_IMP_EXP-PFEP_ABC_CONSOMMATION = WA_OBJECTDATA-AUSP1.
      WHEN 'PFEP_CONT_INTERNE_HAUTEUR'.
        WA_IMP_EXP-PFEP_CONT_INTERNE_HAUTEUR = WA_OBJECTDATA-AUSP1.
      WHEN 'PFEP_CONT_INTERNE_LARGUER'.
        WA_IMP_EXP-PFEP_CONT_INTERNE_LARGUER = WA_OBJECTDATA-AUSP1.
      WHEN 'PFEP_CONT_INTERNE_PROFONDUER'.
        WA_IMP_EXP-PFEP_CONT_INTERNE_PROFONDUER = WA_OBJECTDATA-AUSP1.
      WHEN 'PFEP_CONT_FOURN_HAUTEUR'.
        WA_IMP_EXP-PFEP_CONT_FOURN_HAUTEUR = WA_OBJECTDATA-AUSP1.
      WHEN 'PFEP_CONT_FOURN_LARGEUR'.
        WA_IMP_EXP-PFEP_CONT_FOURN_LARGEUR = WA_OBJECTDATA-AUSP1.
      WHEN 'PFEP_CONT_FOURN_PROFONDEUR'.
        WA_IMP_EXP-PFEP_CONT_FOURN_PROFONDEUR = WA_OBJECTDATA-AUSP1.
      WHEN 'PFEP_PIECE_HAUTEUR'.
        WA_IMP_EXP-PFEP_PIECE_HAUTEUR = WA_OBJECTDATA-AUSP1.
      WHEN 'PFEP_PIECE_LARGEUR'.
        WA_IMP_EXP-PFEP_PIECE_LARGEUR = WA_OBJECTDATA-AUSP1.
      WHEN 'PFEP_PIECE_PROFONDEUR'.
        WA_IMP_EXP-PFEP_PIECE_PROFONDEUR = WA_OBJECTDATA-AUSP1.
    ENDCASE.
    CLEAR WA_OBJECTDATA.
  ENDLOOP.
ENDFORM.                    " get_classification

*&---------------------------------------------------------------------*
*&      Form  get_lpk3_data
*&---------------------------------------------------------------------*
FORM GET_LPK3_DATA .
  SELECT SINGLE BERKZ LGNUM LGTYP LGPLA FROM PKHD
  INTO CORRESPONDING FIELDS OF WA_IMP_EXP
* ( wa_imp_exp-berkz,
*        wa_imp_exp-lgnum,
*        wa_imp_exp-lgtyp,
*        wa_imp_exp-ccr_lgpla )
  WHERE MATNR = %LTFS_MARC%GT-MATNR
    AND WERKS = S_WERKS-LOW
    AND PRVBE = WA_IMP_EXP-PRVBE.
ENDFORM.                    " get_lpk3_data

*&---------------------------------------------------------------------*
*&      Form  get_consumption
*&---------------------------------------------------------------------*
FORM GET_CONSUMPTION .
  DATA : L_MENGE TYPE MSEG-MENGE,
         L_MONTH TYPE I,
         L_LINES TYPE I.
  RANGES : R_BUDAT FOR MKPF-BUDAT.

  SELECT MBLNR MJAHR BUDAT FROM MKPF INTO TABLE GT_MKPF WHERE BUDAT IN
  S_BUDAT.
  SELECT MBLNR MJAHR MENGE FROM MSEG INTO TABLE GT_MSEG FOR ALL ENTRIES IN
   GT_MKPF
                                    WHERE MBLNR = GT_MKPF-MBLNR
                                      AND MJAHR = GT_MKPF-MJAHR
                                      AND BWART IN S_BWART
                                      AND MATNR = %LTFS_MARC%GT-MATNR.

  CLEAR L_MENGE.
  REFRESH GT_BUDAT.
  LOOP AT GT_MSEG INTO WA_MSEG.
    L_MENGE = L_MENGE + WA_MSEG-MENGE.
    READ TABLE GT_MKPF INTO WA_MKPF WITH KEY MBLNR = WA_MSEG-MBLNR
                                             MJAHR = WA_MSEG-MJAHR.
    CLEAR WA_BUDAT.
    WA_BUDAT-BUDAT = WA_MKPF-BUDAT.
    APPEND WA_BUDAT TO GT_BUDAT.
  ENDLOOP.
  SORT GT_BUDAT BY BUDAT.
  REFRESH R_BUDAT.
  LOOP AT GT_BUDAT INTO WA_BUDAT.
    L_MONTH = WA_BUDAT-BUDAT+4(2).
    IF SY-TABIX EQ 1.
      CLEAR R_BUDAT.
      R_BUDAT-SIGN = 'I'.
      R_BUDAT-OPTION = 'EQ'.
      R_BUDAT-LOW = L_MONTH.
      APPEND R_BUDAT.
    ELSEIF NOT L_MONTH IN R_BUDAT.
      CLEAR R_BUDAT.
      R_BUDAT-SIGN = 'I'.
      R_BUDAT-OPTION = 'EQ'.
      R_BUDAT-LOW = L_MONTH.
      APPEND R_BUDAT.
    ENDIF.
  ENDLOOP.
  DESCRIBE TABLE R_BUDAT LINES L_LINES.
  WA_IMP_EXP-NO_OF_MONTHS = L_LINES.
  WA_IMP_EXP-CONSUMPTION = L_MENGE.
ENDFORM.                    " get_consumption
*&---------------------------------------------------------------------*
*&      Form  get_sales_status
*&---------------------------------------------------------------------*
FORM GET_SALES_STATUS .
  SELECT SINGLE VMSTA FROM MVKE INTO WA_IMP_EXP-VMSTA WHERE MATNR =
  %LTFS_MARC%GT-MATNR
                                                        AND VKORG =
  P_VKORG
                                                        AND VTWEG =
  P_VTWEG
                                                        AND VMSTA IN
  S_VMSTA.
ENDFORM.                    " get_sales_status

*&---------------------------------------------------------------------*
*&      Form  set_custom_editable_grid
*&---------------------------------------------------------------------*
FORM SET_CUSTOM_EDITABLE_GRID .

  FIELD-SYMBOLS: %LTL_CELLTAB%GT TYPE ANY,
                 %LTL_MATNR%GT TYPE ANY.
  DATA: L_MATNR LIKE MARA-MATNR,
        L_MATNR1 LIKE MARA-MATNR,
        L_TABIX LIKE SY-TABIX,
        L_FLAG TYPE C,
        L_ENABLED TYPE C.
  RANGES : R_MATNR FOR MARA-MATNR.
  REFRESH R_MATNR.
  LOOP AT %LTGT_OUTPUT%GT ASSIGNING %LTWA_OUTPUT%GT.
    L_TABIX = SY-TABIX.
    CLEAR L_FLAG.
    ASSIGN COMPONENT 'MATNR' OF STRUCTURE %LTWA_OUTPUT%GT TO %LTL_MATNR%GT.
    L_MATNR = %LTL_MATNR%GT.
    IF SY-TABIX EQ 1.  "and not l_matnr in r_matnr.
      L_ENABLED = 'X'.
      REFRESH GT_STYLE.
      ASSIGN COMPONENT 'XYZSTYLEZYX' OF STRUCTURE %LTWA_OUTPUT%GT TO
   %LTL_CELLTAB%GT.
      PERFORM CHANGE_STYLE USING L_ENABLED CHANGING %LTL_CELLTAB%GT.
      CLEAR R_MATNR.
      R_MATNR-SIGN = 'I'.
      R_MATNR-OPTION = 'EQ'.
      R_MATNR-LOW = L_MATNR.
      APPEND R_MATNR.
      L_FLAG = 'X'.
    ELSE.
      IF NOT L_MATNR IN R_MATNR.
        L_ENABLED = 'X'.
        REFRESH GT_STYLE.
        ASSIGN COMPONENT 'XYZSTYLEZYX' OF STRUCTURE %LTWA_OUTPUT%GT TO
%LTL_CELLTAB%GT.
        PERFORM CHANGE_STYLE USING L_ENABLED CHANGING %LTL_CELLTAB%GT.
        CLEAR R_MATNR.
        R_MATNR-SIGN = 'I'.
        R_MATNR-OPTION = 'EQ'.
        R_MATNR-LOW = L_MATNR.
        APPEND R_MATNR.
        L_FLAG = 'X'.
      ENDIF.
    ENDIF.
    IF L_FLAG EQ 'X'.
      LOOP AT %LTGT_OUTPUT%GT ASSIGNING %LTWA_OUTPUT1%GT.
        ASSIGN COMPONENT 'MATNR' OF STRUCTURE %LTWA_OUTPUT1%GT TO %LTL_MATNR%GT.
        L_MATNR1 = %LTL_MATNR%GT.
        IF L_MATNR NE L_MATNR1 OR SY-TABIX %LT= L_TABIX.
          CONTINUE.
        ENDIF.
        L_ENABLED = SPACE.
        REFRESH GT_STYLE.
        ASSIGN COMPONENT 'XYZSTYLEZYX' OF STRUCTURE %LTWA_OUTPUT1%GT TO
 %LTL_CELLTAB%GT.
        PERFORM CHANGE_STYLE USING L_ENABLED CHANGING %LTL_CELLTAB%GT.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
*loop at %LTgt_output%GT assigning %LTwa_output%GT.
*assign component 'MATNR' of structure %LTwa_output%GT to %LTl_matnr%GT.
*if sy-tabix eq 1.
*   l_enabled = 'X'.
*   l_matnr = %LTl_matnr%GT.
*   refresh gt_style.
*   assign component 'XYZSTYLEZYX' of structure %LTwa_output%GT to
*   %LTl_celltab%GT.
*   perform change_style using l_enabled changing %LTl_celltab%GT.
*else.
*   if l_matnr ne %LTl_matnr%GT.
*     l_enabled = 'X'.
*     l_matnr = %LTl_matnr%GT.
*     refresh gt_style.
*     assign component 'XYZSTYLEZYX' of structure %LTwa_output%GT to
*   %LTl_celltab%GT.
*     perform change_style using l_enabled changing %LTl_celltab%GT.
*   else.
*     l_enabled = SPACE.
*     refresh gt_style.
*     assign component 'XYZSTYLEZYX' of structure %LTwa_output%GT to
*   %LTl_celltab%GT.
*     perform change_style using l_enabled changing %LTl_celltab%GT.
*   endif.
*endif.
*endloop.
ENDFORM.                    " set_custom_editable_grid
**&---------------------------------------------------------------------
*
**&      Form  change_style
**&---------------------------------------------------------------------
*
FORM CHANGE_STYLE  USING    VALUE(P_ENABLED)
                   CHANGING L_CELLTAB.

**&---------------------------------------------------------------------
*
**&      Form  change_style
**&---------------------------------------------------------------------
*
**       text
**----------------------------------------------------------------------
*
**      --%GTP_%LTL_CELLTAB%GT  text
**      --%GTP_L_ENABLED  text
**----------------------------------------------------------------------
*
*FORM change_style  TABLES   P_L_CELLTAB STRUCTURE LVC_S_STYL
* %LTL_CELLTAB%GT #LOCAL# %GT
* "Insert correct name for %LT...%GT
* USING    P_ENABLED.
  IF P_ENABLED EQ 'X'.
    GS_STYLE-FIELDNAME = 'WEBAZ'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'EISBE'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'EISLO'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'SHZET'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'SHFLG'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'MAABC'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'MRPPP'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'BSTRF'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'DISLS'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'BSTMI'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'EKWSL'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'DISPO'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'EKGRP'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'MINBE'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'MABST'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'DISGR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'BSTMA'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'LTKZE'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'LTKZA'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'LGBKZ'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'LGPLA'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'BSSKZ'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'SOBSL'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.

    GS_STYLE-FIELDNAME = 'PFEP_REVISION_DATE'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_METHODE_TRANSPORT'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_OCCURENCE_MAX'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_CONT_INTERNE_HAUTEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_CONT_INTERNE_LARGEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_CONT_INTERNE_PROFONDEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_PIECE_HAUTEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_PIECE_LARGEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_PIECE_PROFONDEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_CONT_FOURN_HAUTEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_CONT_FOURN_LARGEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_CONT_FOURN_PROFONDEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_CONTENANT'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_QTE_MAX_CONTENANT'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_ROUTE'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_FREQUENCY'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_RACK'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_PIECE_KIT'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_ABC_CONSOMMATION'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_CONS_SERVICE'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_ENABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    L_CELLTAB = GT_STYLE[].
  ELSE.
    GS_STYLE-FIELDNAME = 'WEBAZ'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'EISBE'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'EISLO'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'SHZET'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'SHFLG'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'MAABC'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'MRPPP'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'BSTRF'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'DISLS'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'BSTMI'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'EKWSL'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'DISPO'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'EKGRP'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'MINBE'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'MABST'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'DISGR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'BSTMA'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'LTKZE'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'LTKZA'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'LGBKZ'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'LGPLA'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'BSSKZ'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'SOBSL'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_REVISION_DATE'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_METHODE_TRANSPORT'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_OCCURENCE_MAX'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_CONT_INTERNE_HAUTEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_CONT_INTERNE_LARGEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_CONT_INTERNE_PROFONDEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_PIECE_HAUTEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_PIECE_LARGEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_PIECE_PROFONDEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_CONT_FOURN_HAUTEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_CONT_FOURN_LARGEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_CONT_FOURN_PROFONDEUR'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
*     gs_style-fieldname = 'PFEP_CONTENANT'.
*     gs_style-style = cl_gui_alv_grid=%GTmc_style_disabled.
*     insert gs_style into table gt_style.
*
*     gs_style-fieldname = 'PFEP_QTE_MAX_CONTENANT'.
*     gs_style-style = cl_gui_alv_grid=%GTmc_style_disabled.
*     insert gs_style into table gt_style.
*     gs_style-fieldname = 'PFEP_ROUTE'.
*     gs_style-style = cl_gui_alv_grid=%GTmc_style_disabled.
*     insert gs_style into table gt_style.
*
*     gs_style-fieldname = 'PFEP_FREQUENCY'.
*     gs_style-style = cl_gui_alv_grid=%GTmc_style_disabled.
*     insert gs_style into table gt_style.
*
*     gs_style-fieldname = 'PFEP_RACK'.
*     gs_style-style = cl_gui_alv_grid=%GTmc_style_disabled.
*     insert gs_style into table gt_style.
*     gs_style-fieldname = 'PFEP_PIECE_KIT'.
*     gs_style-style = cl_gui_alv_grid=%GTmc_style_disabled.
*     insert gs_style into table gt_style.
    GS_STYLE-FIELDNAME = 'PFEP_ABC_CONSOMMATION'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    GS_STYLE-FIELDNAME = 'PFEP_CONS_SERVICE'.
    GS_STYLE-STYLE = CL_GUI_ALV_GRID=%GTMC_STYLE_DISABLED.
    INSERT GS_STYLE INTO TABLE GT_STYLE.
    L_CELLTAB = GT_STYLE[].
  ENDIF.

ENDFORM.                    " change_style

*&---------------------------------------------------------------------*
*&      Form  modify_t_pfep
*&---------------------------------------------------------------------*
FORM MODIFY_T_PFEP  USING    NEW_VALUE
                             OLD_VALUE
                             MATNR
                             PRVBE
                             VALUE(CHARACTERISTIC).
  DATA : L_VTLIN TYPE VTENTRIES-VTLINNOINT,
         L_MATNR TYPE MARA-MATNR,
         L_FLAG TYPE C.

  CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
    EXPORTING
      INPUT  = MATNR
    IMPORTING
      OUTPUT = L_MATNR.

  REFRESH GT_VTENTRIES.
  CALL FUNCTION 'CARD_TABLE_READ_ENTRIES'
    EXPORTING
      VAR_TABLE       = 'T_PFEP'
    TABLES
      VAR_TAB_ENTRIES = GT_VTENTRIES
    EXCEPTIONS
      ERROR           = 1
      OTHERS          = 2.
  IF SY-SUBRC %LT%GT 0.
    G_ERROR = 'X'.
  ENDIF.
  CLEAR: WA_VTENTRIES, L_VTLIN, L_FLAG.
  LOOP AT GT_VTENTRIES INTO WA_VTENTRIES WHERE VTVALUE = L_MATNR.
    L_VTLIN = WA_VTENTRIES-VTLINNOINT.
    IF NOT PRVBE IS INITIAL.
      READ TABLE GT_VTENTRIES INTO WA_VTENTRIES WITH KEY VTLINNOINT =
L_VTLIN
                              VTVALUE = PRVBE TRANSPORTING NO FIELDS.
      IF SY-SUBRC EQ 0.
        L_FLAG = 'X'.
        EXIT.
      ENDIF.
    ELSE.
      L_FLAG = 'X'.
      EXIT.
    ENDIF.
    CLEAR: WA_VTENTRIES.
  ENDLOOP.
  IF L_FLAG = 'X'.
    REFRESH GT_VTENTRIES.
    WA_VTENTRIES-VTLINNOINT = L_VTLIN.
    WA_VTENTRIES-VTCHARACT = CHARACTERISTIC.
    WA_VTENTRIES-VTVALUE = NEW_VALUE.
    APPEND WA_VTENTRIES TO GT_VTENTRIES.
    CALL FUNCTION 'CAMA_TABLE_MAINTAIN_ENTRIES'
      EXPORTING
        VAR_TABLE       = 'T_PFEP'
      TABLES
        VAR_TAB_ENTRIES = GT_VTENTRIES
      EXCEPTIONS
        ERROR           = 1
        OTHERS          = 2.
    IF SY-SUBRC %LT%GT 0.
      G_ERROR = 'X'.
    ENDIF.
    IF NOT OLD_VALUE IS INITIAL.
      REFRESH GT_VTENTRIES.
      WA_VTENTRIES-VTLINNOINT = L_VTLIN.
      WA_VTENTRIES-VTCHARACT = CHARACTERISTIC.
      WA_VTENTRIES-VTVALUE = OLD_VALUE.
      WA_VTENTRIES-FLDELETE = 'X'.
      APPEND WA_VTENTRIES TO GT_VTENTRIES.
      CALL FUNCTION 'CAMA_TABLE_MAINTAIN_ENTRIES'
        EXPORTING
          VAR_TABLE       = 'T_PFEP'
        TABLES
          VAR_TAB_ENTRIES = GT_VTENTRIES
        EXCEPTIONS
          ERROR           = 1
          OTHERS          = 2.
      IF SY-SUBRC %LT%GT 0.
        G_ERROR = 'X'.
      ENDIF.
    ENDIF.
  ELSE.
*       sort gt_vtentries by vtlinnoint descending.
*       read table gt_vtentries into wa_vtentries index 1.
*       l_vtlin = wa_vtentries-vtlinnoint + 1.
    REFRESH GT_VTENTRIES.
*       wa_vtentries-vtlinnoint = l_vtlin.
    WA_VTENTRIES-VTCHARACT = 'PFEP_COMPONENT'.
    WA_VTENTRIES-VTVALUE = L_MATNR.
    APPEND WA_VTENTRIES TO GT_VTENTRIES.
*       wa_vtentries-vtlinnoint = l_vtlin.
    WA_VTENTRIES-VTCHARACT = 'PFEP_SUPPLY_AREA'.
    WA_VTENTRIES-VTVALUE = PRVBE.
    APPEND WA_VTENTRIES TO GT_VTENTRIES.
*       wa_vtentries-vtlinnoint = l_vtlin.
    WA_VTENTRIES-VTCHARACT = CHARACTERISTIC.
    WA_VTENTRIES-VTVALUE = NEW_VALUE.
    APPEND WA_VTENTRIES TO GT_VTENTRIES.
    CALL FUNCTION 'CAMA_TABLE_MAINTAIN_ENTRIES'
      EXPORTING
        VAR_TABLE       = 'T_PFEP'
      TABLES
        VAR_TAB_ENTRIES = GT_VTENTRIES
      EXCEPTIONS
        ERROR           = 1
        OTHERS          = 2.
    IF SY-SUBRC %LT%GT 0.
      G_ERROR = 'X'.
    ENDIF.
  ENDIF.
ENDFORM.                    " modify_t_pfep

*&---------------------------------------------------------------------*
*&      Form  modify_classification
*&---------------------------------------------------------------------*
FORM MODIFY_CLASSIFICATION  USING    NEW_VALUE
                                     CHARACTERISTIC
                                     MATNR.

  DATA : GT_CLASS TYPE TABLE OF SCLASS,
         GT_OBJECTDATA TYPE TABLE OF CLOBJDAT,
         WA_OBJECTDATA LIKE LINE OF GT_OBJECTDATA.
  DATA : L_OBJECT TYPE BAPI1003_KEY-OBJECT,
         L_NEW_VALUE TYPE ATWRT.
  MOVE MATNR TO L_OBJECT.
  MOVE NEW_VALUE TO L_NEW_VALUE.
  CLEAR : WA_CHAR_VALUES, WA_NUM_VALUES.
  REFRESH : GT_CHAR_VALUES, GT_NUM_VALUES.

  CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
    EXPORTING
      CLASS              = 'CL_PFEP'
      CLASSTEXT          = 'X'
      CLASSTYPE          = '001'
      CLINT              = 0
      FEATURES           = 'X'
      LANGUAGE           = SY-LANGU
      OBJECT             = L_OBJECT
      KEY_DATE           = SY-DATUM
      INITIAL_CHARACT    = 'X'
      CHANGE_SERVICE_CLF = 'X'
    TABLES
      T_CLASS            = GT_CLASS
      T_OBJECTDATA       = GT_OBJECTDATA
    EXCEPTIONS
      NO_CLASSIFICATION  = 1
      NO_CLASSTYPES      = 2
      INVALID_CLASS_TYPE = 3
      OTHERS             = 4.
  IF SY-SUBRC %LT%GT 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  CLEAR WA_OBJECTDATA.
  LOOP AT GT_OBJECTDATA INTO WA_OBJECTDATA.
    IF WA_OBJECTDATA-AUSP1 NE '?'.
      CLEAR WA_CHAR_VALUES.
      WA_CHAR_VALUES-CHARACT = WA_OBJECTDATA-ATNAM.
      WA_CHAR_VALUES-VALUE_CHAR = WA_OBJECTDATA-AUSP1.
      WA_CHAR_VALUES-VALUE_NEUTRAL = WA_OBJECTDATA-AUSP1.
      APPEND WA_CHAR_VALUES TO GT_CHAR_VALUES.
      CLEAR WA_OBJECTDATA.
    ENDIF.
  ENDLOOP.

  CLEAR WA_CHAR_VALUES.
  WA_CHAR_VALUES-CHARACT = CHARACTERISTIC.
  WA_CHAR_VALUES-VALUE_CHAR = L_NEW_VALUE.
  WA_CHAR_VALUES-VALUE_NEUTRAL = L_NEW_VALUE.
  APPEND WA_CHAR_VALUES TO GT_CHAR_VALUES.
  CALL FUNCTION 'BAPI_OBJCL_CHANGE'
    EXPORTING
      OBJECTKEY          = L_OBJECT
      OBJECTTABLE        = 'MARA'
      CLASSNUM           = 'CL_PFEP'
      CLASSTYPE          = '001'
    TABLES
      ALLOCVALUESNUMNEW  = GT_NUM_VALUES
      ALLOCVALUESCHARNEW = GT_CHAR_VALUES
      ALLOCVALUESCURRNEW = GT_CURR_VALUES
      RETURN             = GT_RETURN.
  READ TABLE GT_RETURN INTO WA_RETURN WITH KEY TYPE = 'E'.
  IF SY-SUBRC EQ 0.
    G_ERROR = 'X'.
  ENDIF.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      WAIT   = 'X'
    IMPORTING
      RETURN = GT_RETURN1.
  IF GT_RETURN1-TYPE = 'E'.
    G_ERROR = 'X'.
  ENDIF.
ENDFORM.                    " modify_classification

*Selection texts
*----------------------------------------------------------
* CHK_FIR         Check FIR
* P_CAPID         Application
* P_DATUV         Valid-From Date
* P_FILE         File
* P_LGNUM         Warehouse Number
* P_VKORG         Sales Organization
* P_VTWEG         Distribution Channel
* RB_DOWNL         Download
* RB_UPLD         Upload
* S_AMATNR         Alternative Material
* S_BESKZ         Procurement Type
* S_BUDAT         Posting Date in the Document
* S_BWART         Movement Type
* S_DELKZ         MRP element
* S_DISPO         MRP Controller (Materials Plan
* S_DSDAT         MRP date
* S_EKGRP         Purchasing Group
* S_MATNR         Material
* S_SOBSL         Special procurement type
* S_VMSTA         Distribution-chain-specific
* S_WERKS         Plant

*Messages
*----------------------------------------------------------
*
* Message class: ZP
*000   Do commit work every so often to avoid time out if run online
*001   No data exists for the selection criteria
*002
*YPE
*
* Message class: ZZ
*037

*Selection texts
*----------------------------------------------------------
* CHK_FIR         Check FIR
* P_CAPID         Application
* P_DATUV         Valid-From Date
* P_FILE         File
* P_LGNUM         Warehouse Number
* P_VKORG         Sales Organization
* P_VTWEG         Distribution Channel
* RB_DOWNL         Download
* RB_UPLD         Upload
* S_AMATNR         Alternative Material
* S_BESKZ         Procurement Type
* S_BUDAT         Posting Date in the Document
* S_BWART         Movement Type
* S_DELKZ         MRP element
* S_DISPO         MRP Controller (Materials Plan
* S_DSDAT         MRP date
* S_EKGRP         Purchasing Group
* S_MATNR         Material
* S_SOBSL         Special procurement type
* S_VMSTA         Distribution-chain-specific
* S_WERKS         Plant

*Messages
*----------------------------------------------------------
*
* Message class: ZP
*000   hello
*001
*002
*YPE
*
* Message class: ZZ
*037
  • No labels