Skip to Content
0
Jun 29, 2007 at 09:54 AM

Abour report containing classes - urgent pls

13 Views

hi to all,

i have to study this report and analyse output coming how. iam in debugging observed that value(total) last column in the output giving some value in debugging but in output it is giving some other value. can any one pls help me.

like if in debugging it is giving total-as -68.13 but in grid display it is displaying as 473.10 like.

REPORT ZFIRD035 MESSAGE-ID zfi_e1

NO STANDARD PAGE HEADING

LINE-COUNT 58

LINE-SIZE 200.

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

  • Author.......:*

  • *

  • Date Created.: Aug 21, 2006

  • Request #....: *

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

  • Purpose......: This program summarizes accounting journal entries

  • by biller. The biller is recognized by the first three

  • chararcters of the reference field.

  • Inputs.......:

  • Outputs......: *

  • Selections...: *

  • *

  • Logical D/B..: *

  • Includes.....: *

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

  • Predefine a local class for event handling to allow the

  • declaration of a reference variable before the class is defined.

CLASS lcl_event_receiver DEFINITION DEFERRED.

TABLES:

bkpf, "Accounting document header

bseg, "Accounting document segment

zmapzce1. "CostElement to ZCE1COPA Mapping

TYPES: BEGIN OF disp_tab , "Internal Table D_TAB

usnam LIKE bkpf-usnam, "User Id

blart LIKE bkpf-blart, "Document type

bukrs LIKE bkpf-bukrs, "Company code

bldat LIKE bkpf-bldat, "Date of the document

xblnr LIKE bkpf-xblnr, "refernce number

belnr LIKE bkpf-belnr, "Accounting document number

buzei LIKE bseg-buzei, "Line Item Number

prctr LIKE bseg-prctr, "Profit center

kostl LIKE bseg-kostl, "Cost center

hkont LIKE bseg-hkont, "Account number

matnr LIKE bseg-matnr, "Product code

aufnr LIKE bseg-aufnr, "Internal order

projk LIKE bseg-projk, "WBS Element

budat LIKE bkpf-budat, "Posting date

bschl LIKE bseg-bschl, "Posting Key

dmbtr LIKE bseg-dmbtr, "Amount in document currency

sgtxt LIKE bseg-sgtxt, "Description

zuonr LIKE bseg-zuonr, "Allocation

shkzg LIKE bseg-shkzg, "Debit/Credit Indicator

END OF disp_tab.

DATA: gv_prdha_all LIKE mara-prdha.

FIELD-SYMBOLS: .

DATA: BEGIN OF gv_prdha,

wwph1(5) TYPE c,

wwph2(5) TYPE c,

wwph3(8) TYPE c.

DATA: END OF gv_prdha.

DATA save_matnr LIKE mara-matnr.

DATA: d_tab TYPE disp_tab OCCURS 0 WITH HEADER LINE.

TYPES: BEGIN OF out_tab2. "Internal Table out_TAB

INCLUDE STRUCTURE zfirevje.

TYPES: END OF out_tab2.

DATA: BEGIN OF zfirevje OCCURS 50.

INCLUDE STRUCTURE zfirevje.

DATA: END OF zfirevje.

DATA: ok_code LIKE sy-ucomm,

gt_jesum TYPE TABLE OF zfirevje,

gt_jesum2 TYPE zfirevje OCCURS 100 WITH HEADER LINE,

g_container TYPE scrfname VALUE 'ZFIRD035_0100_CONT1',

*----


Start of Change - DR1K901005 - JIRA#: ENT-93----

-


*>>> Added:

  • Field catalog table

git_fieldcat TYPE lvc_t_fcat, "field catalog table

*----


End of Change - DR1K901005 - JIRA#: ENT-93----

-


grid1 TYPE REF TO cl_gui_alv_grid,

g_custom_container TYPE REF TO cl_gui_custom_container,

event_receiver TYPE REF TO lcl_event_receiver.

*

  • lcl_event_receiver (Implementation)

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

  • LOCAL CLASSES: Definition

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

*===============================================================

  • class lcl_event_receiver: local class to handle event DOUBLE_CLICK

  • and CLOSE.

*

  • Definition:

  • ~~~~~~~~~~~

CLASS lcl_event_receiver DEFINITION.

PUBLIC SECTION.

METHODS:

handle_double_click

FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING e_row e_column.

PRIVATE SECTION.

DATA: dialogbox_status TYPE c. "'X': does exist, SPACE: does not ex.

ENDCLASS.

*

  • lcl_event_receiver (Definition)

*===============================================================

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

  • LOCAL CLASSES: Implementation

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

*===============================================================

  • class c_event_receiver (Implementation)

*

  • In this example, only event DOUBLE_CLICK is caught

*

CLASS lcl_event_receiver IMPLEMENTATION.

  • §3.At doubleclick(1): The event DOUBLE_CLICK provides

  • parameters of the clicked row and column.

  • Use row parameter to select a line of the

  • corresponding internal table.

METHOD handle_double_click.

DATA: ls_jesum LIKE LINE OF gt_jesum.

  • read selected row from internal table gt_sflight

  • read table gt_jesum index e_row-index into ls_jesum.

  • call function 'REMD_SHOW_MASTER_DATA'

  • exporting

  • i_objnr = ls_jesum-recnobjnr

  • I_IMKEY =

  • I_INTRENO =

  • I_CHANGE = ' '

  • exceptions

  • unknown_type = 1

  • object_key_inconsistent = 2

  • others = 3.

ENDMETHOD.

*----


*

ENDCLASS.

DATA: x_save, "for Parameter I_SAVE

gs_layout TYPE lvc_s_layo,

gs_variant TYPE disvariant. "for parameter IS_VARIANT

DATA: BEGIN OF fieldnames OCCURS 25,

fieldname(30) TYPE c, "download col names

END OF fieldnames.

DATA:

program_name LIKE sy-repid, "Program Name for Call

title_line_1 LIKE sy-title, "Report Title Line 1

title_line_2 LIKE sy-title, "Report Title Line

title_line_3 LIKE sy-title, "Report Title Line

sum_cdmbtr LIKE bseg-dmbtr, "Sum credit amt for document

sum_ddmbtr LIKE bseg-dmbtr, "Sum debit amt for document

total_cdmbtr LIKE bseg-dmbtr, "Total credit amount

total_ddmbtr LIKE bseg-dmbtr, "Total debit amount

ddmbtr LIKE bseg-dmbtr, "Debit amount

cdmbtr LIKE bseg-dmbtr, "Credit amount

dec_dmbtr(16) TYPE p DECIMALS 2, "Amount in decimal format

disp_prctr(5) TYPE c, "Work var for prctr

gv_zuonr LIKE bseg-zuonr, "Assignment field

gv_shkzg LIKE bseg-shkzg, "Dr/Cr Ind.

gv_hkont LIKE bseg-hkont, "Account nbr

gv_amount LIKE bseg-pswbt, "G/L amount

gv_currncy LIKE bseg-pswsl, "Currency

gv_matnr LIKE bseg-matnr, "Product

BEGIN OF w_filename,

w_directory(22) TYPE c, "file directory name

w_userid(7) TYPE c, "User Id

w_filenm2(20) TYPE c, "file name continuation

END OF w_filename.

  • Selection Screen Options ******************

SELECTION-SCREEN BEGIN OF BLOCK rpt WITH FRAME TITLE text-003.

SELECT-OPTIONS: sbukrs FOR bkpf-bukrs OBLIGATORY,

sbelnr FOR bkpf-belnr,

sgjahr FOR bkpf-gjahr OBLIGATORY,

smonat FOR bkpf-monat OBLIGATORY,

sxblnr FOR bkpf-xblnr,

sprctr FOR bseg-prctr,

  • shkont FOR bseg-hkont.

shkont FOR zmapzce1-saknr."G/L account number

*----


Start of Change - DR1K901005 - JIRA#: ENT-93----

-


*>>> Removed:

*SELECTION-SCREEN BEGIN OF LINE.

*SELECTION-SCREEN COMMENT 1(31) text-005.

*PARAMETERS: p_pdtls AS CHECKBOX DEFAULT ' '. "flag

*SELECTION-SCREEN END OF LINE.

*

*SELECTION-SCREEN BEGIN OF LINE.

*SELECTION-SCREEN COMMENT 1(31) text-004.

*PARAMETERS: p_hdtls AS CHECKBOX DEFAULT ' '. "flag

*SELECTION-SCREEN END OF LINE.

*----


End of Change - DR1K901005 - JIRA#: ENT-93----

-


SELECTION-SCREEN END OF BLOCK rpt.

INITIALIZATION.

  • init accounts

MOVE 'I' TO shkont-sign.

MOVE 'EQ' TO shkont-option.

*----


Start of Change - DR1K901005 - JIRA#: ENT-93----

-


*>>> Removed:

  • MOVE '0000200000' TO shkont-low.

  • MOVE '0000299999' TO shkont-high.

*>>> Added:

  • MOVE '0000400100' TO shkont-low.

  • MOVE '0000400199' TO shkont-high.

*----


End of Change - DR1K901005 - JIRA#: ENT-93----

-


  • APPEND shkont.

START-OF-SELECTION.

  • set pf-status 'VDOC'.

PERFORM get_je_data

TABLES gt_jesum.

IF sy-subrc = 0.

CALL SCREEN 100.

ELSE.

MESSAGE ID 'F5' TYPE 'S' NUMBER '194'.

ENDIF.

END-OF-SELECTION.

*&----


*

*& Form get_je_data

*&----


*

  • loads the internal table for jesum

*----


*

FORM get_je_data TABLES gt_jesum STRUCTURE zfirevje.

SELECT *

FROM bkpf

WHERE bukrs IN sbukrs

AND belnr IN sbelnr

AND gjahr IN sgjahr

AND monat IN smonat

AND xblnr IN sxblnr.

PERFORM save_to_dtab.

CLEAR: gv_zuonr, gv_shkzg, gv_amount,

gv_hkont, gv_currncy, gv_matnr.

SELECT zuonr shkzg pswbt

pswsl hkont matnr

INTO (gv_zuonr, gv_shkzg, gv_amount,

gv_currncy, gv_hkont, gv_matnr)

FROM bseg

WHERE bukrs EQ bkpf-bukrs "IN sbukrs

AND belnr EQ bkpf-belnr "IN sbelnr

AND gjahr EQ bkpf-gjahr "IN sgjahr

AND hkont IN shkont

AND prctr IN sprctr.

PERFORM save_to_outtab TABLES gt_jesum.

ENDSELECT.

ENDSELECT.

ENDFORM.

*----


*

  • FORM SAVE_TO_DTAB *

*----


*

FORM save_to_dtab.

CLEAR d_tab.

MOVE-CORRESPONDING bkpf TO d_tab.

APPEND d_tab.

ENDFORM.

*----


*

  • FORM SAVE_TO_OUTTAB *

*----


*

FORM save_to_outtab TABLES gt_jesum STRUCTURE zfirevje.

DATA: tempamount LIKE tdrxx-wrbtr,

subacct(2) TYPE c.

CLEAR: gt_jesum, tempamount, subacct.

IF d_tab-xblnr+0(1) = '@'.

gt_jesum-zbiller = d_tab-xblnr+1(2).

*----


Start of Change - DR1K901241 - JIRA#: ENT-102----

-


*>>> Removed:

  • gt_jesum-zcyclenbr = gv_zuonr+6(2).

*>>> Added:

gt_jesum-zcyclenbr = gv_zuonr+3(2).

SELECT SINGLE zbillname

INTO gt_jesum-zbillname

FROM zbillers

WHERE zbiller = gt_jesum-zbiller.

IF sy-subrc <> 0.

gt_jesum-zbillname = 'Non-biller entries'.

ENDIF.

*----


End of Change - DR1K901241 - JIRA#: ENT-102----

-


ELSE.

gt_jesum-zbiller = d_tab-xblnr+0(2).

gt_jesum-zbillname = 'Non-biller entries'.

ENDIF.

*>>> Removed: IES out now identified by biller @NX

  • IF gt_jesum-zbillname = 'IES'.

  • IF gv_matnr IS INITIAL.

  • gt_jesum-zbillname = 'IES-OUT'.

  • ELSE.

  • gt_jesum-zbillname = 'IES-IN'.

  • ENDIF.

  • ENDIF.

*----


Start of Change - DR1K901241 - JIRA#: ENT-102----

-


*>>> Removed:

  • gt_jesum-zruntype = gv_zuonr+3(2).

*>>> Added:

gt_jesum-zruntype = gv_zuonr(2).

*----


End of Change - DR1K901241 - JIRA#: ENT-102----

-


IF d_tab-xblnr+0(1) = '@'.

CASE gt_jesum-zruntype.

WHEN 'RB'. gt_jesum-zruntype_desc = 'Billed'.

WHEN 'UB'. gt_jesum-zruntype_desc = 'Unbilled'.

WHEN OTHERS. gt_jesum-zruntype_desc = 'Other bller entries'.

ENDCASE.

ELSE.

gt_jesum-zruntype_desc = 'Non-biller entry'.

ENDIF.

IF gv_shkzg = 'H'.

tempamount = gv_amount * -1.

ELSE.

tempamount = gv_amount.

ENDIF.

subacct = gv_hkont+8(2).

CASE subacct.

WHEN '00'. "Gross Billing

gt_jesum-vvgrb001 = tempamount.

WHEN '80'. "Accruals

gt_jesum-vvbaa001 = tempamount.

WHEN '85'. "Reversals

gt_jesum-vvrba001 = tempamount.

WHEN '15'. "Discount

gt_jesum-vvdis001 = tempamount.

WHEN '81'. "Discount Accruals

gt_jesum-vvdac001 = tempamount.

WHEN '86'. "Discount Reversals

gt_jesum-vvrda001 = tempamount.

WHEN '70'. "Other

gt_jesum-vvoth001 = tempamount.

WHEN '65'. "Sale Allowance

gt_jesum-vvsa001 = tempamount.

WHEN '60'. "Reba tes

gt_jesum-vvrab001 = tempamount.

WHEN '10'. "Adjustments

gt_jesum-vvadj001 = tempamount.

WHEN '75'. "Manual Bils

gt_jesum-vvman001 = tempamount.

WHEN '20'. "Inbound Settlements

gt_jesum-vvinb001 = tempamount.

ENDCASE.

gt_jesum-total = tempamount.

gt_jesum-pswsl = gv_currncy.

*----


Start of Change - DR1K901005 - JIRA#: ENT-93----

-


*>>> Removed:

  • IF p_pdtls = 'X' OR p_hdtls = 'X'.

  • PERFORM get_product_hierarchy

  • USING gv_matnr

  • CHANGING gt_jesum-matnr

  • gt_jesum-wwph1

  • gt_jesum-wwph2

  • gt_jesum-wwph3.

  • ENDIF.

*----


End of Change - DR1K901005 - JIRA#: ENT-93----

-


COLLECT gt_jesum.

  • SORT gt_jesum BY zbiller zruntype.

ENDFORM.

*----


*

  • MODULE PBO OUTPUT *

*----


*

MODULE pbo OUTPUT.

SET PF-STATUS 'MAIN100'.

IF g_custom_container IS INITIAL.

CREATE OBJECT g_custom_container

EXPORTING container_name = g_container

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5.

CREATE OBJECT grid1

EXPORTING i_parent = g_custom_container.

CALL METHOD grid1->get_frontend_layout

IMPORTING

es_layout = gs_layout.

gs_layout-cwidth_opt = 'X'.

CALL METHOD grid1->set_3d_border

EXPORTING

border = 1.

gs_layout-grid_title =

'Revenue journal entry summary by biller and type'(100).

x_save = 'A'.

gs_variant = '/ZFIRD035'.

*----


Start of Change - DR1K901005 - JIRA#: ENT-93----

-


*>>> Added:

PERFORM prepare_field_catalogue.

*----


End of Change - DR1K901005 - JIRA#: ENT-93----

-


CALL METHOD grid1->set_table_for_first_display

EXPORTING

*----


Start of Change - DR1K901005 - JIRA#: ENT-93----

-


*>>> Removed:

  • i_structure_name = 'ZFIREVJE'

*----


End of Change - DR1K901005 - JIRA#: ENT-93----

-


is_variant = gs_variant

is_layout = gs_layout

i_save = x_save

CHANGING it_outtab = gt_jesum

*----


Start of Change - DR1K901005 - JIRA#: ENT-93----

-


*>>> Added:

it_fieldcatalog = git_fieldcat[]

*----


End of Change - DR1K901005 - JIRA#: ENT-93----

-


.

********

  • ->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->handle_double_click FOR grid1.

*CALL METHOD grid1->refresh_table_display

  • EXPORTING

  • IS_STABLE = <structure of type LVC_S_STBL >

  • I_SOFT_REFRESH = 'X'.

ENDIF.

ENDMODULE.

*----


*

  • MODULE PAI INPUT *

*----


*

MODULE pai INPUT.

  • to react on oi_custom_events:

DATA: lt_t_row TYPE lvc_t_row,

wa_t_row LIKE LINE OF lt_t_row,

ls_jesum LIKE LINE OF gt_jesum.

CALL METHOD cl_gui_cfw=>dispatch.

CASE ok_code.

WHEN 'EXIT'.

PERFORM exit_program.

WHEN 'BACK'.

PERFORM exit_listing.

WHEN OTHERS.

  • do nothing

ENDCASE.

CLEAR ok_code.

ENDMODULE.

*----


*

  • FORM EXIT_PROGRAM *

*----


*

FORM exit_program.

CALL METHOD g_custom_container->free.

CALL METHOD cl_gui_cfw=>flush.

LEAVE PROGRAM.

ENDFORM.

*&----


*

*& Form exit_Listing

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM exit_listing.

CALL METHOD g_custom_container->free.

CALL METHOD cl_gui_cfw=>flush.

LEAVE TO TRANSACTION 'ZF06'.

ENDFORM. " exit_Listing

*&----


*

*& Form get_product_hierarchy

*&----


*

  • text

*----


*

  • -->P_GV_MATNR text

  • <--P_GT_WWPH1 text

  • <--P_GT_WWPH2 text

  • <--P_GT_WWPH3 text

*----


*

FORM get_product_hierarchy USING p_gv_matnr

CHANGING p_gt_matnr

p_gt_wwph1

p_gt_wwph2

p_gt_wwph3.

IF p_gv_matnr = gv_prdha_all.

ENDIF.

ENDSELECT.

ELSE.

ENDIF.

*----


Start of Change - DR1K901005 - JIRA#: ENT-93----

-


*>>> Removed:

  • IF p_pdtls = 'X'.

  • p_gt_matnr = p_gv_matnr.

  • ENDIF.

*

  • IF p_hdtls = 'X'.

  • p_gt_wwph1 = gv_prdha-wwph1.

  • p_gt_wwph2 = gv_prdha-wwph2.

  • p_gt_wwph3 = gv_prdha-wwph3.

  • ENDIF.

*----


End of Change - DR1K901005 - JIRA#: ENT-93----

-


ENDFORM. " get_product_hierarchy

*----


Start of Change - DR1K901005 - JIRA#: ENT-93----

-


*>>> Added:

*----


*

  • FORM prepare_summary_catalogue

*----


*

  • Prepare catalogue for Report

*----


*

FORM prepare_field_catalogue.

DATA: lwa_fieldcat TYPE lvc_s_fcat.

REFRESH: git_fieldcat.

CLEAR git_fieldcat.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

  • I_BUFFER_ACTIVE =

I_STRUCTURE_NAME = 'ZFIREVJE'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_BYPASSING_BUFFER =

CHANGING

ct_fieldcat = git_fieldcat

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3

.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • Do not display Material, ProH1, ProH2, and ProHLe3.

READ TABLE git_fieldcat INTO lwa_fieldcat

WITH KEY fieldname = 'MATNR'.

lwa_fieldcat-no_out = 'X'.

MODIFY git_fieldcat FROM lwa_fieldcat INDEX sy-tabix.

READ TABLE git_fieldcat INTO lwa_fieldcat

WITH KEY fieldname = 'WWPH1'.

lwa_fieldcat-no_out = 'X'.

MODIFY git_fieldcat FROM lwa_fieldcat INDEX sy-tabix.

READ TABLE git_fieldcat INTO lwa_fieldcat

WITH KEY fieldname = 'WWPH2'.

lwa_fieldcat-no_out = 'X'.

MODIFY git_fieldcat FROM lwa_fieldcat INDEX sy-tabix.

READ TABLE git_fieldcat INTO lwa_fieldcat

WITH KEY fieldname = 'WWPH3'.

lwa_fieldcat-no_out = 'X'.

MODIFY git_fieldcat FROM lwa_fieldcat INDEX sy-tabix.

ENDFORM. "prepare_field_catalogue

*----


End of Change - DR1K901005 - JIRA#: ENT-93----

-