You are on page 1of 12

*&

---------------------------------------------------------------------*
*& Report ZFI_HAMALI_REPORT
*&---------------------------------------------------------------------*
*& Project : Kaveri Seeds Ltd- K I T S *
*& Module : FI *
*& Object Name : ZFI_HAMALI_REPORT *
*& Created Date : 14.11.2017(DD.MM.YYYY) *
*& Functional Consultant : Narendra *
*& Technical Consultant : Subrahmanyam Gupta *
*& Development Request : *
*& Transaction Code : *
*& Description : Hamali Report *
*& Package : ZFI *
************************************************************************
* *
* Copyright (c) 2017 by SEAL Infotech (a CenturyLink Company) & KSCL *
* All rights reserved *
* *
************************************************************************
* No part of this program may be used or reproduced in any form by any *
* means without written permission from SEAL Infotech *
* *
* This is confidential and proprietary information that may not be *
* published, disclosed, or made available without the prior written *
* consent of SEAL Infotech. *
* *
************************************************************************
REPORT zfi_hamali_report.

"*************************************************
"** Selection Screen
"*************************************************
TABLES : zfi_hamali.
SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : s_date FOR zfi_hamali-zzdate NO-EXTENSION OBLIGATORY,
s_werks FOR zfi_hamali-werks NO INTERVALS NO-EXTENSION.
SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE TEXT-002.
PARAMETERS : p_r1 RADIOBUTTON GROUP g1 DEFAULT 'X',
p_r2 RADIOBUTTON GROUP g1,
p_r3 RADIOBUTTON GROUP g1,
p_r4 RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b.
SELECTION-SCREEN END OF BLOCK a.

"*************************************************
"** Declaration
"*************************************************
TYPES : BEGIN OF ty_final,
crop TYPE zfi_hamali-wgbez,
werks TYPE zfi_hamali-werks,
name1 TYPE t001w-name1,
var TYPE zfi_hamali-extwg,
kpdt TYPE zfi_hamali-zzamount,
kpro TYPE zfi_hamali-zzamount,
kmar TYPE zfi_hamali-zzamount,
ktot TYPE zfi_hamali-zzamount,
kupdt TYPE zfi_hamali-zzamount,
kupro TYPE zfi_hamali-zzamount,
kumar TYPE zfi_hamali-zzamount,

PERFORM display_r3. spro TYPE zfi_hamali-zzamount. PERFORM get_data_r4. tol3 TYPE zfi_hamali-zzamount. tpdt TYPE zfi_hamali-zzamount. smar TYPE zfi_hamali-zzamount. *&---------------------------------------------------------------------* *& Form GET_DATA . ppro TYPE zfi_hamali-zzamount. ENDIF. tomar TYPE zfi_hamali-zzamount. kutot TYPE zfi_hamali-zzamount. gt_fcat TYPE slis_t_fieldcat_alv. lmar TYPE zfi_hamali-zzamount. upro TYPE zfi_hamali-zzamount. gs_final TYPE ty_final. tol1 TYPE zfi_hamali-zzamount. stot TYPE zfi_hamali-zzamount. tol4 TYPE zfi_hamali-zzamount. tol6 TYPE zfi_hamali-zzamount. updt TYPE zfi_hamali-zzamount. spdt TYPE zfi_hamali-zzamount. ppdt TYPE zfi_hamali-zzamount. tpro TYPE zfi_hamali-zzamount. ttot TYPE zfi_hamali-zzamount. "************************************************* "** Start of Selection "************************************************* START-OF-SELECTION. topdt TYPE zfi_hamali-zzamount. lpro TYPE zfi_hamali-zzamount. ptot TYPE zfi_hamali-zzamount. IF p_r1 IS NOT INITIAL or p_r2 IS NOT INITIAL. lpdt TYPE zfi_hamali-zzamount. PERFORM display. PERFORM get_data_r3. PERFORM display_r4. utot TYPE zfi_hamali-zzamount. totot TYPE zfi_hamali-zzamount. END OF ty_final. ltot TYPE zfi_hamali-zzamount. DATA : gt_final TYPE TABLE OF ty_final. topro TYPE zfi_hamali-zzamount. gs_fcat TYPE slis_fieldcat_alv. pmar TYPE zfi_hamali-zzamount. umar TYPE zfi_hamali-zzamount. ELSEIF p_r3 IS NOT INITIAL. gs_layout TYPE slis_layout_alv. PERFORM get_data. tol5 TYPE zfi_hamali-zzamount. tmar TYPE zfi_hamali-zzamount. ELSE. tol2 TYPE zfi_hamali-zzamount.

WHEN 2. zzamount FROM zfi_hamali INTO TABLE @DATA(lit_hamali) WHERE werks IN @s_werks AND zzdate IN @s_date. gs_final-kupdt = lwa_hamali-zzamount. gs_final-topdt = lwa_hamali-zzamount. WHEN 1. WHEN 3. "** Variety IF p_r2 IS NOT INITIAL. "** Crop gs_final-crop = lwa_hamali-wgbez. wgbez. gs_final-tomar = lwa_hamali-zzamount. gs_final-ktot = lwa_hamali-zzamount. LOOP AT lit_hamali INTO DATA(lwa_hamali). gs_final-kmar = lwa_hamali-zzamount. ENDIF. zzdate.p2 text *&---------------------------------------------------------------------* FORM get_data . SELECT zzslno. ENDCASE. "** Production "** Processing "** Marketing "** Total CASE lwa_hamali-zzwtype. gs_final-topro = lwa_hamali-zzamount. gs_final-kpdt = lwa_hamali-zzamount. werks. WHEN 2. zzwtype. gs_final-var = lwa_hamali-zzvariety.*&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-. gs_final-topro = lwa_hamali-zzamount. ewbez AS zzvariety. . gs_final-kumar = lwa_hamali-zzamount. CASE lwa_hamali-zzdept. gs_final-tomar = lwa_hamali-zzamount. gs_final-kupro = lwa_hamali-zzamount. WHEN 2. WHEN 1. zzdept. WHEN 1. gs_final-kpro = lwa_hamali-zzamount. gs_final-topdt = lwa_hamali-zzamount. CASE lwa_hamali-zzdept. WHEN 3.

ENDCASE. gs_final-topdt = lwa_hamali-zzamount. gs_final-topro = lwa_hamali-zzamount. WHEN 1. WHEN 3. ENDCASE. gs_final-tomar = lwa_hamali-zzamount. ENDCASE. CASE lwa_hamali-zzdept. gs_final-pmar = lwa_hamali-zzamount. WHEN 5. gs_final-topro = lwa_hamali-zzamount. gs_final-topdt = lwa_hamali-zzamount. gs_final-stot = lwa_hamali-zzamount. gs_final-ppro = lwa_hamali-zzamount. WHEN 2. WHEN 2. gs_final-topro = lwa_hamali-zzamount. WHEN 3. gs_final-tomar = lwa_hamali-zzamount. CASE lwa_hamali-zzdept. WHEN 1. WHEN 3. gs_final-ptot = lwa_hamali-zzamount. gs_final-tpdt = lwa_hamali-zzamount. gs_final-tpro = lwa_hamali-zzamount. gs_final-topdt = lwa_hamali-zzamount. gs_final-tmar = lwa_hamali-zzamount. CASE lwa_hamali-zzdept. gs_final-tomar = lwa_hamali-zzamount. gs_final-topdt = lwa_hamali-zzamount. gs_final-lpro = lwa_hamali-zzamount. ENDCASE. gs_final-topdt = lwa_hamali-zzamount. WHEN 2. WHEN 4. gs_final-lpdt = lwa_hamali-zzamount. WHEN 7. WHEN 3. gs_final-ttot = lwa_hamali-zzamount. gs_final-kutot = lwa_hamali-zzamount. gs_final-ppdt = lwa_hamali-zzamount. gs_final-updt = lwa_hamali-zzamount. . WHEN 1. gs_final-smar = lwa_hamali-zzamount. gs_final-topro = lwa_hamali-zzamount. WHEN 3. WHEN 1. CASE lwa_hamali-zzdept. gs_final-tomar = lwa_hamali-zzamount. gs_final-ltot = lwa_hamali-zzamount. gs_final-spro = lwa_hamali-zzamount. WHEN 2. WHEN 6. CASE lwa_hamali-zzdept. gs_final-lmar = lwa_hamali-zzamount. ENDCASE. gs_final-spdt = lwa_hamali-zzamount. WHEN 1.

gs_final-tomar = lwa_hamali-zzamount. . WHEN 3. fieldcat 'KMAR ' '5' 'Kanta Marketing'. CLEAR gs_fcat. gs_fcat-col_pos = &2. APPEND gs_fcat TO gt_fcat. fieldcat 'KUPDT' '7' 'Kanta-U Production'. fieldcat 'KPDT ' '3' 'Kanta Production'. gs_final-upro = lwa_hamali-zzamount. ENDLOOP. fieldcat 'VAR ' '2' 'Variety'. "** Grand Totals gs_final-totot = gs_final-topdt + gs_final-topro + gs_final-tomar. fieldcat 'LPRO' '12' 'Loading Processing'. fieldcat 'KPRO ' '4' 'Kanta Processing'. ENDCASE. fieldcat 'SPRO' '20' 'Stiching Processing'. gs_final-utot = lwa_hamali-zzamount. END-OF-DEFINITION. COLLECT gs_final INTO gt_final. DEFINE fieldcat. fieldcat 'KUMAR' '9' 'Kanta-U Marketing'. gs_fcat-fieldname = &1. *&---------------------------------------------------------------------* *& Form DISPLAY *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-. gs_final-topro = lwa_hamali-zzamount. ENDFORM. WHEN 2. fieldcat 'LTOT' '14' 'Loading Total'. fieldcat 'KUPRO' '8' 'Kanta-U Processing'. fieldcat 'PPDT' '15' 'Pulty Production'. fieldcat 'LMAR' '13' 'Loading Marketing'. IF p_r2 IS NOT INITIAL. gs_fcat-seltext_m = &3. fieldcat 'PTOT' '18' 'Pulty Total'. fieldcat 'LPDT' '11' 'Loading Production'. ENDCASE. fieldcat 'CROP ' '1' 'Crop'. CLEAR gs_final. fieldcat 'PPRO' '16' 'Pulty Processing'.p2 text *&---------------------------------------------------------------------* FORM display . gs_final-umar = lwa_hamali-zzamount. fieldcat 'KTOT ' '6' 'Kanta Total'. fieldcat 'KUTOT' '10' 'Kanta-U Total'. fieldcat 'PMAR' '17' 'Pulty Marketing'. fieldcat 'SPDT' '19' 'Stiching Production'. ENDIF.

fieldcat 'TPDT' '23' 'Thuppy Production'. fieldcat 'TTOT' '26' 'Thuppy Total'. fieldcat 'TOPDT' '31' 'Total Production'. fieldcat 'UPDT' '27' 'Un-loading Production'. fieldcat 'SMAR' '21' 'Stiching Marketing'. fieldcat 'STOT' '22' 'Stiching Total'. fieldcat 'UPRO' '28' 'Un-loading Processing'. gs_layout-colwidth_optimize = 'X'. fieldcat 'TOTOT' '34' 'Grand Total'. fieldcat 'TOMAR' '33' 'Total Marketing'. fieldcat 'TPRO' '24' 'Thuppy Processing'. fieldcat 'UTOT' '30' 'Un-loading Total'. fieldcat 'UMAR' '29' 'Un-loading Marketing'. fieldcat 'TOPRO' '32' 'Total Processing'. fieldcat 'TMAR' '25' 'Thuppy Marketing'. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING * I_INTERFACE_CHECK = ' ' * I_BYPASSING_BUFFER = ' ' * I_BUFFER_ACTIVE = ' ' i_callback_program = sy-repid * I_CALLBACK_PF_STATUS_SET = ' ' * I_CALLBACK_USER_COMMAND = ' ' * I_CALLBACK_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_END_OF_LIST = ' ' * I_STRUCTURE_NAME = * I_BACKGROUND_ID = ' ' * I_GRID_TITLE = * I_GRID_SETTINGS = is_layout = gs_layout it_fieldcat = gt_fcat * IT_EXCLUDING = * IT_SPECIAL_GROUPS = * it_sort = * IT_FILTER = * IS_SEL_HIDE = i_default = 'X' i_save = 'U' * IS_VARIANT = * IT_EVENTS = * IT_EVENT_EXIT = * IS_PRINT = * IS_REPREP_ID = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_HTML_HEIGHT_TOP = 0 * I_HTML_HEIGHT_END = 0 * IT_ALV_GRAPHICS = * IT_HYPERLINK = * IT_ADD_FIELDCAT = * IT_EXCEPT_QINFO = * IR_SALV_FULLSCREEN_ADAPTER = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = .

ewbez AS zzvariety.p2 text *&---------------------------------------------------------------------* FORM get_data_r3 . zzwtype. gs_final-totot = lwa_hamali-zzamount. gs_final-totot = lwa_hamali-zzamount. gs_final-tol2 = lwa_hamali-zzamount. WHEN '2'. WHEN '4'. zzdept. gs_final-tol1 = lwa_hamali-zzamount. gs_final-tol4 = lwa_hamali-zzamount. IF sy-subrc <> 0. zzdate. "** Crop gs_final-crop = lwa_hamali-wgbez. gs_final-totot = lwa_hamali-zzamount. WHEN '1'. gs_final-totot = lwa_hamali-zzamount. . LOOP AT lit_hamali INTO DATA(lwa_hamali). zzamount FROM zfi_hamali INTO TABLE @DATA(lit_hamali) WHERE werks IN @s_werks AND zzdate IN @s_date. WHEN '3'. zztolly. *&---------------------------------------------------------------------* *& Form GET_DATA_R3 *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-. * Implement suitable error handling here ENDIF. "** Tolly1 "** Tolly2 "** Tolly3 "** Tolly4 "** Tolly5 "** Tolly6 "** Total CASE lwa_hamali-zztolly. wgbez. ENDFORM.* ES_EXIT_CAUSED_BY_USER = TABLES t_outtab = gt_final EXCEPTIONS program_error = 1 OTHERS = 2. gs_final-tol3 = lwa_hamali-zzamount. SELECT zzslno. werks.

COLLECT gs_final INTO gt_final. APPEND gs_fcat TO gt_fcat. WHEN '6'. fieldcat 'TOL5' '6' 'Tolly5'. CLEAR gs_fcat. fieldcat 'CROP ' '1' 'Crop'. gs_layout-colwidth_optimize = 'X'. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING * I_INTERFACE_CHECK = ' ' * I_BYPASSING_BUFFER = ' ' * I_BUFFER_ACTIVE = ' ' i_callback_program = sy-repid * I_CALLBACK_PF_STATUS_SET = ' ' * I_CALLBACK_USER_COMMAND = ' ' * I_CALLBACK_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_END_OF_LIST = ' ' * I_STRUCTURE_NAME = * I_BACKGROUND_ID = ' ' * I_GRID_TITLE = * I_GRID_SETTINGS = is_layout = gs_layout . gs_final-totot = lwa_hamali-zzamount. gs_fcat-col_pos = &2.p2 text *&---------------------------------------------------------------------* FORM display_r3 . fieldcat 'TOTOT' '8' 'Total'. fieldcat 'TOL4' '5' 'Tolly4'. END-OF-DEFINITION. gs_fcat-seltext_m = &3. fieldcat 'TOL3' '4' 'Tolly3'. fieldcat 'TOL2' '3' 'Tolly2'. *&---------------------------------------------------------------------* *& Form DISPLAY_R3 *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-. ENDCASE. ENDLOOP. gs_fcat-fieldname = &1. ENDFORM. DEFINE fieldcat. CLEAR gs_final. gs_final-tol5 = lwa_hamali-zzamount. fieldcat 'TOL1' '2' 'Tolly1'. WHEN '5'. gs_final-tol6 = lwa_hamali-zzamount. fieldcat 'TOL6' '7' 'Tolly6'. gs_final-totot = lwa_hamali-zzamount.

zzdate. *&---------------------------------------------------------------------* *& Form GET_DATA_R4 *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-. it_fieldcat = gt_fcat * IT_EXCLUDING = * IT_SPECIAL_GROUPS = * it_sort = * IT_FILTER = * IS_SEL_HIDE = i_default = 'X' i_save = 'U' * IS_VARIANT = * IT_EVENTS = * IT_EVENT_EXIT = * IS_PRINT = * IS_REPREP_ID = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_HTML_HEIGHT_TOP = 0 * I_HTML_HEIGHT_END = 0 * IT_ALV_GRAPHICS = * IT_HYPERLINK = * IT_ADD_FIELDCAT = * IT_EXCEPT_QINFO = * IR_SALV_FULLSCREEN_ADAPTER = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES t_outtab = gt_final EXCEPTIONS program_error = 1 OTHERS = 2. wgbez. ewbez AS zzvariety.p2 text *&---------------------------------------------------------------------* FORM get_data_r4 . zzamount FROM zfi_hamali INTO TABLE @DATA(lit_hamali) WHERE werks IN @s_werks AND . ENDFORM. SELECT zzslno. IF sy-subrc <> 0. zzwtype. werks. zztolly. zzdept. * Implement suitable error handling here ENDIF.

"** Plant gs_final-werks = lwa_hamali-werks. WHEN 2. DELETE ADJACENT DUPLICATES FROM lit_hama COMPARING werks. ENDIF. CLEAR gs_final. DEFINE fieldcat. gs_final-topro = lwa_hamali-zzamount. ENDLOOP. zzdate IN @s_date. gs_final-totot = lwa_hamali-zzamount. SELECT werks. gs_fcat-col_pos = &2. "** Production "** Processing "** Marketing CASE lwa_hamali-zzdept. COLLECT gs_final INTO gt_final. data(lit_hama) = lit_hamali. IF lit_hama IS NOT INITIAL. gs_final-name1 = lwa_t001w-name1. *&---------------------------------------------------------------------* *& Form DISPLAY_R4 *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-. gs_final-topdt = lwa_hamali-zzamount. WHEN 3. .p2 text *&---------------------------------------------------------------------* FORM display_r4 . ENDFORM. IF lit_hamali IS NOT INITIAL. gs_fcat-fieldname = &1. gs_fcat-seltext_m = &3. ENDIF. "** Plant Name READ TABLE lit_t001w INTO DATA(lwa_t001w) WITH KEY werks = lwa_hamali-werks. LOOP AT lit_hamali INTO DATA(lwa_hamali). SORT lit_hama BY werks. ENDCASE. gs_fcat-do_sum = &4. gs_final-tomar = lwa_hamali-zzamount. name1 FROM t001w INTO TABLE @DATA(lit_t001w) FOR ALL ENTRIES IN @lit_hama WHERE werks = @lit_hama-werks. WHEN 1.

fieldcat 'NAME1 ' '2' 'Plant Name' ''. fieldcat 'TOMAR' '5' 'Hamali Outward' 'X'. CLEAR gs_fcat. fieldcat 'TOPRO' '4' 'Hamali Internal Transfer' 'X'. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING * I_INTERFACE_CHECK = ' ' * I_BYPASSING_BUFFER = ' ' * I_BUFFER_ACTIVE = ' ' i_callback_program = sy-repid * I_CALLBACK_PF_STATUS_SET = ' ' * I_CALLBACK_USER_COMMAND = ' ' * I_CALLBACK_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_END_OF_LIST = ' ' * I_STRUCTURE_NAME = * I_BACKGROUND_ID = ' ' * I_GRID_TITLE = * I_GRID_SETTINGS = is_layout = gs_layout it_fieldcat = gt_fcat * IT_EXCLUDING = * IT_SPECIAL_GROUPS = * it_sort = * IT_FILTER = * IS_SEL_HIDE = i_default = 'X' i_save = 'U' * IS_VARIANT = * IT_EVENTS = * IT_EVENT_EXIT = * IS_PRINT = * IS_REPREP_ID = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_HTML_HEIGHT_TOP = 0 * I_HTML_HEIGHT_END = 0 * IT_ALV_GRAPHICS = * IT_HYPERLINK = * IT_ADD_FIELDCAT = * IT_EXCEPT_QINFO = * IR_SALV_FULLSCREEN_ADAPTER = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES t_outtab = gt_final EXCEPTIONS . APPEND gs_fcat TO gt_fcat. fieldcat 'TOPDT' '3' 'Hamali Inward' 'X'. END-OF-DEFINITION. gs_layout-colwidth_optimize = 'X'. fieldcat 'WERKS ' '1' 'Plant' ''. fieldcat 'TOTOT' '6' 'Hamalli Total' 'X'.

ENDFORM. program_error = 1 OTHERS = 2. * Implement suitable error handling here ENDIF. IF sy-subrc <> 0. .