You are on page 1of 6

*&---------------------------------------------------------------------*

*& Include ZOPEN_SALES_ORDERS_TO_PACK_TOP


*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&Types Declarations
*&---------------------------------------------------------------------*
TYPES: BEGIN OF TY_VBAK,
VBELN TYPE VBELN,
ERDAT TYPE ERDAT,
KNUMV TYPE KNUMV,
KUNNR TYPE KUNNR,
END OF TY_VBAK,

BEGIN OF TY_KNA1,
KUNNR TYPE KUNNR,
NAME1 TYPE NAME1,
END OF TY_KNA1,

BEGIN OF TY_VBUK,
VBELN TYPE VBELN,
END OF TY_VBUK,

BEGIN OF TY_VBUP,
VBELN TYPE VBELN,
POSNR TYPE POSNR,
LFSTA TYPE LFSTA,
END OF TY_VBUP,

BEGIN OF TY_VBAP,
MATNR TYPE MATNR, "Material "7Digits
KDMAT TYPE MATNR_KU, "Trade Name
VBELN TYPE VBELN_VA, "Sales Document
POSNR TYPE POSNR_VA, "Item No
PSTYV TYPE PSTYV, "Item Category
UEPOS TYPE UEPOS, "HigherLevel Item
NETWR TYPE NETWR_AP, "Item Net Value
KWMENG TYPE KWMENG, "Order Quantity in Sales Unit
KBMENG TYPE KBMENG, "Confirmed Quantity in Sales Unit
VRKME TYPE VRKME, "Sales Unit
MATNR2 TYPE MATNR, "Material
KLMENG TYPE KLMENG ,
END OF TY_VBAP,

BEGIN OF TY_VBEP,
VBELN TYPE VBELN_VA, "Sales Document
POSNR TYPE POSNR_VA, "Item No
ETENR TYPE ETENR, "Delivery Schedule Line Number
EDATU TYPE EDATU, "Schedule Date
WMENG TYPE WMENG, "Order quantity in sales units
BMENG TYPE BMENG, "Confirmed Quantity
VRKME TYPE VRKME, "Sales Unit
LMENG TYPE LMENG, "Required quantity for mat.management in
stockkeeping units
VSMNG TYPE VSMNG,
REMARK TYPE CHAR40,
KBETR TYPE KBETR,
END OF TY_VBEP,

BEGIN OF TY_VBEP2,
VBELN TYPE VBELN_VA, "Sales Document
POSNR TYPE POSNR_VA, "Item No
MATNR TYPE MATNR, "Material
KDMAT TYPE MATNR_KU, "Trade Name
ETENR TYPE ETENR, "Delivery Schedule Line Number
EDATU TYPE EDATU, "Schedule Date
WMENG TYPE WMENG, "Order quantity in sales units
BMENG TYPE BMENG, "Confirmed Quantity
VRKME TYPE VRKME, "Sales Unit
LMENG TYPE LMENG, "Required quantity for mat.management in
stockkeeping units
END OF TY_VBEP2,

BEGIN OF TY_KONV,
KNUMV TYPE KNUMV,
KBETR TYPE KBETR,
END OF TY_KONV,

BEGIN OF TY_FINAL,
MATNR TYPE MATNR, "7Digits
VBELN TYPE VBELN,
KDMAT TYPE MATNR_KU,
KUNNR TYPE KUNNR,
MATNR2 TYPE MATNR, "Material
NAME1 TYPE NAME1,
lifnr TYPE lifnr,
NAME2 TYPE NAME1,
REMARK TYPE CHAR40,
KBETR TYPE KBETR,

JAN TYPE BCONS_VAR,


FEB TYPE BCONS_VAR,
MAR TYPE BCONS_VAR,
APR TYPE BCONS_VAR,
MAY TYPE BCONS_VAR,
JUN TYPE BCONS_VAR,
JUL TYPE BCONS_VAR,
AUG TYPE BCONS_VAR,
SEP TYPE BCONS_VAR,
OCT TYPE BCONS_VAR,
NOV TYPE BCONS_VAR,
DEC TYPE BCONS_VAR,
JAN2 TYPE BCONS_VAR,
FEB2 TYPE BCONS_VAR,
MAR2 TYPE BCONS_VAR,
APR2 TYPE BCONS_VAR,
MAY2 TYPE BCONS_VAR,
JUN2 TYPE BCONS_VAR,
JUL2 TYPE BCONS_VAR,
AUG2 TYPE BCONS_VAR,
SEP2 TYPE BCONS_VAR,
OCT2 TYPE BCONS_VAR,
NOV2 TYPE BCONS_VAR,
DEC2 TYPE BCONS_VAR,

JAN3 TYPE BCONS_VAR,


FEB3 TYPE BCONS_VAR,
MAR3 TYPE BCONS_VAR,
APR3 TYPE BCONS_VAR,
MAY3 TYPE BCONS_VAR,
JUN3 TYPE BCONS_VAR,
JUL3 TYPE BCONS_VAR,
AUG3 TYPE BCONS_VAR,
SEP3 TYPE BCONS_VAR,
OCT3 TYPE BCONS_VAR,
NOV3 TYPE BCONS_VAR,
DEC3 TYPE BCONS_VAR,

JAN4 TYPE BCONS_VAR,


FEB4 TYPE BCONS_VAR,
MAR4 TYPE BCONS_VAR,
APR4 TYPE BCONS_VAR,
MAY4 TYPE BCONS_VAR,
JUN4 TYPE BCONS_VAR,
JUL4 TYPE BCONS_VAR,
AUG4 TYPE BCONS_VAR,
SEP4 TYPE BCONS_VAR,
OCT4 TYPE BCONS_VAR,
NOV4 TYPE BCONS_VAR,
DEC4 TYPE BCONS_VAR,

TOTAL TYPE BCONS_VAR,


TOTAL2 TYPE BCONS_VAR,
TOTAL3 TYPE BCONS_VAR,
TOTAL4 TYPE BCONS_VAR,
COL TYPE LVC_T_SCOL, "Color Cell
pb type menge_d,
EDATU TYPE EDATU,
END OF TY_FINAL.
TYPES: BEGIN OF TY_VBPA,
VBELN TYPE VBELN,
KUNNR TYPE KUNNR,
LIFNR TYPE LIFNR,
END OF TY_VBPA.
DATA: T_VBPA TYPE TABLE OF TY_VBPA,
T_VBPA2 TYPE TABLE OF TY_VBPA,
W_VBPA TYPE TY_VBPA.
*... selection screen layout:
DATA G_LIFNR TYPE LFA1-LIFNR.
DATA: L_BAL TYPE MENGE_D,
L_METER TYPE MENGE_D.

DATA: W_COL TYPE LVC_S_SCOL. "Color Cell


*&---------------------------------------------------------------------*
*&Data Declarations
*&---------------------------------------------------------------------*
DATA: T_VBAK TYPE TABLE OF TY_VBAK,
W_VBAK TYPE TY_VBAK,
T_KNA1 TYPE TABLE OF TY_KNA1,
W_KNA1 TYPE TY_KNA1,
T_VBUK TYPE TABLE OF TY_VBUK,
W_VBUK TYPE TY_VBUK,
T_VBAP_H TYPE TABLE OF TY_VBAP,
W_VBAP_H TYPE TY_VBAP,
T_VBAP TYPE TABLE OF TY_VBAP,
T_VBAPM TYPE TABLE OF TY_VBAP,
T_KONV TYPE TABLE OF TY_KONV,
W_KONV TYPE TY_KONV,

T_VBAP_H2 TYPE TABLE OF VBAPVB,


T_VBAP_H3 TYPE TABLE OF VBAPVB,
W_VBAP_H2 TYPE VBAPVB,
W_VBAP TYPE TY_VBAP,
W_VBAP2 TYPE TY_VBAP,
T_VBFA TYPE TABLE OF VBFA,
T_VBFA2 TYPE TABLE OF VBFA,
W_VBFA TYPE VBFA,
T_VBEP TYPE TABLE OF TY_VBEP,
T_VBEP2 TYPE TABLE OF TY_VBEP2,
W_VBEP2 TYPE TY_VBEP2,
W_VBEP TYPE TY_VBEP,
T_VBUP TYPE TABLE OF VBUP,
T_VBUP2 TYPE TABLE OF VBUP,
W_VBUP TYPE VBUP,

T_VBEP6 TYPE TABLE OF VBEPVB,


T_VBEP7 TYPE TABLE OF VBEPVB,
T_VBEP8 TYPE TABLE OF VBEPVB,
W_VBEP6 TYPE VBEPVB,
W_VBEP8 TYPE VBEPVB,
T_FINAL TYPE TABLE OF TY_FINAL,
W_FINAL TYPE TY_FINAL,

T_VBEP3 TYPE TABLE OF TY_VBEP, "Dbl Click Schedules

G_VBELN TYPE VBAK-VBELN,


G_ERDAT TYPE VBAK-ERDAT,

T_FCAT_FINAL TYPE LVC_T_FCAT,


W_FCAT_FINAL TYPE LVC_S_FCAT,

T_FCAT_FINAL2 TYPE LVC_T_FCAT,


W_FCAT_FINAL2 TYPE LVC_S_FCAT,

S_LAYO TYPE LVC_S_LAYO,


S_LAYO2 TYPE LVC_S_LAYO,
T_SORT_FINAL TYPE LVC_T_SORT,
W_SORT_FINAL TYPE LVC_S_SORT,

T_FUNC TYPE UI_FUNCTIONS,


W_FUNC TYPE UI_FUNC,

L_TABIX TYPE SY-TABIX,


L_TITLE1 TYPE SDYDO_TEXT_ELEMENT,
L_TITLE2 TYPE SDYDO_TEXT_ELEMENT,

T_SORT2 TYPE LVC_T_SORT,


W_SORT2 TYPE LVC_S_SORT,

R_SPLIT TYPE REF TO CL_GUI_SPLITTER_CONTAINER,


R_SPLIT2 TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
R_CC_FINAL TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
R_GRID_FINAL TYPE REF TO CL_GUI_ALV_GRID,
R_GRID_FINAL2 TYPE REF TO CL_GUI_ALV_GRID,
R_CC_FINAL1 TYPE REF TO CL_GUI_CONTAINER,
R_CC_FINAL5 TYPE REF TO CL_GUI_CONTAINER,
R_CC_FINAL2 TYPE REF TO CL_GUI_CONTAINER,
R_CC_TOP TYPE REF TO CL_GUI_CONTAINER,
** Top Of page Declarations
O_DOC TYPE REF TO CL_DD_DOCUMENT,
O_HTML TYPE REF TO CL_GUI_HTML_VIEWER,

DYN TYPE STRING,


G_KUNNR TYPE VBAK-KUNNR.
DATA S_VARIANT TYPE DISVARIANT.
DATA: BEGIN OF TLINE OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA: END OF TLINE.
*&---------------------------------------------------------------------*
*&Selection Screen
*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_SORT TYPE ZSORT,
P_SHADE TYPE ZTPROD,
P_QAL(5).
* CAT_PROD TYPE ZCAT_PROD.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_VBELN FOR G_VBELN,
S_LIFNR FOR G_LIFNR,
S_KUNNR FOR G_KUNNR,
S_EDATU FOR G_ERDAT.
SELECTION-SCREEN END OF BLOCK B2.
* S_ERDAT FOR G_ERDAT

SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-001.


PARAMETERS: R1 RADIOBUTTON GROUP G1,
R2 RADIOBUTTON GROUP G1,
R3 RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B3.

SELECTION-SCREEN BEGIN OF BLOCK B4 WITH FRAME TITLE TEXT-005.


PARAMETERS: PA_WEEK1 AS CHECKBOX,
PA_WEEK2 AS CHECKBOX DEFAULT 'X'.

SELECTION-SCREEN END OF BLOCK B4.

REFRESH T_FCAT_FINAL2.
W_FCAT_FINAL2-FIELDNAME = 'EDATU'.
W_FCAT_FINAL2-COLTEXT = 'Scheduled Date'.
APPEND W_FCAT_FINAL2 TO T_FCAT_FINAL2.
CLEAR W_FCAT_FINAL2.

W_FCAT_FINAL2-FIELDNAME = 'WMENG'.
W_FCAT_FINAL2-COLTEXT = 'Quantity'.
APPEND W_FCAT_FINAL2 TO T_FCAT_FINAL2.
CLEAR W_FCAT_FINAL2.

W_FCAT_FINAL2-FIELDNAME = 'BMENG'.
W_FCAT_FINAL2-COLTEXT = 'Confirmed Quantity'.
W_FCAT_FINAL2-NO_OUT = 'X'.
APPEND W_FCAT_FINAL2 TO T_FCAT_FINAL2.
CLEAR W_FCAT_FINAL2.
W_FCAT_FINAL2-FIELDNAME = 'LMENG'.
W_FCAT_FINAL2-COLTEXT = 'Quantity UOm2'.
W_FCAT_FINAL2-NO_OUT = 'X'.
APPEND W_FCAT_FINAL2 TO T_FCAT_FINAL2.
CLEAR W_FCAT_FINAL2.

W_FCAT_FINAL2-FIELDNAME = 'VBELN'.
IF R3 <> 'X'.
W_FCAT_FINAL2-NO_OUT = 'X'.
ENDIF.
W_FCAT_FINAL2-COLTEXT = 'Sales Order'.
APPEND W_FCAT_FINAL2 TO T_FCAT_FINAL2.
CLEAR W_FCAT_FINAL2.

W_FCAT_FINAL2-FIELDNAME = 'POSNR'.
W_FCAT_FINAL2-COLTEXT = 'Item'.
W_FCAT_FINAL2-NO_OUT = 'X'.
APPEND W_FCAT_FINAL2 TO T_FCAT_FINAL2.
CLEAR W_FCAT_FINAL2.
IF R3 = 'X'.
W_FCAT_FINAL2-FIELDNAME = 'REMARK'.
W_FCAT_FINAL2-COLTEXT = 'Remark'.
APPEND W_FCAT_FINAL2 TO T_FCAT_FINAL2.
CLEAR W_FCAT_FINAL2.

W_FCAT_FINAL2-FIELDNAME = 'KBETR'.
W_FCAT_FINAL2-COLTEXT = 'Basic Price'.
APPEND W_FCAT_FINAL2 TO T_FCAT_FINAL2.
CLEAR W_FCAT_FINAL2.
ENDIF.
*&---------------------------------------------------------------------*
*&Class Declarations
*&---------------------------------------------------------------------*
CLASS LCL_EVENT_HANDLER DEFINITION.
PUBLIC SECTION.
METHODS: DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING
E_ROW E_COLUMN ES_ROW_NO.

ENDCLASS. "lcl_event_handler DEFINITION

*----------------------------------------------------------------------*
* CLASS lcl_event_handler IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
METHOD DOUBLE_CLICK.
PERFORM GET_VBEP3 USING E_ROW E_COLUMN-FIELDNAME ES_ROW_NO-ROW_ID.
PERFORM DISPLAY_VBEP3.
ENDMETHOD. "double_click
ENDCLASS. "lcl_event_handler IMPLEMENTATION

DATA: R_EV_HANDLER TYPE REF TO LCL_EVENT_HANDLER.