*********************************************************************** * Program: ZAR00009 Creation Date: 2002/02/21 * Title : Industrial Development Bond Issue Detail * Author : Ashish Gupta / Shobana

chakravarthi * Type : Report Script ID: PACF012-D * Safari ID: PACF012-D *********************************************************************** * Description: Report to list Bond Issue Detail of Real Property * assets ************************************************************************ * Selection Screen : Company Code * Asset Number * Sub-number * Asset class * Business area * Cost center * Plant * Location * Asset super number * Worklist * Report Date * Depreciation date * Sort version * Translation method * Balance sheet account * Capitalization date * Acquisition value * Accumulated depreciation * Book value *Other objects : Funtion modules : * REUSE_ALV_FIELDCATALOG_MERGE * Z_ALVTEMPLATE ************************************************************************ * Modification History: * YYYY/MM/DD Author * Correction Description ************************************************************************ REPORT zar00009 LINE-SIZE 132 LINE-COUNT 65 NO STANDARD PAGE HEADING. * TYPES DECLARATION TYPE-POOLS: slis. TYPES : BEGIN OF gt_data , werks LIKE anlz-werks, ktogr LIKE anla-ktogr, anlkl LIKE anla-anlkl, anln1 LIKE anla-anln1, txt50 LIKE anla-txt50, invnr LIKE anla-invnr, aibn1 LIKE anla-aibn1, zugdt LIKE anla-zugdt, kansw LIKE anlc-kansw, answl LIKE anlc-answl, ktansw LIKE t095-ktansw, END OF gt_data. * INTERNAL TABLE DECLARATION " " " " " " " " " " " Plant code G/L Account Number Asset class Asset number Asset description Inventory number Far code Aquisition Date Asset acquisition value Transactions affecting asset values Bal. sheet account

gv_butxt LIKE t001-butxt. * Result display with ALV list tool . gv_total LIKE anlc-kansw. * START-OF-SELECTION START-OF-SELECTION. " ktansw1 LIKE t095-ktansw. Plant code " G/L Account Number Asset number Inventory number Asset description Asset class Far code Aquisition Date Asset acquisition value * ALV DATA * Structures required for ALV DATA : gi_fieldcat TYPE slis_t_fieldcat_alv. Plant code Balance sheets acc. werks LIKE anlz-werks. * VARIABLE DECLARATION DATA : gv_repid LIKE sy-repid. anln1 LIKE anla-anln1. * AT-SELECTION-SCREEN AT SELECTION-SCREEN. " END OF gi_disp. " anlkl LIKE anla-anlkl. " ktansw LIKE t095-ktansw. PERFORM selection_screen_validation. ****************************MAIN PROGRAM******************************** * INITIALIZATION INITIALIZATION. * Program name must be passed into a variable gv_repid = sy-repid. " kansw LIKE anlc-kansw. * Selection screen validations. gi_event TYPE slis_t_event. " zugdt(10). " txt50 LIKE anla-txt50. DATA : BEGIN OF gi_disp OCCURS 0. " aibn1 LIKE anla-aibn1. " " " " Field catalog Layout Sort criteria Events * CONSTANT DECLARATION CONSTANTS: c_disp LIKE dd02l-tabname VALUE 'GI_DISP'. gi_sort TYPE slis_t_sortinfo_alv. * END-OF-SELECTION END-OF-SELECTION. " invnr LIKE anla-invnr. * Get the data from the tables and store it in the internal table PERFORM report_data. " werks1 LIKE anlz-werks. gv_layout TYPE slis_layout_alv. * INCLUDES / SELECTION SCREEN DECLARATION * Include for selection screen INCLUDE zzipacf. * ALV variables & structures default initialization for main list PERFORM init_alv.DATA gi_data TYPE STANDARD TABLE OF gt_data.

DATA: lwa_data LIKE LINE OF gi_data. *----------------------------------------------------------------------* * Form report_data *----------------------------------------------------------------------* * Get the data from the tables and store it in the internal * total *----------------------------------------------------------------------* FORM report_data. SELECT SINGLE ktansw INTO lwa_data-ktansw FROM t095 WHERE ktopl EQ gc_chart AND . CHECK NOT gi_data[] IS INITIAL.PERFORM alv_list_display. lv_werks1 like anlz-werks. lv_ktansw1 like t095-ktansw. SELECT anlz~werks " Plant/Location anla~ktogr " GL account number anla~anlkl " Asset class/SAR code anla~anln1 " Main asset number anla~txt50 " Asset main number text anla~invnr " Inventory number anla~aibn1 " FAR/ Original asset anla~zugdt " Aquisition date anlc~kansw " Cumulative acquisition and production costs anlc~answl " Transactions for the year affecting asset values INTO TABLE gi_data FROM anla JOIN anlc ON anla~bukrs = anlc~bukrs AND anla~anln1 = anlc~anln1 AND anla~anln2 = anlc~anln2 JOIN anlz ON anlc~bukrs = anlz~bukrs AND anlc~anln1 = anlz~anln1 AND anlc~anln2 = anlz~anln2 WHERE anla~bukrs EQ p_bukrs AND anla~anln1 IN s_anln1 AND anla~anlkl IN s_anlkl AND anla~anlue IN s_anlue AND anla~ktogr IN s_ktogr AND anla~aktiv IN s_aktiv AND anla~vmgli IN s_vmgli AND anlc~afabe = p_afabe AND anlc~kansw IN s_kansw AND anlc~knafa IN s_knafa AND anlz~werks IN s_werks AND anlz~kostl IN s_kostl AND anlz~gsber IN s_gsber AND anlz~stort IN s_stort. LOOP AT gi_data INTO lwa_data.

** Format data for display. lwa_data-anln1 TO gi_disp-anln1. AT NEW ktansw. " at new ktogr. MOVE: lwa_data-werks TO gi_disp-werks.ktogr EQ lwa_data-ktogr AND afabe EQ gc_deparea. * If no data found. * Additional WERKS KTOGR ANLKL populated for display MOVE: gi_disp-werks TO lv_werks1. ENDLOOP. lwa_data-invnr TO gi_disp-invnr. " loop at gi_data. lwa_data. " report_data *----------------------------------------------------------------------* * Form alv_list_display *----------------------------------------------------------------------* * Display the report in ALV format *----------------------------------------------------------------------* FORM alv_list_display. APPEND gi_disp. ENDAT. gi_disp-kansw = lwa_data-kansw + lwa_data-answl. * Grand Total AT LAST. LOOP AT gi_disp. lwa_data-ktansw TO gi_disp-ktansw. SUM. CLEAR: gi_disp. lwa_data-anlkl TO gi_disp-anlkl. * result display with ALV tool CALL FUNCTION 'Z_ALVTEMPLATE' EXPORTING i_callback_program i_internal_tabname it_fieldcat i_inclname is_layout it_sort = = = = = = gv_repid c_disp gi_fieldcat gv_repid gv_layout gi_sort . the message 'List contains no data' is displayed SORT gi_disp BY werks ktansw anlkl. " at last. gi_disp-werks1 = lv_werks1. gi_disp-ktansw TO lv_ktansw1. gi_disp-ktansw1 = lv_ktansw1. lwa_data-txt50 TO gi_disp-txt50. MODIFY gi_disp. ENDLOOP. WRITE lwa_data-zugdt TO gi_disp-zugdt MM/DD/YYYY. gv_total = lwa_data-kansw + lwa_data-answl. ENDFORM. lwa_data-aibn1 TO gi_disp-aibn1. ENDAT.

. SELECT SINGLE butxt FROM t001 INTO gv_butxt WHERE bukrs = p_bukrs. * ENDIF. IF sy-subrc <> 0. * IF gi_disp-bukrs IS INITIAL. " init_alv *----------------------------------------------------------------------* * TOP-OF-PAGE *----------------------------------------------------------------------* * This module outputs formatted simple header information. ENDFORM. * Fill catalog if you need to make changes to the properties of the * display layout PERFORM alv_fieldcatalog_fill. " NISSAN NORTH AMERICA.it_events i_default i_save TABLES t_outtab EXCEPTIONS program_error inconsistent_interface OTHERS = gi_event = 'X' = 'U' = gi_disp = 1 = 2 = 3. INC. IF sy-subrc NE 0. Can also be done * from the layout side PERFORM change_field_properties. ENDFORM. " alv_list_display *----------------------------------------------------------------------* * Form init_alv *----------------------------------------------------------------------* * Initialize the structures of ALV Function module *----------------------------------------------------------------------* FORM init_alv. * Add event PERFORM add_event. * Error occurred in list processing (ALV) MESSAGE ID '25' TYPE 'E' NUMBER 161. PERFORM top_of_page_include USING gv_butxt text-902 text-903 text-904 text-905 text-906 text-907 . *----------------------------------------------------------------------* FORM top_of_page. ENDIF. ENDIF. "#EC CALLED * Fetch Company code text dynamically for each new company. * Any change to the properties of the display layout. * gi_disp-bukrs = ps_bukrs-low. gv_butxt = text-901.

" Sort sequence position 2 gi_sort. IF sy-subrc <> 0. * Add details display on layout gv_layout-f2code = '&ETA'. = 'GI_DISP'. wa_sort-tabname = 'GI_DISP'. . " alv_fieldcatalog_fill *----------------------------------------------------------------------* * Form change_field_properties *----------------------------------------------------------------------* * Change Field properties *----------------------------------------------------------------------* FORM change_field_properties. CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' EXPORTING i_program_name = gv_repid i_internal_tabname = c_disp i_inclname = gv_repid CHANGING ct_fieldcat = gi_fieldcat EXCEPTIONS inconsistent_interface = 1 program_error = 2 OTHERS = 3. " TOP_OF_PAGE *----------------------------------------------------------------------* * Form alv_fieldcatalog_fill *----------------------------------------------------------------------* * Fill field catalog *----------------------------------------------------------------------* FORM alv_fieldcatalog_fill. " Sort Ascending = 'X'. " Sort sequence position 1 APPEND wa_sort TO gi_sort. DATA: wa_fieldcat TYPE slis_fieldcat_alv. wa_sort TYPE slis_sortinfo_alv. CLEAR wa_sort. * Plant level: wa_sort-fieldname wa_sort-tabname wa_sort-up wa_sort-subtot wa_sort-spos APPEND wa_sort TO = 'WERKS'. " Subtotal at plant level on = 1. ENDFORM. " F2 Function key will display details gv_layout-detail_popup = 'X'. " Sort Ascending wa_sort-group = '*'. ENDIF. MESSAGE ID 'VO' TYPE 'I' NUMBER 752 WITH sy-subrc. " Gives a new page for every Ccode level wa_sort-spos = 1. " Details will be popped up gv_layout-no_totalline = 'X'. = 'X'.ENDFORM. " ALV total line not displayed ** ** * * * * * * Do subtotals/subtotals text at: Company code level: wa_sort-fieldname = 'BUKRS'. wa_sort-up = 'X'.

" Sort sequence position 3 APPEND wa_sort TO gi_sort. wa_fieldcat-seltext_m = 'PLANT'(016). " Subtotal at account level on wa_sort-spos = 2. MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING seltext_m ddictxt WHERE fieldname = 'WERKS'. * Account determination = GL_ACCT_NO CLEAR wa_fieldcat. CLEAR wa_sort. * Make the text of fields * Plant = Location CLEAR wa_fieldcat. wa_sort-up = 'X'. " Sort Ascending wa_sort-subtot = 'X'. * Gl account = HTOTAL GL ACCT CLEAR wa_fieldcat. wa_fieldcat-ddictxt = 'M'. * Asset class = SAR CODE . CLEAR wa_fieldcat. MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING reptext_ddic seltext_s seltext_l seltext_m WHERE fieldname = 'KTANSW1' . wa_fieldcat-seltext_m = 'G/L A/C'(017). wa_fieldcat-key = ' '. wa_fieldcat-seltext_l = 'G/L A/C'(017). MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING reptext_ddic seltext_s seltext_l seltext_m WHERE fieldname = 'WERKS1'. wa_fieldcat-seltext_m = 'HTOTAL G/L A/C'(006).* Plant = HTOTAL LOCATION CLEAR wa_fieldcat. * Gl account level wa_sort-fieldname = 'KTANSW'. wa_fieldcat-seltext_m = 'HTOTAL PLANT'(002). wa_fieldcat-reptext_ddic = 'PLANT'(016). * Make The key field as non-key. MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING key WHERE fieldname = 'ANLN1'. wa_fieldcat-seltext_s = 'PLANT'(016). MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING seltext_m ddictxt WHERE fieldname = 'KTANSW'. wa_fieldcat-seltext_s = 'G/L A/C'(017). wa_fieldcat-ddictxt = 'M'. wa_fieldcat-reptext_ddic = 'G/L A/C'(017). wa_fieldcat-seltext_l = 'PLANT'(016). wa_sort-tabname = 'GI_DISP'. * MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING key * WHERE fieldname = 'BUKRS'.

MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING seltext_s seltext_l seltext_m WHERE fieldname = 'ANLN1'. wa_fieldcat-seltext_s = 'ASSET CLASS'(018). wa_fieldcat-reptext_ddic = 'OLD ASSET NUMBER'(004). wa_fieldcat-seltext_m = 'ASSET CLASS'(018). wa_fieldcat-seltext_m = 'ASSET NUMBER'(020). wa_fieldcat-seltext_l = 'OLD ASSET NUMBER'(004). wa_fieldcat-seltext_l = 'ASSET DESCRIPTION'(022). wa_fieldcat-seltext_s = 'ASSET DESC'(021). * Original Asset /Project = FAR CLEAR wa_fieldcat. wa_fieldcat-seltext_l = 'ASSET CLASS'(018). MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING reptext_ddic seltext_s seltext_l seltext_m WHERE fieldname = 'AIBN1' . wa_fieldcat-seltext_l = 'PROJECT#'(023). wa_fieldcat-seltext_s = 'PROJECT#'(023). * Main Asset number = Asset number CLEAR wa_fieldcat. wa_fieldcat-seltext_m = 'ASSET DESCRIPTION'(022). wa_fieldcat-seltext_m = 'PROJECT#'(023). wa_fieldcat-reptext_ddic = 'ASSET CLASS'(018). * Accumulated Value = Total Dollars CLEAR wa_fieldcat. wa_fieldcat-seltext_s = 'ASSET NUM'(019). MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING seltext_s seltext_l seltext_m reptext_ddic WHERE fieldname = 'ANLKL' .CLEAR wa_fieldcat. wa_fieldcat-seltext_s = 'OLD ASSET NUM'(003). MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING reptext_ddic seltext_s seltext_l seltext_m WHERE fieldname = 'INVNR'. wa_fieldcat-seltext_m = 'OLD ASSET NUMBER'(004). * Main Asset description = Asset description CLEAR wa_fieldcat. MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING seltext_s seltext_l seltext_m WHERE fieldname = 'TXT50' . * Subtotals . wa_fieldcat-seltext_l = 'ASSET NUMBER'(020). * Old Asset number CLEAR wa_fieldcat. wa_fieldcat-reptext_ddic = 'PROJECT#'(023).

CHECK NOT gi_data[] IS INITIAL. wa_fieldcat-seltext_s = 'ACQ. . MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING seltext_s seltext_l seltext_m WHERE fieldname = 'ZUGDT' . "#EC CALLED DATA : lv_blank(132). APPEND lv_event TO gi_event. MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING do_sum reptext_ddic seltext_s seltext_l seltext_m WHERE fieldname = 'KANSW'. " add_event *----------------------------------------------------------------------* * Form END_OF_LIST *----------------------------------------------------------------------* * This Subroutine outputs formatted end of list information. MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING no_out WHERE fieldname = 'WERKS' . MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING no_out WHERE fieldname = 'KTANSW' . wa_fieldcat-seltext_m = 'ACQUISITION DATE'(027). lv_event-form = 'END_OF_LIST'. * Hide the header keys while displaying data CLEAR wa_fieldcat. lv_waers LIKE t001-waers. wa_fieldcat-seltext_l = 'ACQUISITION DATE'(027). * MODIFY gi_fieldcat FROM wa_fieldcat TRANSPORTING no_out * WHERE fieldname = 'BUKRS' . " change_field_properties *----------------------------------------------------------------------* * Form add_event *----------------------------------------------------------------------* * This Subroutine adds an event to the list of events. DATA lv_event LIKE LINE OF gi_event. wa_fieldcat-seltext_l = 'TOTAL DOLLARS'(025). wa_fieldcat-no_out = 'X'. wa_fieldcat-seltext_m = 'TOTAL DOLLARS'(025). * First Acquis on = ACQUISITION DATE' CLEAR wa_fieldcat. wa_fieldcat-reptext_ddic = 'TOTAL $s'(024). wa_fieldcat-seltext_s = 'TOTAL $s'(024).'(026). lv_event-name = 'END_OF_LIST'. *----------------------------------------------------------------------* FORM add_event . ENDFORM.wa_fieldcat-do_sum = 'X'. ENDFORM. DT. *----------------------------------------------------------------------* FORM end_of_list .

ULINE. FORMAT COLOR COL_TOTAL INTENSIFIED ON. 162 lv_blank(132). " END_OF_LIST . ENDFORM. ULINE.*-Assumption : Currency code taken for the obligatory company code SELECT SINGLE waers FROM t001 INTO lv_waers WHERE bukrs = p_bukrs. 144 gv_total CURRENCY lv_waers. SKIP 1. text-005. WRITE :/1 sy-vline .

Sign up to vote on this title
UsefulNot useful