2008 Jan 22 5:07 AM
How to edit the field in the output display of the ALV Grid i.e after displaying the output?
2008 Jan 22 5:10 AM
While filling the field catalog, mention the below properties for that particualr field which you want to edit at output
ls_fieldcat-input = 'X'.
ls_fieldcat-edit = 'X'.
Regards
Gopi
2008 Jan 22 5:10 AM
While filling the field catalog, mention the below properties for that particualr field which you want to edit at output
ls_fieldcat-input = 'X'.
ls_fieldcat-edit = 'X'.
Regards
Gopi
2008 Jan 22 5:31 AM
Hi,
Please check the code below for your requirement.
Hope it helps...
P.S. Please award points if it helps...
&----
*& Report ZFI_CASH_PROOF_SHEET
*&
*& PROGRAM TYPE : Report
*& RICEF ID : R-149
*& TITLE : ZFI_CASH_PROOF_SHEET
*& SAP Module : FI
*& CREATION DATE : 11/06/2007
*& AUTHOR : Aris Hidalgo
*& DESIGNER : Aris Hidalgo
&----
*& DESCRIPTION :
&----
$*********************************************************************
*$ CHANGE HISTORY
*$----
*$ DATE | T-Num | Description | Reference
| | |
$*********************************************************************
REPORT zfi_cash_proof_sheet
NO STANDARD PAGE HEADING
MESSAGE-ID zfi.
----
Data Dictionary Table/s *
----
TABLES: t012k.
CLASS lcl_event_receiver DEFINITION DEFERRED.
----
Global Data/s *
----
DATA: gt_fieldcat TYPE lvc_t_fcat,
wa_fieldcat LIKE LINE OF gt_fieldcat,
ok_code TYPE syst-ucomm,
save_ok TYPE syst-ucomm,
g_repid TYPE syst-repid,
gs_layout TYPE lvc_s_layo,
gt_sort TYPE lvc_t_sort,
gs_sort TYPE lvc_s_sort,
gs_disvariant TYPE disvariant,
gv_container TYPE scrfname VALUE 'CUSTOM_CONTROL',
lcl_grid1 TYPE REF TO cl_gui_alv_grid,
lcl_custom_container TYPE REF TO cl_gui_custom_container,
lcl_event_receiver TYPE REF TO lcl_event_receiver.
----
Global Structure/s *
----
TYPES: BEGIN OF t_output,
bukrs TYPE bsis-bukrs,
hbkid TYPE t012k-hbkid,
hktid TYPE t012k-hktid,
cash_in_bank TYPE bsis-dmbtr,
one_day TYPE bsis-dmbtr,
two_days TYPE bsis-dmbtr,
more_than_two_days TYPE bsis-dmbtr,
misc_collection TYPE bsis-dmbtr,
outs_rel_checks TYPE bsis-dmbtr,
treas_transactions TYPE c LENGTH 12,
tot_cash_bal TYPE bsis-dmbtr,
outs_unrel_checks TYPE bsis-dmbtr,
imp_docs_due TYPE bsis-dmbtr,
est_cash_balance TYPE bsis-dmbtr,
END OF t_output.
----
Global Internal Table/s *
----
DATA: gt_output TYPE STANDARD TABLE OF t_output.
----
Global Work Area/s *
----
DATA: wa_output LIKE LINE OF gt_output.
----
SELECTION-SCREEN *
----
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_bukrs FOR t012k-bukrs OBLIGATORY,
s_hbkid FOR t012k-hbkid,
s_hktid FOR t012k-hktid.
PARAMETERS: p_budat TYPE bsak-budat OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
*/ CLASS DEFINITION/S */
----
CLASS lcl_data_def DEFINITION
----
*
----
CLASS lcl_data_def DEFINITION ABSTRACT.
PUBLIC SECTION.
TYPES: BEGIN OF t_t012k,
bukrs TYPE t012k-bukrs,
hbkid TYPE t012k-hbkid,
hktid TYPE t012k-hktid,
hkont TYPE t012k-hkont,
END OF t_t012k.
TYPES: BEGIN OF t_bsis_bsas,
bukrs TYPE bsis-bukrs,
hkont TYPE bsis-hkont,
belnr TYPE bsis-belnr,
buzei TYPE bsis-buzei,
gjahr TYPE bsis-gjahr,
budat TYPE bsis-budat,
blart TYPE bsis-blart,
dmbtr TYPE bsis-dmbtr,
shkzg TYPE bsis-shkzg,
END OF t_bsis_bsas.
TYPES: BEGIN OF t_bsid,
bukrs TYPE bsid-bukrs,
belnr TYPE bsid-belnr,
gjahr TYPE bsid-gjahr,
blart TYPE bsid-blart,
buzei TYPE bsid-buzei,
budat TYPE bsid-budat,
dmbtr TYPE bsid-dmbtr,
shkzg TYPE bsid-shkzg,
bschl TYPE bsid-bschl,
END OF t_bsid.
TYPES: BEGIN OF t_bsik,
bukrs TYPE bsik-bukrs,
belnr TYPE bsik-belnr,
gjahr TYPE bsik-gjahr,
blart TYPE bsik-blart,
buzei TYPE bsik-buzei,
budat TYPE bsik-budat,
dmbtr TYPE bsik-dmbtr,
shkzg TYPE bsik-shkzg,
bschl TYPE bsik-bschl,
lifnr TYPE bsik-lifnr,
bldat TYPE bsik-bldat,
END OF t_bsik.
TYPES: BEGIN OF t_cash_in_bank,
bukrs TYPE bsis-bukrs,
hkont TYPE bsis-hkont,
dmbtr TYPE bsis-dmbtr,
END OF t_cash_in_bank.
TYPES: BEGIN OF t_outs_trade_coll,
bukrs TYPE bsis-bukrs,
hkont TYPE bsis-hkont,
one_day TYPE bsis-dmbtr,
two_days TYPE bsis-dmbtr,
more_than_two_days TYPE bsis-dmbtr,
END OF t_outs_trade_coll.
TYPES: BEGIN OF t_zcheck_monitor,
zzbukr TYPE zcheck_monitor-zzbukr,
zhbkid TYPE zcheck_monitor-zhbkid,
zhktid TYPE zcheck_monitor-zhktid,
zubhkt TYPE zcheck_monitor-zubhkt,
zrwbtr TYPE zcheck_monitor-zrwbtr,
zrlsvd TYPE zcheck_monitor-zrlsvd,
zrlsdt TYPE zcheck_monitor-zrlsdt,
END OF t_zcheck_monitor.
TYPES: BEGIN OF t_zcheck_monitor_collect,
zzbukr TYPE zcheck_monitor-zzbukr,
zubhkt TYPE zcheck_monitor-zubhkt,
zrwbtr TYPE zcheck_monitor-zrwbtr,
END OF t_zcheck_monitor_collect.
DATA: gt_t012k TYPE HASHED TABLE OF t_t012k
WITH UNIQUE KEY bukrs hbkid hktid,
gt_bsis TYPE STANDARD TABLE OF t_bsis_bsas,
wa_bsis LIKE LINE OF gt_bsis,
gt_bsas LIKE gt_bsis,
gt_bsis_bsas LIKE gt_bsas,
gt_bsid TYPE STANDARD TABLE OF t_bsid
WITH NON-UNIQUE KEY bukrs belnr gjahr blart,
gt_bsad LIKE gt_bsid,
gt_bsid_bsad LIKE gt_bsad,
gt_bsik TYPE STANDARD TABLE OF t_bsik,
gt_cash_in_bank TYPE HASHED TABLE OF t_cash_in_bank
WITH UNIQUE KEY bukrs hkont,
gt_misc_collection LIKE gt_cash_in_bank,
wa_misc_collection LIKE LINE OF gt_misc_collection,
gt_importation_docs_due LIKE gt_cash_in_bank,
wa_importation_docs_due LIKE LINE OF gt_importation_docs_due,
wa_cash_in_bank LIKE LINE OF gt_cash_in_bank,
gt_outs_trade_coll TYPE HASHED TABLE OF t_outs_trade_coll
WITH UNIQUE KEY bukrs hkont,
wa_outs_trade_coll LIKE LINE OF gt_outs_trade_coll,
gt_zcheck_monitor TYPE STANDARD TABLE OF t_zcheck_monitor,
gt_zcheck_monitor_collect TYPE HASHED TABLE OF t_zcheck_monitor_collect
WITH UNIQUE KEY zzbukr zubhkt,
wa_zcheck_monitor_collect LIKE LINE OF gt_zcheck_monitor_collect,
gt_outs_rel_checks LIKE gt_cash_in_bank,
wa_outs_rel_checks LIKE LINE OF gt_outs_rel_checks,
gt_outs_unrel_checks LIKE gt_cash_in_bank,
wa_outs_unrel_checks LIKE LINE OF gt_outs_unrel_checks.
ENDCLASS. "lcl_data_def DEFINITION
----
CLASS lcl_get_data DEFINITION
----
*
----
CLASS lcl_get_data DEFINITION INHERITING FROM lcl_data_def.
PUBLIC SECTION.
METHODS: get_bank_details,
get_gl_balances,
get_cust_items,
get_vend_items,
sum_gl_accounts,
monday_routines
IMPORTING
im_date TYPE bsis-budat
im_bukrs TYPE bsis-bukrs
im_hkont TYPE bsis-hkont
im_budat TYPE bsis-budat
im_dmbtr TYPE bsis-dmbtr,
sunday_routines
IMPORTING
im_date TYPE bsis-budat
im_bukrs TYPE bsis-bukrs
im_hkont TYPE bsis-hkont
im_budat TYPE bsis-budat
im_dmbtr TYPE bsis-dmbtr,
tuesday_routines
IMPORTING
im_date TYPE bsis-budat
im_bukrs TYPE bsis-bukrs
im_hkont TYPE bsis-hkont
im_budat TYPE bsis-budat
im_dmbtr TYPE bsis-dmbtr,
other_days_routines
IMPORTING
im_date TYPE bsis-budat
im_bukrs TYPE bsis-bukrs
im_hkont TYPE bsis-hkont
im_budat TYPE bsis-budat
im_dmbtr TYPE bsis-dmbtr,
difference_in_days
IMPORTING
im_date TYPE bsis-budat
im_budat TYPE bsis-budat
EXPORTING
ex_diff TYPE vtbbewe-atage,
outs_check_released,
process_data.
PRIVATE SECTION.
TYPES: BEGIN OF t_lfa1,
lifnr TYPE lfa1-lifnr,
land1 TYPE lfa1-land1,
END OF t_lfa1.
TYPES: BEGIN OF t_lfb1,
lifnr TYPE lfb1-lifnr,
bukrs TYPE lfb1-bukrs,
zterm TYPE lfb1-zterm,
END OF t_lfb1.
TYPES: BEGIN OF t_t052,
zterm TYPE t052-zterm,
ztagg TYPE t052-ztagg,
ztag1 TYPE t052-ztag1,
END OF t_t052.
CONSTANTS: lc_credit TYPE bsis-shkzg VALUE 'H',
lc_debit TYPE bsis-shkzg VALUE 'S',
lc_nt TYPE bsis-blart VALUE 'NT',
lc_nc TYPE bsis-blart VALUE 'NC',
lc_gl_zero TYPE bsis-hkont VALUE '+++++++++0',
lc_gl_one TYPE bsis-hkont VALUE '+++++++++1',
lc_gl_three TYPE bsis-hkont VALUE '+++++++++3',
lc_vendor_3 TYPE bsik-lifnr VALUE '3+++++++++',
lc_monday TYPE dtresr-weekday VALUE 'Monday',"#EC NOTEXT
lc_tuesday TYPE dtresr-weekday VALUE 'Tuesday',"#EC NOTEXT
lc_sunday TYPE dtresr-weekday VALUE 'Sunday'."#EC NOTEXT
CONSTANTS: lc_k3 TYPE bsik-blart VALUE 'K3',
lc_k4 TYPE bsik-blart VALUE 'K4',
lc_k5 TYPE bsik-blart VALUE 'K5',
lc_k6 TYPE bsik-blart VALUE 'K6',
lc_k7 TYPE bsik-blart VALUE 'K7',
lc_kb TYPE bsik-blart VALUE 'KB',
lc_kd TYPE bsik-blart VALUE 'KD'.
DATA: lv_hkont TYPE bsis-hkont,
lr_hkont TYPE RANGE OF bsis-hkont,
wa_hkont LIKE LINE OF lr_hkont,
lr_blart TYPE RANGE OF bsik-blart,
wa_blart LIKE LINE OF lr_blart,
lv_hkont_new TYPE bsis-hkont,
lv_hkont_old TYPE bsis-hkont,
lv_date TYPE vtbbewe-atage,
lv_budat TYPE bsis-budat,
lv_day TYPE dtresr-weekday.
ENDCLASS. "lcl_get_data DEFINITION
----
CLASS lcl_alv_routines DEFINITION
----
*
----
CLASS lcl_alv_routines DEFINITION INHERITING FROM lcl_data_def.
PUBLIC SECTION.
METHODS: build_fieldcat FINAL,
sort_alv_display FINAL.
ENDCLASS. "lcl_alv_routines DEFINITION
----
CLASS lcl_event_receiver DEFINITION
----
*
----
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING
er_data_changed.
PRIVATE SECTION.
DATA: ls_mod_cells TYPE lvc_s_modi,
lv_cash_in_bank TYPE t_output-cash_in_bank,
lv_one_day TYPE t_output-one_day,
lv_two_days TYPE t_output-two_days,
lv_more_than_two_days TYPE t_output-more_than_two_days,
lv_misc_collection TYPE t_output-misc_collection,
lv_outs_rel_checks TYPE t_output-outs_rel_checks,
lv_treas_transactions TYPE t_output-treas_transactions,
lv_tot_cash_bal TYPE t_output-tot_cash_bal,
lv_outs_unrel_checks TYPE t_output-outs_unrel_checks,
lv_imp_docs_due TYPE t_output-imp_docs_due,
lv_est_cash_balance TYPE t_output-est_cash_balance,
lv_col_info TYPE lvc_s_col,
lv_row_id TYPE lvc_s_roid.
ENDCLASS. "lcl_event_receiver DEFINITION
*/ CLASS IMPLEMENTATION/S */
----
CLASS lcl_get_data IMPLEMENTATION
----
*
----
CLASS lcl_get_data IMPLEMENTATION.
METHOD get_bank_details
METHOD get_bank_details.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
text = text-p01.
FIELD-SYMBOLS: <fs_t012k> LIKE LINE OF gt_t012k.
Get bank account/s and their corresponding G/L account/s
SELECT bukrs hbkid
hktid hkont
FROM t012k
INTO TABLE gt_t012k
WHERE bukrs IN s_bukrs
AND hbkid IN s_hbkid
AND hktid IN s_hktid.
IF NOT gt_t012k[] IS INITIAL.
SORT gt_t012k BY bukrs hbkid hktid hkont.
LOOP AT gt_t012k ASSIGNING <fs_t012k>.
wa_hkont-sign = 'I'.
wa_hkont-option = 'EQ'.
wa_hkont-low = <fs_t012k>-hkont.
SHIFT wa_hkont-low LEFT DELETING LEADING space.
APPEND wa_hkont TO lr_hkont.
CLEAR wa_hkont.
lv_hkont_new = <fs_t012k>-hkont.
IF lv_hkont_new <> lv_hkont_old.
CLEAR lv_hkont.
lv_hkont = <fs_t012k>-hkont.
DO 4 TIMES.
ADD 1 TO lv_hkont.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_hkont
IMPORTING
output = lv_hkont.
wa_hkont-sign = 'I'.
wa_hkont-option = 'EQ'.
wa_hkont-low = lv_hkont.
SHIFT wa_hkont-low LEFT DELETING LEADING space.
APPEND wa_hkont TO lr_hkont.
CLEAR wa_hkont.
ENDDO.
ENDIF.
lv_hkont_old = lv_hkont_new.
ENDLOOP.
CALL METHOD me->get_gl_balances.
ENDIF.
ENDMETHOD. "get_bank_details
METHOD get_gl_balances
METHOD get_gl_balances.
Get G/L line items(Open items)
SELECT bukrs hkont belnr
buzei gjahr budat
blart dmbtr shkzg
FROM bsis
INTO TABLE gt_bsis
FOR ALL ENTRIES IN gt_t012k
WHERE bukrs = gt_t012k-bukrs
AND hkont IN lr_hkont
AND budat <= p_budat.
Get G/L line items(Cleared items)
SELECT bukrs hkont belnr
buzei gjahr budat
blart dmbtr shkzg
FROM bsas
INTO TABLE gt_bsas
FOR ALL ENTRIES IN gt_t012k
WHERE bukrs = gt_t012k-bukrs
AND hkont IN lr_hkont
AND budat <= p_budat.
APPEND LINES OF gt_bsis TO gt_bsis_bsas.
APPEND LINES OF gt_bsas TO gt_bsis_bsas.
IF NOT gt_bsis_bsas[] IS INITIAL.
CALL METHOD me->get_cust_items.
CALL METHOD me->get_vend_items.
CALL METHOD me->sum_gl_accounts.
ENDIF.
ENDMETHOD. "get_gl_balances
METHOD get_cust_items
METHOD get_cust_items.
Get customer line items(Open items)
SELECT bukrs belnr gjahr blart
buzei budat dmbtr shkzg
bschl
FROM bsid
INTO TABLE gt_bsid
FOR ALL ENTRIES IN gt_bsis_bsas
WHERE bukrs = gt_bsis_bsas-bukrs
AND gjahr = gt_bsis_bsas-gjahr
AND belnr = gt_bsis_bsas-belnr.
Get customer line items(Open items)
SELECT bukrs belnr gjahr blart
buzei budat dmbtr shkzg
bschl
FROM bsad
INTO TABLE gt_bsad
FOR ALL ENTRIES IN gt_bsis_bsas
WHERE bukrs = gt_bsis_bsas-bukrs
AND gjahr = gt_bsis_bsas-gjahr
AND belnr = gt_bsis_bsas-belnr.
APPEND LINES OF gt_bsid TO gt_bsid_bsad.
APPEND LINES OF gt_bsad TO gt_bsid_bsad.
ENDMETHOD. "get_cust_items
METHOD get_vend_items
METHOD get_vend_items.
IF s_hbkid[] IS INITIAL OR
s_hbkid-low = 'CITI' OR
s_hbkid-high = 'CITI'.
IF s_hktid[] IS INITIAL OR
s_hktid-low = 'CA01' OR
s_hktid-high = 'CA01'.
DATA: lr_vendor TYPE RANGE OF bsik-lifnr,
wa_vendor LIKE LINE OF lr_vendor,
lv_date TYPE p0001-begda.
DATA: lt_bsik_dum LIKE gt_bsik,
lt_lfa1 TYPE HASHED TABLE OF t_lfa1
WITH UNIQUE KEY lifnr,
lt_lfb1 TYPE HASHED TABLE OF t_lfb1
WITH UNIQUE KEY lifnr bukrs,
lt_t052 TYPE SORTED TABLE OF t_t052
WITH NON-UNIQUE KEY zterm.
CONSTANTS: lc_citi_ca01 TYPE bsis-hkont VALUE '0010004043'.
FIELD-SYMBOLS: <fs_bsik> LIKE LINE OF gt_bsik,
<fs_lfa1> LIKE LINE OF lt_lfa1,
<fs_lfb1> LIKE LINE OF lt_lfb1,
<fs_t052> LIKE LINE OF lt_t052.
wa_vendor-sign = 'I'.
wa_vendor-option = 'CP'.
wa_vendor-low = lc_vendor_3.
APPEND wa_vendor TO lr_vendor.
CLEAR wa_vendor.
Get vendor line items(Open items)
SELECT bukrs belnr gjahr blart
buzei budat dmbtr shkzg
bschl lifnr bldat
FROM bsik
INTO TABLE gt_bsik
WHERE bukrs IN s_bukrs
AND lifnr IN lr_vendor.
DEFINE m_blart.
wa_blart-sign = 'I'.
wa_blart-option = 'EQ'.
wa_blart-low = &1.
append wa_blart to lr_blart.
clear wa_blart.
END-OF-DEFINITION.
m_blart lc_k3.
m_blart lc_k4.
m_blart lc_k5.
m_blart lc_k6.
m_blart lc_k7.
m_blart lc_kb.
m_blart lc_kd.
IF NOT gt_bsik[] IS INITIAL AND NOT lr_blart[] IS INITIAL.
DELETE gt_bsik WHERE shkzg = lc_debit.
DELETE gt_bsik WHERE lifnr NP lc_vendor_3.
DELETE gt_bsik WHERE blart NOT IN lr_blart[].
ENDIF.
IF NOT gt_bsik[] IS INITIAL.
lt_bsik_dum[] = gt_bsik[].
SORT lt_bsik_dum BY lifnr.
DELETE ADJACENT DUPLICATES FROM lt_bsik_dum
COMPARING lifnr.
SELECT lifnr land1
FROM lfa1
INTO TABLE lt_lfa1
FOR ALL ENTRIES IN lt_bsik_dum
WHERE lifnr = lt_bsik_dum-lifnr.
IF NOT lt_lfa1[] IS INITIAL.
DELETE lt_lfa1 WHERE land1 = 'PH'.
CLEAR wa_vendor.
LOOP AT lt_lfa1 ASSIGNING <fs_lfa1>.
wa_vendor-sign = 'I'.
wa_vendor-option = 'EQ'.
wa_vendor-low = <fs_lfa1>-lifnr.
APPEND wa_vendor TO lr_vendor.
CLEAR wa_vendor.
ENDLOOP.
ENDIF.
IF NOT lr_vendor[] IS INITIAL.
DELETE gt_bsik WHERE lifnr NOT IN lr_vendor[].
ENDIF.
IF NOT gt_bsik[] IS INITIAL.
REFRESH lt_bsik_dum.
lt_bsik_dum[] = gt_bsik[].
SORT lt_bsik_dum BY lifnr.
DELETE ADJACENT DUPLICATES FROM lt_bsik_dum
COMPARING lifnr.
IF NOT lt_bsik_dum[] IS INITIAL.
SELECT lifnr bukrs zterm
FROM lfb1
INTO TABLE lt_lfb1
FOR ALL ENTRIES IN lt_bsik_dum
WHERE lifnr = lt_bsik_dum-lifnr
AND bukrs = lt_bsik_dum-bukrs.
IF NOT lt_lfb1[] IS INITIAL.
SELECT zterm ztagg ztag1
FROM t052
INTO TABLE lt_t052
FOR ALL ENTRIES IN lt_lfb1
WHERE zterm = lt_lfb1-zterm.
ENDIF.
ENDIF.
ENDIF.
LOOP AT gt_bsik ASSIGNING <fs_bsik>.
CLEAR: lv_date.
IF <fs_bsik>-shkzg = lc_credit. "H
MULTIPLY <fs_bsik>-dmbtr BY '-1'.
ENDIF.
READ TABLE lt_lfb1 ASSIGNING <fs_lfb1>
WITH TABLE KEY lifnr = <fs_bsik>-lifnr
bukrs = <fs_bsik>-bukrs.
IF sy-subrc = 0.
READ TABLE lt_t052 ASSIGNING <fs_t052>
WITH TABLE KEY zterm = <fs_lfb1>-zterm.
IF sy-subrc = 0.
lv_date = <fs_bsik>-bldat + <fs_t052>-ztag1.
ENDIF.
IF lv_date <= p_budat.
MOVE-CORRESPONDING <fs_bsik> TO wa_importation_docs_due.
wa_importation_docs_due-hkont = lc_citi_ca01.
COLLECT wa_importation_docs_due INTO gt_importation_docs_due.
CLEAR wa_importation_docs_due.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD. "get_vend_items
METHOD sum_gl_accounts
METHOD sum_gl_accounts.
FIELD-SYMBOLS: <fs_bsis_bsas> LIKE LINE OF gt_bsis_bsas,
<fs_bsis> LIKE LINE OF gt_bsis,
<fs_bsid_bsad> LIKE LINE OF gt_bsid_bsad,
<fs_outs_rel_checks> LIKE LINE OF gt_outs_rel_checks,
<fs_outs_unrel_checks> LIKE LINE OF gt_outs_unrel_checks.
SORT gt_bsis_bsas BY bukrs hkont belnr.
LOOP AT gt_bsis_bsas ASSIGNING <fs_bsis_bsas>.
IF <fs_bsis_bsas>-shkzg = lc_credit. "H
MULTIPLY <fs_bsis_bsas>-dmbtr BY -1.
ENDIF.
*/Routine for cash in bank
IF <fs_bsis_bsas>-hkont CP lc_gl_zero.
MOVE-CORRESPONDING <fs_bsis_bsas> TO wa_cash_in_bank.
COLLECT wa_cash_in_bank INTO gt_cash_in_bank.
CLEAR wa_cash_in_bank.
ENDIF.
ENDLOOP.
Open G/L line items
IF NOT gt_bsis[] IS INITIAL.
IF NOT gt_bsis[] IS INITIAL.
lv_budat = p_budat.
CALL FUNCTION 'DATE_TO_DAY'
EXPORTING
date = lv_budat
IMPORTING
weekday = lv_day.
LOOP AT gt_bsis ASSIGNING <fs_bsis>.
*/Routine for outstanding trade collection
IF <fs_bsis>-shkzg = lc_debit.
IF <fs_bsis>-blart <> lc_nt.
IF <fs_bsis>-blart <> lc_nc.
READ TABLE gt_bsid_bsad ASSIGNING <fs_bsid_bsad>
WITH TABLE KEY bukrs = <fs_bsis>-bukrs
belnr = <fs_bsis>-belnr
gjahr = <fs_bsis>-gjahr
blart = <fs_bsis>-blart.
IF sy-subrc = 0.
IF lv_day = lc_monday.
CALL METHOD me->monday_routines
EXPORTING
im_date = p_budat
im_bukrs = <fs_bsis>-bukrs
im_hkont = <fs_bsis>-hkont
im_budat = <fs_bsis>-budat
im_dmbtr = <fs_bsis>-dmbtr.
ELSEIF lv_day = lc_sunday.
CALL METHOD me->sunday_routines
EXPORTING
im_date = p_budat
im_bukrs = <fs_bsis>-bukrs
im_hkont = <fs_bsis>-hkont
im_budat = <fs_bsis>-budat
im_dmbtr = <fs_bsis>-dmbtr.
ELSEIF lv_day = lc_tuesday.
CALL METHOD me->tuesday_routines
EXPORTING
im_date = p_budat
im_bukrs = <fs_bsis>-bukrs
im_hkont = <fs_bsis>-hkont
im_budat = <fs_bsis>-budat
im_dmbtr = <fs_bsis>-dmbtr.
ELSE.
CALL METHOD me->other_days_routines
EXPORTING
im_date = p_budat
im_bukrs = <fs_bsis>-bukrs
im_hkont = <fs_bsis>-hkont
im_budat = <fs_bsis>-budat
im_dmbtr = <fs_bsis>-dmbtr.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*/Routine for miscellaneous collection
IF <fs_bsis>-blart = lc_nt OR
<fs_bsis>-blart = lc_nc.
IF <fs_bsis>-shkzg = lc_debit.
IF <fs_bsis>-hkont CP lc_gl_one.
READ TABLE gt_bsid_bsad ASSIGNING <fs_bsid_bsad>
WITH TABLE KEY bukrs = <fs_bsis>-bukrs
belnr = <fs_bsis>-belnr
gjahr = <fs_bsis>-gjahr
blart = <fs_bsis>-blart.
IF sy-subrc = 0.
MOVE-CORRESPONDING <fs_bsis> TO wa_misc_collection.
COLLECT wa_misc_collection INTO gt_misc_collection.
CLEAR wa_misc_collection.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*/Routine for outstanding released checks
IF <fs_bsis>-hkont CP lc_gl_three AND <fs_bsis>-shkzg = lc_debit.
MOVE-CORRESPONDING <fs_bsis> TO wa_outs_rel_checks.
COLLECT wa_outs_rel_checks INTO gt_outs_rel_checks.
CLEAR wa_outs_rel_checks.
*/Routine for outstanding unreleased checks
ELSEIF <fs_bsis>-hkont CP lc_gl_three AND <fs_bsis>-shkzg = lc_credit.
MOVE-CORRESPONDING <fs_bsis> TO wa_outs_unrel_checks.
COLLECT wa_outs_unrel_checks INTO gt_outs_unrel_checks.
CLEAR wa_outs_unrel_checks.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
*/Routine for outstanding released check/s
*/this routine will get all records from custom table zcheck_monitor
*/where status is released to vendor
CALL METHOD me->outs_check_released.
IF NOT gt_outs_rel_checks[] IS INITIAL.
Subtract debit line items from ZFE002 - Outstanding released checks
LOOP AT gt_outs_rel_checks ASSIGNING <fs_outs_rel_checks>.
CLEAR wa_zcheck_monitor_collect.
READ TABLE gt_zcheck_monitor_collect INTO wa_zcheck_monitor_collect
WITH TABLE KEY zzbukr = <fs_outs_rel_checks>-bukrs
zubhkt = <fs_outs_rel_checks>-hkont.
IF sy-subrc = 0.
<fs_outs_rel_checks>-dmbtr = ABS( wa_zcheck_monitor_collect-zrwbtr ) -
<fs_outs_rel_checks>-dmbtr.
ELSE.
<fs_outs_rel_checks>-dmbtr = 0 - <fs_outs_rel_checks>-dmbtr.
ENDIF.
ENDLOOP.
ENDIF.
IF NOT gt_outs_unrel_checks[] IS INITIAL.
Subtract ZFE002 records from credit line items - Outstanding unreleased checks
LOOP AT gt_outs_unrel_checks ASSIGNING <fs_outs_unrel_checks>.
CLEAR wa_zcheck_monitor_collect.
READ TABLE gt_zcheck_monitor_collect INTO wa_zcheck_monitor_collect
WITH TABLE KEY zzbukr = <fs_outs_unrel_checks>-bukrs
zubhkt = <fs_outs_unrel_checks>-hkont.
IF sy-subrc = 0.
<fs_outs_unrel_checks>-dmbtr = ABS( <fs_outs_unrel_checks>-dmbtr ) -
ABS( wa_zcheck_monitor_collect-zrwbtr ).
ENDIF.
ENDLOOP.
ENDIF.
Move records to output table
CALL METHOD me->process_data.
ENDMETHOD. "sum_gl_accounts
METHOD monday_routines
METHOD monday_routines.
wa_outs_trade_coll-bukrs = im_bukrs.
wa_outs_trade_coll-hkont = im_hkont.
CLEAR lv_date.
CALL METHOD me->difference_in_days
EXPORTING
im_date = im_date
im_budat = im_budat
IMPORTING
ex_diff = lv_date.
One day
IF lv_date = 3.
wa_outs_trade_coll-one_day = im_dmbtr.
Two days
ELSEIF lv_date = 4.
wa_outs_trade_coll-two_days = im_dmbtr.
More than two days
ELSEIF lv_date > 4.
wa_outs_trade_coll-more_than_two_days = im_dmbtr.
ENDIF.
COLLECT wa_outs_trade_coll INTO gt_outs_trade_coll.
CLEAR wa_outs_trade_coll.
ENDMETHOD. "monday_routines
METHOD sunday_routines
METHOD sunday_routines.
wa_outs_trade_coll-bukrs = im_bukrs.
wa_outs_trade_coll-hkont = im_hkont.
CLEAR lv_date.
CALL METHOD me->difference_in_days
EXPORTING
im_date = im_date
im_budat = im_budat
IMPORTING
ex_diff = lv_date.
One day
IF lv_date = 2.
wa_outs_trade_coll-one_day = im_dmbtr.
Two days
ELSEIF lv_date = 3.
wa_outs_trade_coll-two_days = im_dmbtr.
More than two days
ELSEIF lv_date > 3.
wa_outs_trade_coll-more_than_two_days = im_dmbtr.
ENDIF.
COLLECT wa_outs_trade_coll INTO gt_outs_trade_coll.
CLEAR wa_outs_trade_coll.
ENDMETHOD. "sunday_routines
METHOD tuesday_routines
METHOD tuesday_routines.
wa_outs_trade_coll-bukrs = im_bukrs.
wa_outs_trade_coll-hkont = im_hkont.
CLEAR lv_date.
CALL METHOD me->difference_in_days
EXPORTING
im_date = im_date
im_budat = im_budat
IMPORTING
ex_diff = lv_date.
One day
IF lv_date = 1.
wa_outs_trade_coll-one_day = im_dmbtr.
Two days
ELSEIF lv_date = 4.
wa_outs_trade_coll-two_days = im_dmbtr.
More than two days
ELSEIF lv_date > 4.
wa_outs_trade_coll-more_than_two_days = im_dmbtr.
ENDIF.
COLLECT wa_outs_trade_coll INTO gt_outs_trade_coll.
CLEAR wa_outs_trade_coll.
ENDMETHOD. "tuesday_routines
METHOD other_days_routines
METHOD other_days_routines.
wa_outs_trade_coll-bukrs = im_bukrs.
wa_outs_trade_coll-hkont = im_hkont.
CLEAR lv_date.
CALL METHOD me->difference_in_days
EXPORTING
im_date = im_date
im_budat = im_budat
IMPORTING
ex_diff = lv_date.
One day
IF lv_date = 1.
wa_outs_trade_coll-one_day = im_dmbtr.
Two days
ELSEIF lv_date = 2.
wa_outs_trade_coll-two_days = im_dmbtr.
More than two days
ELSEIF lv_date > 3.
wa_outs_trade_coll-more_than_two_days = im_dmbtr.
ENDIF.
COLLECT wa_outs_trade_coll INTO gt_outs_trade_coll.
CLEAR wa_outs_trade_coll.
ENDMETHOD. "other_days_routines
METHOD difference_in_days
METHOD difference_in_days.
CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
EXPORTING
i_date_from = im_budat
I_KEY_DAY_FROM =
i_date_to = im_date
I_KEY_DAY_TO =
I_FLG_SEPARATE = ' '
IMPORTING
e_days = ex_diff.
E_MONTHS =
E_YEARS =
ENDMETHOD. "difference_in_days
METHOD outs_check_released
METHOD outs_check_released.
FIELD-SYMBOLS: <fs_zcheck_monitor> LIKE LINE OF gt_zcheck_monitor.
SELECT zzbukr zhbkid zhktid "#EC CI_NOFIELD
zubhkt zrwbtr zrlsvd
zrlsdt
FROM zcheck_monitor
INTO TABLE gt_zcheck_monitor
WHERE zrlsvd <> space.
IF NOT gt_zcheck_monitor[] IS INITIAL.
LOOP AT gt_zcheck_monitor ASSIGNING <fs_zcheck_monitor>.
MOVE-CORRESPONDING <fs_zcheck_monitor> TO wa_zcheck_monitor_collect.
COLLECT wa_zcheck_monitor_collect INTO gt_zcheck_monitor_collect.
CLEAR wa_zcheck_monitor_collect.
ENDLOOP.
ENDIF.
ENDMETHOD. "outs_check_released
METHOD process_data
METHOD process_data.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
text = text-p02.
FIELD-SYMBOLS: <fs_t012k> LIKE LINE OF gt_t012k,
<fs_cash_in_bank> LIKE LINE OF gt_cash_in_bank,
<fs_outs_trade_coll> LIKE LINE OF gt_outs_trade_coll,
<fs_misc_collection> LIKE LINE OF gt_misc_collection,
<fs_outs_rel_checks> LIKE LINE OF gt_outs_rel_checks,
<fs_outs_unrel_checks> LIKE LINE OF gt_outs_unrel_checks.
SORT gt_t012k BY bukrs hbkid.
LOOP AT gt_t012k ASSIGNING <fs_t012k>.
wa_output-bukrs = <fs_t012k>-bukrs.
wa_output-hbkid = <fs_t012k>-hbkid.
wa_output-hktid = <fs_t012k>-hktid.
Move cash in bank
READ TABLE gt_cash_in_bank ASSIGNING <fs_cash_in_bank>
WITH TABLE KEY bukrs = <fs_t012k>-bukrs
hkont = <fs_t012k>-hkont.
IF sy-subrc = 0.
wa_output-cash_in_bank = <fs_cash_in_bank>-dmbtr.
ADD wa_output-cash_in_bank TO wa_output-tot_cash_bal.
ENDIF.
CLEAR lv_hkont.
lv_hkont = <fs_t012k>-hkont.
ADD 1 TO lv_hkont.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_hkont
IMPORTING
output = lv_hkont.
Move outstanding trade collection(Deposit in transit)
READ TABLE gt_outs_trade_coll ASSIGNING <fs_outs_trade_coll>
WITH TABLE KEY bukrs = <fs_t012k>-bukrs
hkont = lv_hkont.
IF sy-subrc = 0.
wa_output-one_day = <fs_outs_trade_coll>-one_day.
ADD wa_output-one_day TO wa_output-tot_cash_bal.
wa_output-two_days = <fs_outs_trade_coll>-two_days.
ADD wa_output-two_days TO wa_output-tot_cash_bal.
wa_output-more_than_two_days = <fs_outs_trade_coll>-more_than_two_days.
ADD wa_output-more_than_two_days TO wa_output-tot_cash_bal.
ENDIF.
Move miscellaneous collection
READ TABLE gt_misc_collection ASSIGNING <fs_misc_collection>
WITH TABLE KEY bukrs = <fs_t012k>-bukrs
hkont = lv_hkont.
IF sy-subrc = 0.
wa_output-misc_collection = <fs_misc_collection>-dmbtr.
ADD wa_output-misc_collection TO wa_output-tot_cash_bal.
ENDIF.
Move outstanding released checks
CLEAR lv_hkont.
lv_hkont = <fs_t012k>-hkont.
ADD 3 TO lv_hkont.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_hkont
IMPORTING
output = lv_hkont.
READ TABLE gt_outs_rel_checks ASSIGNING <fs_outs_rel_checks>
WITH TABLE KEY bukrs = <fs_t012k>-bukrs
hkont = lv_hkont.
IF sy-subrc = 0.
wa_output-outs_rel_checks = ABS( <fs_outs_rel_checks>-dmbtr ).
SUBTRACT wa_output-outs_rel_checks FROM wa_output-tot_cash_bal.
MULTIPLY wa_output-outs_rel_checks BY '-1'.
ELSE.
CLEAR wa_zcheck_monitor_collect.
READ TABLE gt_zcheck_monitor_collect INTO wa_zcheck_monitor_collect
WITH TABLE KEY zzbukr = <fs_t012k>-bukrs
zubhkt = lv_hkont.
IF sy-subrc = 0.
wa_output-outs_rel_checks = ABS( wa_zcheck_monitor_collect-zrwbtr ).
SUBTRACT wa_output-outs_rel_checks FROM wa_output-tot_cash_bal.
MULTIPLY wa_output-outs_rel_checks BY '-1'.
ENDIF.
ENDIF.
Move outstanding unreleased checks
CLEAR lv_hkont.
lv_hkont = <fs_t012k>-hkont.
ADD 3 TO lv_hkont.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_hkont
IMPORTING
output = lv_hkont.
READ TABLE gt_outs_unrel_checks ASSIGNING <fs_outs_unrel_checks>
WITH TABLE KEY bukrs = <fs_t012k>-bukrs
hkont = lv_hkont.
IF sy-subrc = 0.
wa_output-outs_unrel_checks = <fs_outs_unrel_checks>-dmbtr.
ENDIF.
Move importation docs. due
IF <fs_t012k>-hbkid = 'CITI' AND
<fs_t012k>-hktid = 'CA01'.
CLEAR wa_importation_docs_due.
READ TABLE gt_importation_docs_due INTO wa_importation_docs_due
WITH TABLE KEY bukrs = <fs_t012k>-bukrs
hkont = lv_hkont
TRANSPORTING dmbtr.
IF sy-subrc = 0.
wa_output-imp_docs_due = wa_importation_docs_due-dmbtr.
ENDIF.
ENDIF.
wa_output-est_cash_balance = wa_output-tot_cash_bal + wa_output-outs_unrel_checks +
wa_output-imp_docs_due.
APPEND wa_output TO gt_output.
CLEAR wa_output.
ENDLOOP.
ENDMETHOD. "process_data
ENDCLASS. "lcl_get_data IMPLEMENTATION
----
CLASS lcl_alv_routines IMPLEMENTATION
----
*
----
CLASS lcl_alv_routines IMPLEMENTATION.
METHOD build_fieldcat.
DEFINE m_fieldcat.
add 1 to wa_fieldcat-col_pos.
wa_fieldcat-fieldname = &1.
wa_fieldcat-tabname = &2.
wa_fieldcat-coltext = &3.
wa_fieldcat-outputlen = &4.
wa_fieldcat-key = &5.
wa_fieldcat-just = &6.
wa_fieldcat-do_sum = &7.
wa_fieldcat-emphasize = &8.
wa_fieldcat-edit = &9.
append wa_fieldcat to gt_fieldcat.
clear wa_fieldcat.
END-OF-DEFINITION.
m_fieldcat 'BUKRS' 'GT_OUTPUT' text-a01 '12' 'X' '' '' '' ''.
m_fieldcat 'HBKID' 'GT_OUTPUT' text-a14 '10' 'X' '' '' '' ''.
m_fieldcat 'HKTID' 'GT_OUTPUT' text-a02 '10' 'X' '' '' '' ''.
m_fieldcat 'CASH_IN_BANK' 'GT_OUTPUT' text-a03 '12' '' 'R' 'X' '' ''.
m_fieldcat 'ONE_DAY' 'GT_OUTPUT' text-a04 '05' '' 'R' 'X' '' ''.
m_fieldcat 'TWO_DAYS' 'GT_OUTPUT' text-a05 '06' '' 'R' 'X' '' ''.
m_fieldcat 'MORE_THAN_TWO_DAYS' 'GT_OUTPUT' text-a06 '08' '' 'R' 'X' '' ''.
m_fieldcat 'MISC_COLLECTION' 'GT_OUTPUT' text-a07 '16' '' 'R' 'X' '' ''.
m_fieldcat 'OUTS_REL_CHECKS' 'GT_OUTPUT' text-a08 '21' '' 'R' 'X' '' ''.
m_fieldcat 'TREAS_TRANSACTIONS' 'GT_OUTPUT' text-a09 '19' '' 'R' 'X' '' 'X'.
m_fieldcat 'TOT_CASH_BAL' 'GT_OUTPUT' text-a10 '15' '' 'R' 'X' 'C300' ''.
m_fieldcat 'OUTS_UNREL_CHECKS' 'GT_OUTPUT' text-a11 '19' '' 'R' 'X' '' ''.
m_fieldcat 'IMP_DOCS_DUE' 'GT_OUTPUT' text-a12 '14' '' 'R' 'X' '' ''.
m_fieldcat 'EST_CASH_BALANCE' 'GT_OUTPUT' text-a13 '17' '' 'R' 'X' 'C300' ''.
ENDMETHOD. "build_fieldcat
METHOD sort_alv_display.
DEFINE m_sort.
clear gs_sort.
gs_sort-fieldname = &1.
gs_sort-spos = &2.
gs_sort-up = &3.
gs_sort-down = &4.
gs_sort-subtot = &5.
append gs_sort to gt_sort.
END-OF-DEFINITION.
m_sort 'BUKRS' '1' 'X' '' 'X'.
m_sort 'HBKID' '2' 'X' '' 'X'.
ENDMETHOD. "sort_alv_display
ENDCLASS. "lcl_alv_routines IMPLEMENTATION
----
CLASS lcl_event_receiver IMPLEMENTATION
----
*
----
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_data_changed.
*/Routine if user added a value to treasury transactions column
LOOP AT er_data_changed->mt_mod_cells INTO ls_mod_cells.
CASE ls_mod_cells-fieldname.
WHEN 'TREAS_TRANSACTIONS'.
IF ls_mod_cells-value CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ/'.
CALL METHOD er_data_changed->add_protocol_entry
EXPORTING
i_msgid = '0K'
i_msgno = '000'
i_msgty = 'E'
i_msgv1 = text-e01
i_msgv2 = ls_mod_cells-value
i_msgv3 = text-e02
i_fieldname = ls_mod_cells-fieldname
i_row_id = ls_mod_cells-row_id.
EXIT.
ELSE.
Add cash_in_bank column to tot_cash_bal column
CLEAR: lv_cash_in_bank, lv_tot_cash_bal.
CALL METHOD er_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = 'CASH_IN_BANK'
IMPORTING
e_value = lv_cash_in_bank.
ADD lv_cash_in_bank TO lv_tot_cash_bal.
Add one_day column to tot_cash_bal column
CLEAR lv_one_day.
CALL METHOD er_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = 'ONE_DAY'
IMPORTING
e_value = lv_one_day.
ADD lv_one_day TO lv_tot_cash_bal.
Add two_days column to tot_cash_bal column
CLEAR lv_two_days.
CALL METHOD er_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = 'TWO_DAYS'
IMPORTING
e_value = lv_two_days.
ADD lv_two_days TO lv_tot_cash_bal.
Add more_than_two_days column to tot_cash_bal column
CLEAR lv_more_than_two_days.
CALL METHOD er_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = 'MORE_THAN_TWO_DAYS'
IMPORTING
e_value = lv_more_than_two_days.
ADD lv_more_than_two_days TO lv_tot_cash_bal.
Add misc_collection column to tot_cash_bal column
CLEAR lv_misc_collection.
CALL METHOD er_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = 'MISC_COLLECTION'
IMPORTING
e_value = lv_misc_collection.
ADD lv_misc_collection TO lv_tot_cash_bal.
Add outs_rel_checks column to tot_cash_bal column
CLEAR lv_outs_rel_checks.
CALL METHOD er_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = 'OUTS_REL_CHECKS'
IMPORTING
e_value = lv_outs_rel_checks.
IF lv_outs_rel_checks < 0.
ADD lv_outs_rel_checks TO lv_tot_cash_bal.
ELSE.
SUBTRACT lv_outs_rel_checks FROM lv_tot_cash_bal.
ENDIF.
Add treas_transactions column to tot_cash_bal column
CLEAR: lv_treas_transactions.
CALL METHOD er_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = 'TREAS_TRANSACTIONS'
IMPORTING
e_value = lv_treas_transactions.
ADD lv_treas_transactions TO lv_tot_cash_bal.
Modify tot_cash_bal column
CALL METHOD er_data_changed->modify_cell
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = 'TOT_CASH_BAL'
i_value = lv_tot_cash_bal.
Get value of outs_unrel_checks column
CLEAR lv_outs_unrel_checks.
CALL METHOD er_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = 'OUTS_UNREL_CHECKS'
IMPORTING
e_value = lv_outs_unrel_checks.
Get value of imp_docs_due column
CLEAR lv_imp_docs_due.
CALL METHOD er_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = 'IMP_DOCS_DUE'
IMPORTING
e_value = lv_imp_docs_due.
Computation for est_cash_balance column
CLEAR lv_est_cash_balance.
lv_est_cash_balance = lv_tot_cash_bal -
( lv_outs_unrel_checks + lv_imp_docs_due ).
CALL METHOD er_data_changed->modify_cell
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = 'EST_CASH_BALANCE'
i_value = lv_est_cash_balance.
CLEAR wa_output.
READ TABLE gt_output INTO wa_output INDEX ls_mod_cells-row_id.
IF sy-subrc = 0.
wa_output-tot_cash_bal = lv_tot_cash_bal.
wa_output-est_cash_balance = lv_est_cash_balance.
MODIFY TABLE gt_output FROM wa_output.
ENDIF.
Refresh ALV display to re-compute for changes
CALL METHOD lcl_grid1->refresh_table_display.
Set scrolling to the last modified cell
MOVE 'TREAS_TRANSACTIONS' TO lv_col_info-fieldname.
MOVE ls_mod_cells-row_id TO lv_row_id-row_id.
CALL METHOD lcl_grid1->set_scroll_info_via_id
EXPORTING
IS_ROW_INFO =
is_col_info = lv_col_info
is_row_no = lv_row_id.
ENDIF.
ENDCASE.
ENDLOOP.
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
"lcl_event_receiver IMPLEMENTATION
----
START-OF-SELECTION *
----
START-OF-SELECTION.
DATA: o_lcl_get_data TYPE REF TO lcl_get_data.
CREATE OBJECT o_lcl_get_data.
CALL METHOD o_lcl_get_data->get_bank_details.
----
END-OF-SELECTION *
----
END-OF-SELECTION.
IF NOT gt_output[] IS INITIAL.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
text = text-p03.
CALL SCREEN 100.
ELSE.
MESSAGE i000 WITH text-i01.
ENDIF.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
DATA: o_lcl_alv_routines TYPE REF TO lcl_alv_routines. "#EC *
CREATE OBJECT o_lcl_alv_routines. "#EC
g_repid = sy-repid.
IF lcl_custom_container IS INITIAL.
CREATE OBJECT lcl_custom_container
EXPORTING
container_name = gv_container
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = text-004.
ENDIF.
CREATE OBJECT lcl_grid1
EXPORTING
i_parent = lcl_custom_container.
Build fieldcatalog for initial display
CALL METHOD o_lcl_alv_routines->build_fieldcat.
CALL METHOD o_lcl_alv_routines->sort_alv_display.
gs_disvariant-report = sy-repid.
Display initial window
CALL METHOD lcl_grid1->set_table_for_first_display
EXPORTING
i_structure_name = ''
is_layout = gs_layout
i_save = 'A'
is_variant = gs_disvariant
CHANGING
it_outtab = gt_output
it_fieldcatalog = gt_fieldcat
it_sort = gt_sort.
Set editable cells to ready for input
CALL METHOD lcl_grid1->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
CALL METHOD lcl_grid1->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
CREATE OBJECT lcl_event_receiver.
SET HANDLER lcl_event_receiver->handle_data_changed FOR lcl_grid1.
ENDIF.
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = lcl_grid1.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CASE save_ok.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
CALL METHOD lcl_custom_container->free.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc <> 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = text-005.
ENDIF.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
2008 Jan 22 5:36 AM
Hi,
WHile filling field catalog which fileds u want to edit in the out put only for that fields only u have to fill as follows,
ls_fieldcat-input = 'X'.
ls_fieldcat-edit = 'X'.
if it is use full answer reward me a points.
praveen
2008 Jan 22 6:06 AM
Have a look at below links. It contains sample code for alv grid.
http://www.erpgenie.com/abap/controls/alvgrid.htm#Complete%20code%20for%20the%20ALV%20grid%20example
http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
http://sap.niraj.tripod.com/id64.html
Also have a look at below for OO alv grid:
http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b5533cd30911d2b467006094192fe3/frameset.htm
-->REUSE_ALV_GRID _DISPLAY
Heirarchial
Here is a simple example of such an ALV.
code
report zrich_0001.
type-pools: slis.
data: begin of head occurs 0,
matnr type afpo-matnr,
maktx type makt-maktx,
EXPAND type c,
end of head.
data: begin of detail occurs 0,
aufnr type afpo-aufnr,
matnr type afpo-matnr,
werks type aufk-werks,
pwerk type afpo-pwerk,
psmng type afpo-psmng,
end of detail.
start-of-selection.
select * into corresponding fields of table detail
from afpo
inner join aufk
on afpo~aufnr = aufk~aufnr
inner join afko
on afpo~aufnr = afko~aufnr
up to 500 rows
where aufk~auart = 'PP01'.
if not detail[] is initial.
sort detail ascending by matnr.
select distinct * into corresponding fields of table head
from makt
for all entries in detail
where matnr = detail-matnr
and spras = sy-langu.
endif.
perform call_alv.
-
FORM call_alv *
-
........ *
-
form call_alv.
data: gt_fieldcat type slis_t_fieldcat_alv,
gs_keyinfo type slis_keyinfo_alv,
gs_layout type slis_layout_alv.
.
data: ls_fieldcat type slis_fieldcat_alv.
clear gs_keyinfo.
gs_keyinfo-header01 = 'MATNR'.
gs_keyinfo-item01 = 'MATNR'.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-reptext_ddic = 'Material'.
ls_fieldcat-tabname = 'HEAD'.
ls_fieldcat-outputlen = 18.
append ls_fieldcat to gt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'MAKTX'.
ls_fieldcat-reptext_ddic = 'Description'.
ls_fieldcat-tabname = 'HEAD'.
ls_fieldcat-outputlen = 40.
append ls_fieldcat to gt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'AUFNR'.
ls_fieldcat-reptext_ddic = 'Production Order'.
ls_fieldcat-tabname = 'DETAIL'.
ls_fieldcat-outputlen = 12.
append ls_fieldcat to gt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'WERKS'.
ls_fieldcat-reptext_ddic = 'Production Plant'.
ls_fieldcat-tabname = 'DETAIL'.
ls_fieldcat-outputlen = 4.
append ls_fieldcat to gt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'PWERK'.
ls_fieldcat-reptext_ddic = 'Planning Plant'.
ls_fieldcat-tabname = 'DETAIL'.
ls_fieldcat-outputlen = 4.
append ls_fieldcat to gt_fieldcat.
clear ls_fieldcat.
ls_fieldcat-fieldname = 'PSMNG'.
ls_fieldcat-reptext_ddic = 'Quantity'.
ls_fieldcat-tabname = 'DETAIL'.
ls_fieldcat-outputlen = 20.
append ls_fieldcat to gt_fieldcat.
gs_layout-expand_fieldname = 'EXPAND'.
call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
exporting
it_fieldcat = gt_fieldcat[]
is_layout = gs_layout
i_tabname_header = 'HEAD'
i_tabname_item = 'DETAIL'
is_keyinfo = gs_keyinfo
tables
t_outtab_header = head
t_outtab_item = detail.
endform.
[/code]
-->
ABAP List Viewer
The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
This helps us to implement all the features mentioned very effectively.
Using ALV, We can have three types of reports:
1. Simple Report
2. Block Report
3. Hierarchical Sequential Report
There are some function modules which will enable to produce the above reports without much effort.
All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
1. SIMPLE REPORT.
The important function modules are
a. Reuse_alv_list_display
b. Reuse_alv_fieldcatalog_merge
c. Reuse_alv_events_get
d. Reuse_alv_commentary_write
e. Reuse_alv_grid_display
A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
The important parameters are :
I. Export :
i. I_callback_program : report id
ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status
iii. I_callback_user_command : routine where the function codes are handled
iv. I_structure name : name of the dictionary table
v. Is_layout : structure to set the layout of the report
vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
II. Tables :
i. t_outtab : internal table with the data to be output
B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
The Important Parameters are :
I. Export :
i. I_program_name : report id
ii. I_internal_tabname : the internal output table
iii. I_inclname : include or the report name where all the dynamic forms are handled.
II Changing
ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is
declared in the type pool SLIS.
C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
Parameters :
I. Import :
Et_Events : The event table is returned with all possible CALLBACK events
for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
II. Export :
I_List_type :
0 = simple list REUSE_ALV_LIST_DISPLAY
1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
3 = hierarchical-sequential block list
REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
Parameters :
I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
This internal table has three fields :
Typ : H header, S selection , A - action
Key : only when typ is S.
Info : the text to be printed
E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
Parameters : same as reuse_alv_list_display
This is an example for simple list.
2. BLOCK REPORT
This is used to have multiple lists continuously.
The important functions used in this report are:
A. REUSE_ALV_BLOCK_LIST_INIT
B. REUSE_ALV_BLOCK_LIST_APPEND
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_BLOCK_LIST_DISPLAY
A. REUSE_ALV_BLOCK_LIST_INIT
Parameters:
I. I_CALLBACK_PROGRAM
II. I_CALLBACK_PF_STATUS_SET
III. I_CALLBACK_USER_COMMAND
This function module is used to set the default gui status etc.
B. REUSE_ALV_BLOCK_LIST_APPEND
Parameters :
Export :
I. is_layout : layout settings for block
II. it_fieldcat : field catalog
III. i_tabname : internal table name with output data
IV. it_events : internal table with all possible events
Tables :
i. t_outtab : internal table with output data.
This function module adds the data to the block.
Repeat this function for all the different blocks to be displayed one after the other.
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
This function module is used for hierarchical sequential blocks.
D. REUSE_ALV_BLOCK_LIST_DISPLAY
Parameters : All the parameters are optional.
This function module display the list with data appended by the above function.
Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
3. Hierarchical reports :
Hierarchical sequential list output.
The function module is
A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
Parameters:
I. Export:
i. I_CALLBACK_PROGRAM
ii. I_CALLBACK_PF_STATUS_SET
iii. I_CALLBACK_USER_COMMAND
iv. IS_LAYOUT
v. IT_FIELDCAT
vi. IT_EVENTS
vii. i_tabname_header : Name of the internal table in the program containing the
output data of the highest hierarchy level.
viii. i_tabname_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
ix. is_keyinfo : This structure contains the header and item table field
names which link the two tables (shared key).
II. Tables
i. t_outtab_header : Header table with data to be output
ii. t_outtab_item : Name of the internal table in the program containing the
output data of the lowest hierarchy level.
slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using REUSE_ALV_FIELDCATALOG_MERGE.
Important Attributes :
A. col_pos : position of the column
B. fieldname : internal fieldname
C. tabname : internal table name
D. ref_fieldname : fieldname (dictionary)
E. ref_tabname : table (dictionary)
F. key(1) : column with key-color
G. icon(1) : icon
H. symbol(1) : symbol
I. checkbox(1) : checkbox
J. just(1) : (R)ight (L)eft (C)ent.
K. do_sum(1) : sum up
L. no_out(1) : (O)blig.(X)no out
M. outputlen : output length
N. seltext_l : long key word
O. seltext_m : middle key word
P. seltext_s : short key word
Q. reptext_ddic : heading (ddic)
R. ddictxt(1) : (S)hort (M)iddle (L)ong
S. datatype : datatype
T. hotspot(1) : hotspot
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
Go thru these programs they may help u to try on some hands on
ALV Demo program
BCALV_DEMO_HTML
BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
BCALV_GRID_DEMO Simple ALV Control Call Demo Program
BCALV_TREE_DEMO Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO
BC_ALV_DEMO_HTML_D0100
Reward If useful