Editable Hierarchical ALV
There is a requirement from client that
They want to see an hierarchical ALV. This ALV needs to be editable in the line item level for the balnk lines. On click of a button, a pop window will appear in which if if they enter say 5 and the customer code then 5 blank lines should be appended at the customer's line item level where the user can enter values. Is this possible. Will the inserted/ appended lines get refreshed on the ALV. For eg:
represent the blank lines)
Header--> Customer Code Customer Name
011101 XYZ
Item--> Material Quantity Unit Amount
14589 125.00 KG 145.50
12569 45.00 KG 100.00
15899 105.00 KG 120.50
PLZ Help!
Hi,
I've done similar thing. Here is the code for my method for handling double click.
METHOD handle_node_double_click.
CALL METHOD sender->get_outtab_line
EXPORTING
i_node_key = node_key
IMPORTING
e_outtab_line = gs_idoc_s
EXCEPTIONS
node_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Get data
* <code for changing value>
CALL METHOD sender->change_node
EXPORTING
i_node_key = node_key
i_outtab_line = gs_idoc_s
EXCEPTIONS
node_not_found = 1
OTHERS = 2.
READ TABLE gt_idoc_s WITH KEY pos = gs_idoc_s-pos
TRANSPORTING NO FIELDS.
MODIFY gt_idoc_s FROM gs_idoc_s
INDEX sy-tabix TRANSPORTING value_low value_high.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL METHOD tree1->frontend_update.
ENDIF.
ENDMETHOD. "handle_node_double_click
The important methods are get_outtab_line. change_node and frontend_update.
Similar Messages
-
Editable fields in Hierarchical ALV output
Hi Experts,
I have developed a report using hierarchical ALV display. I wanted to make some of the fields(in a particular column) editable in the output of Hierarchical ALV. Please provide your suggestions with examples.
Regards,
RajeshI am not getting what u mean,.
Coz I have done the editable property in my hierarcical ALV only...
I have header line and correspodning item lines.
In all header line I will make the 3rd column as editable...
CHECK below
*& Report ZFIR_WRITE_OFF
REPORT zfir_write_off
NO STANDARD PAGE HEADING
MESSAGE-ID zles.
TYPE-POOLS
TYPE-POOLS:slis.
TABLES
TABLES: kna1, t001, zdunning_data, bsid, t052.
INTERNAL TABLES
To check for bukrs in selection screen
DATA: BEGIN OF t_t001 OCCURS 0,
bukrs TYPE t001-bukrs,
END OF t_t001.
To check for the customer in selection screen
DATA: BEGIN OF t_kna1 OCCURS 0,
kunnr TYPE kna1-kunnr,
name1 TYPE kna1-name1,
END OF t_kna1.
*Data from BSID table
DATA: BEGIN OF t_bsid OCCURS 0,
bukrs LIKE bsid-bukrs,
budat LIKE bsid-budat,
kunnr LIKE bsid-kunnr,
belnr LIKE bsid-belnr,
zfbdt LIKE bsid-zfbdt,
zterm LIKE bsid-zterm,
dmbtr LIKE bsid-dmbtr,
waers LIKE bsid-waers,
vbeln LIKE bsid-vbeln,
END OF t_bsid.
*Data from ZDunning_data
DATA: BEGIN OF t_zdunning OCCURS 0,
belnr LIKE zdunning_data-belnr,
kunnr LIKE zdunning_data-kunnr,
zdef_notice_flg LIKE zdunning_data-zdef_notice_flg,
zterm_notice_flg LIKE zdunning_data-zterm_notice_flg,
END OF t_zdunning.
*Data from t052 for base line days
DATA: BEGIN OF t_t052 OCCURS 0,
zterm LIKE t052-zterm,
ztag1 LIKE t052-ztag1,
END OF t_t052.
*with duedate and date for write off calculation
DATA: BEGIN OF t_data OCCURS 0,
belnr LIKE bsid-belnr,
kunnr LIKE bsid-kunnr,
zterm LIKE bsid-zterm,
zfbdt LIKE bsid-zfbdt,
ztag1 LIKE t052-ztag1,
duedate LIKE bsid-zfbdt,
wdate LIKE bsid-zfbdt,
vbeln LIKE bsid-vbeln,
dmbtr LIKE bsid-dmbtr,
waers LIKE bsid-waers,
budat LIKE bsid-budat,
vbelv like vbfa-vbelv,
Name1 like kna1-name1,
END OF t_data.
*Output display in ALV report
DATA: BEGIN OF t_output OCCURS 0,
Flag type C,
bukrs LIKE bsid-bukrs,
kunnr LIKE bsid-kunnr,
vbeln LIKE bsid-vbeln, "Invoice
posnv like vbfa-posnv,
wdate LIKE bsid-zfbdt,
belnr LIKE bsid-belnr,
dmbtr LIKE bsid-dmbtr,
waers LIKE bsid-waers,
budat LIKE bsid-budat,
vbelv like vbfa-vbelv, "Contract
name1 like kna1-name1,
duedate like bsid-zfbdt,
END OF t_output.
To get contract number for the billing document number
DATA: BEGIN OF t_vbfa OCCURS 0,
vbelv LIKE vbfa-vbelv,
vbeln LIKE vbfa-vbeln,
POSNV like vbfa-POSNV,
END OF t_vbfa.
data: begin of t_cust occurs 0,
KUNNR like kna1-kunnr,
name1 like kna1-name1,
end of t_cust.
data: begin of t_head occurs 0,
VBELv like vbfa-vbelv,
posnv like vbfa-posnv,
VKUEGRU type ZLIST_WO_RCANCEL,
end of t_head.
data: begin of it_veda occurs 0,
VBELn LIKE Veda-VBELN,
POSNR LIKE Veda-VPOSN,
VKUEGRU LIKE Veda-VKUEGRU,
end of it_veda.
VARIABLE DECLARATION
DATA: l_duedate LIKE bsid-zfbdt,
l_wdate LIKE bsid-zfbdt.
VARIABLE FOR ALV DISPLAY
DATA: t_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA: t_fieldcat1 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
wa_fieldcat1 TYPE slis_fieldcat_alv.
DATA: t_layout TYPE slis_layout_alv.
DATA: g_repid LIKE sy-repid.
SELECTION-SCREEN
*Selection Screen Parameters for user input
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS:
*Company Code
p_bukrs LIKE t001-bukrs OBLIGATORY.
SELECT-OPTIONS:
*Customer Number
s_kunnr FOR kna1-kunnr OBLIGATORY DEFAULT '0' TO 'ZZZZZZZZZZ'.
PARAMETERS:
*Write Off Date
p_wodate TYPE sy-datum OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1 .
AT SELECTION-SCREEN
*Selection Screen validation for Company code
AT SELECTION-SCREEN ON p_bukrs.
SELECT SINGLE bukrs FROM t001 "#EC *
INTO t_t001
WHERE bukrs = p_bukrs.
IF sy-subrc NE 0.
*Error message for Invalid Company Code
MESSAGE e000 WITH text-002.
ENDIF.
*Selection Screen Validation for Customer
AT SELECTION-SCREEN ON s_kunnr.
IF NOT s_kunnr IS INITIAL.
SELECT SINGLE kunnr name1
FROM kna1 "#EC *
INTO t_kna1
WHERE kunnr IN s_kunnr.
IF sy-subrc NE 0.
*Error message for Invalid Customer Number
MESSAGE e000 WITH text-003.
ENDIF.
ENDIF.
AT SELECTION-SCREEN ON p_wodate.
IF p_wodate IS INITIAL.
p_wodate = sy-datum.
ENDIF.
INITIALIZATION
INITIALIZATION.
PERFORM clear_data.
START-OF-SELECTION
START-OF-SELECTION.
*Get the Accounting Document Number and base line date from BSID
SELECT bukrs kunnr belnr budat zfbdt zterm dmbtr waers vbeln
FROM bsid
INTO corresponding fields of TABLE t_bsid
WHERE kunnr IN s_kunnr AND
bukrs = p_bukrs.
IF NOT t_bsid[] IS INITIAL.
*Get the Dunning data based on the Accounting Document Number from BSID
SELECT belnr kunnr zdef_notice_flg zterm_notice_flg
FROM zdunning_data
INTO TABLE t_zdunning
FOR ALL ENTRIES IN t_bsid
WHERE kunnr = t_bsid-kunnr AND
belnr = t_bsid-belnr AND
zdef_notice_flg = 'Y' AND
zterm_notice_flg = 'Y'.
*Get the base line days from t052 table based on BSID data
SELECT zterm ztag1
FROM t052
INTO TABLE t_t052
FOR ALL ENTRIES IN t_bsid
WHERE zterm = t_bsid-zterm.
*Calculate the due date(bse line date BSID-ZFBDT + base line days
*T052-ZTAG )
IF NOT t_zdunning[] IS INITIAL.
Get the customer name
Select KUNNR NAME1 from KNA1
INTO table t_cust
for all entries in t_zdunning
where kunnr = t_zdunning-kunnr.
LOOP AT t_zdunning.
LOOP AT t_bsid.
CLEAR t_zdunning.
READ TABLE t_zdunning WITH KEY belnr = t_bsid-belnr
kunnr = t_bsid-kunnr.
CHECK sy-subrc = 0.
CLEAR t_t052.
READ TABLE t_t052 WITH KEY zterm = t_bsid-zterm.
IF sy-subrc = 0 .
t_data-belnr = t_zdunning-belnr.
t_data-kunnr = t_zdunning-kunnr.
Clear t_cust.
read table t_cust with key kunnr = t_zdunning-kunnr.
if sy-subrc = 0.
t_data-name1 = t_cust-name1.
endif.
t_data-zterm = t_bsid-zterm.
t_data-zfbdt = t_bsid-zfbdt.
t_data-ztag1 = t_t052-ztag1.
t_data-vbeln = t_bsid-vbeln.
t_data-dmbtr = t_bsid-dmbtr.
t_data-waers = t_bsid-waers.
t_data-budat = t_bsid-budat.
*calculate duedate
CLEAR l_duedate.
l_duedate = t_bsid-zfbdt + t_t052-ztag1.
t_data-duedate = l_duedate.
*calculate date for write off
CLEAR l_wdate.
l_wdate = l_duedate + 180.
t_data-wdate = l_wdate.
APPEND t_data.
CLEAR l_wdate.
CLEAR l_duedate.
ENDIF.
ENDLOOP.
ELSE.
MESSAGE s000 WITH text-005.
ENDIF.
*Check the wdate with write off date in the selection screen value.
*If this calculated date is Greater than value enetred in selection
*screen, display the corresponding data in ALV report.
IF NOT t_data[] IS INITIAL.
SELECT vbelv vbeln
POSNV
FROM vbfa
INTO TABLE t_vbfa
FOR ALL ENTRIES IN t_data
WHERE vbeln = t_data-vbeln.
and
VBTYP_V = 'G'.
*If reason for cancelation is there, no writeoff.
Select VBELn VPOSN VKUEGRU from Veda
into table it_veda
for all entries in t_vbfa
where vbeln = t_vbfa-vbelv.
SELECT vbelv
POSNV
FROM vbfa
INTO TABLE t_Head
FOR ALL ENTRIES IN t_data
WHERE vbeln = t_data-vbeln
and
VBTYP_V = 'G'.
loop at t_head.
clear it_veda.
Read table it_veda with key vbeln = t_head-vbelv
posnr = t_head-posnv.
if not it_veda-VKUEGRU is initial.
Delete t_head where vbelv = it_veda-vbeln and
posnv = it_veda-posnr.
endif.
endloop.
LOOP AT t_data.
IF t_data-wdate LE p_wodate.
t_output-bukrs = p_bukrs.
t_output-kunnr = t_data-kunnr.
CLEAR t_vbfa.
READ TABLE t_vbfa WITH KEY vbeln = t_data-vbeln.
read table t_head with key vbelv = t_vbfa-vbelv
posnv = t_vbfa-posnv.
if sy-subrc = 0.
t_output-vbelv = t_vbfa-vbelv.
t_output-posnv = t_vbfa-posnv.
t_output-name1 = t_data-name1.
t_output-wdate = t_data-wdate.
t_output-belnr = t_data-belnr.
t_output-dmbtr = t_data-dmbtr.
t_output-waers = t_data-waers.
t_output-budat = t_data-budat.
t_output-vbeln = t_data-vbeln.
t_output-duedate = t_data-duedate .
APPEND t_output.
ENDIF.
clear t_output.
ENDIF.
ENDLOOP.
ELSE.
MESSAGE s000 WITH text-006.
ENDIF.
*ALV display for the output records
IF NOT t_output[] IS INITIAL.
PERFORM alv_display.
ELSE.
MESSAGE s000 WITH text-006.
ENDIF.
ELSE.
MESSAGE s000 WITH text-004.
ENDIF.
*& Form clear_data
text
--> p1 text
<-- p2 text
FORM clear_data .
CLEAR:t_t001,
t_kna1,
t_bsid,
t_zdunning,
t_t052,
t_data,
t_output,
wa_fieldcat,
t_layout,
t_fieldcat,
t_vbfa.
REFRESH:t_t001,
t_kna1,
t_bsid,
t_zdunning,
t_t052,
t_data,
t_output,
t_fieldcat,
t_vbfa.
clear:t_head,
it_veda.
Refresh:t_head,
it_veda.
Clear T_cust.
Refresh t_data.
ENDFORM. " clear_data
*& Form alv_display
text
--> p1 text
<-- p2 text
FORM alv_display .
*To build the field catalogue
PERFORM build_fieldcatalog1.
PERFORM build_fieldcatalog.
*To build the ALV layout
PERFORM build_layout.
*To displayt the data in ALV report
PERFORM display_alv_report.
ENDFORM. " alv_display
*& Form build_fieldcatalog
text
--> p1 text
<-- p2 text
FORM build_fieldcatalog1 .
REFRESH t_fieldcat1.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '1'.
wa_fieldcat-fieldname = 'VBELV'.
wa_fieldcat-tabname = 'T_HEAD'.
wa_fieldcat-seltext_l = 'Contract Number'.
wa_fieldcat-Checkbox = 'X'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-no_out = 'X'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '2'.
wa_fieldcat-fieldname = 'POSNV'.
wa_fieldcat-tabname = 'T_HEAD'.
wa_fieldcat-seltext_l = 'Item Number'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '3'.
wa_fieldcat-fieldname = 'VKUEGRU'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-input = 'X'.
wa_fieldcat-tabname = 'T_HEAD'.
wa_fieldcat-drdn_hndl = '1'.
wa_fieldcat-seltext_l = 'Reason for Cancel'.
wa_fieldcat-outputlen = '25'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
endform.
FORM build_fieldcatalog .
REFRESH t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '4'.
wa_fieldcat-fieldname = 'KUNNR'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-seltext_l = 'Customer Number'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '5'.
wa_fieldcat-fieldname = 'NAME1'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-seltext_l = 'Customer Name'.
wa_fieldcat-outputlen = '30'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '6'.
wa_fieldcat-fieldname = 'VBELV'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-seltext_l = 'Contract Number'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '7'.
wa_fieldcat-fieldname = 'VBELN'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-seltext_l = 'Invoice No.'.
wa_fieldcat-outputlen = '10'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '8'.
wa_fieldcat-fieldname = 'BELNR'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-seltext_l = 'Acc doc Number'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '9'.
wa_fieldcat-fieldname = 'WAERS'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-seltext_l = 'Currency'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '10'.
wa_fieldcat-fieldname = 'DMBTR'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-do_sum = 'X'. "SUM UPON DISPLAY
wa_fieldcat-datatype = 'CURR'.
wa_fieldcat-seltext_l = 'Amount'.
wa_fieldcat-outputlen = '15'.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = '11'.
wa_fieldcat-fieldname = 'DUEDATE'.
wa_fieldcat-tabname = 'T_OUTPUT'.
wa_fieldcat-seltext_l = 'Due Date'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO t_fieldcat.
data: lt_dropdown type lvc_t_drop,
ls_dropdown type lvc_s_drop.
First listbox (handle '1').
ls_dropdown-handle = '1'.
ls_dropdown-value = 'KG'.
append ls_dropdown to lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = 'G'.
append ls_dropdown to lt_dropdown.
call method g_grid->set_drop_down_table
exporting it_drop_down = lt_dropdown.
ENDFORM. " build_fieldcatalog
*& Form build_layout
text
--> p1 text
<-- p2 text
FORM build_layout .
t_layout-no_input = 'X'.
t_layout-colwidth_optimize = 'X'.
ENDFORM. " build_layout
*& Form display_alv_report
text
--> p1 text
<-- p2 text
FORM display_alv_report .
g_repid = sy-repid.
data g_keyinfo type SLIS_KEYINFO_ALV.
g_keyinfo-HEADER01 = 'VBELV'.
g_keyinfo-ITEM01 = 'VBELV'.
g_keyinfo-HEADER02 = 'POSNV'.
g_keyinfo-ITEM02 = 'POSNV'.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_interface_check = 'I'
i_callback_program = g_repid
i_callback_pf_status_set = 'SET_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = t_fieldcat[]
i_default = ' '
i_save = 'A'
i_tabname_header = 'T_HEAD'
i_tabname_item = 'T_OUTPUT'
i_structure_name_header = v_headers_table
i_structure_name_item = v_items_table
is_keyinfo = g_keyinfo
i_bypassing_buffer = 'X'
TABLES
t_outtab_header = t_head[]
t_outtab_item = i_result
t_outtab_item = t_output[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
REFRESH: t_fieldcat[].
refresh t_fieldcat1[].
ENDFORM. " display_alv_report
form SET_STATUS using extab TYPE slis_t_extab.
SET PF-STATUS 'ZEO_S1' .
endform.
*& Form Top_Of_Page
Top_Of_Page event in ALV
FORM top_of_page .
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader.
Title
wa_header-typ = 'H'.
wa_header-info = ' Write Off Worklist'.
APPEND wa_header TO t_header.
CLEAR wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
ENDFORM. "Top_Of_Page
*User Command for the button
form user_command using r_ucomm type syucomm
ls_selfield type SLIS_SELFIELD.
Break-point.
case r_ucomm.
when 'EXEC'.
data: begin of lt_cancel occurs 0.
include structure ZCANCEL.
data end of lt_cancel.
Clear lt_cancel.
Refresh lt_cancel.
Data: ref1 type ref to cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = ref1.
call method ref1->check_changed_data.
loop at t_Head where VKUEGRU is not initial.
if ( t_HEAD-VKUEGRU NE '1' ) or
( t_Head-VKUEGRU NE '2' ) or
( t_head-VKUEGRU NE '3' ).
Clear t_head-vkuegru.
message e000 with text-110.
endif.
lt_cancel-vbeln = t_head-vbelv.
lt_cancel-posnr = t_head-posnv.
lt_cancel-VKUEGRU = t_head-VKUEGRU.
Append lt_cancel.
Clear lt_cancel.
Endloop.
CALL FUNCTION 'ZSD_CNTR_CANCEL'
TABLES
zcancel = lt_cancel.
message s000 .
endcase.
endform. -
Date Field in Hierarchical ALV
Hello Friends,
I have a few fields in my Hierarchical ALV output which are initially hidden.
When I choose to display these fields by changing the Layout the date fields come out in the form
MMDDYYYY
I need those fields as
MM/DD/YYYY
The date fields which are NOT hidden initially are in the format MM/DD/YYYY. No problem there.
When I go to settings and choose column width optimize I am then able to see these date fields as MM/DD/YYYY.
In My code I already set this col width to optimize. It is also working . But for fields which are hidden initially I have to explicitly set the width optimize again .
This problem is not there in GRID ALV.
Why is the HIER ALV not putting the date fields in MM/DD/YYYY format.Hi,
Just pass the Edit option of the fieldcatalog for those specific fields...
fcat-edit = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'USER_COMMAND' "<---- pass this
i_callback_top_of_page = 'TOP'
is_layout = it_layout
it_fieldcat = it_fcat
i_default = 'X'
i_save = 'A'
it_events = it_event
TABLES
t_outtab = it_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form USER_COMMAND
* text
* -->R_UCOMM text
* -->RS_SELFIELD text
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&DATA_SAVE'. "<-------check this
PERFORM save_data.
ENDCASE.
ENDFORM. "USER_COMMAND -
How to find item wise totals and header wise total using hierarchical ALV
Hi Friends,
I came across an issue of finding item wise total using hierarchical ALV. I am getting header wise total by setting the field catalog. May you help me in finding Item wise total.
Regards
Nikhil.hi,
you must use "w_fieldcat-do_sum = 'X'" and change your layout like :
w_sort-fieldname = 'FIELD'.
w_sort-tabname = 'TABNEME'.
w_sort-up = 'X'.
w_sort-subtot = 'X'.
APPEND w_sort TO i_sort.
CLEAR w_sort.
you can use detailed code from http://wiki.sdn.sap.com/wiki/display/Snippets/Subtotalsinhirarchial+report.
regards,
orhan
Edited by: goktasor on Jun 1, 2010 11:03 AM (need points : ) ) -
Hierarchical ALV - enabling row/column input
Hello,
I'm going to incoporate the hierarchical ALV in a report. Let's say I have 5 item rows for a header row, is it possible to make individiual rows input enabled? Meaning, of the 5 item rows, I wish to make two of them editable, but not the other three.
I've done the standard ALV and made columns input enabled when building the fieldcat, but this applied to all rows, which I don't want in my scenario.
Any help would be appreciated.
ThanksHello,
Input enable is a parameter of fieldcat but you have to specify the internal table that you used in header row or item row.
You create a data ZHEAD and ZITEM that you transfer in fieldcat data "table"
Don't forget the clear when youo fill this internal table
Regards
sebastien -
Hierarchical ALV GRID in levels
Hi,
I need to display output as like below in the ALV grid,
Output should be as like below,
+ BO_Descriptor_id1 BO Name
+UUID1 TESTCODE TESTCOUNT
TestCode Test(Pass/Fail)
TestCode Test(Pass/Fail)
TestCode Test(Pass/Fail)
TestCode Test(Pass/Fail)
+UUID2 TESTCODE TESTCOUNT
TestCode Test(Pass/Fail)
TestCode Test(Pass/Fail)
TestCode Test(Pass/Fail)
TestCode Test(Pass/Fail)
+ BO_Descriptor_id2 BO Name
+UUID3 TESTCODE TESTCOUNT
TestCode Test(Pass/Fail)
TestCode Test(Pass/Fail)
TestCode Test(Pass/Fail)
TestCode Test(Pass/Fail)
Now, I am able tio display the data in the Hierarchical ALV grid.
+UUID3 TESTCODE TESTCOUNT
TestCode Test(Pass/Fail)
TestCode Test(Pass/Fail)
TestCode Test(Pass/Fail)
TestCode Test(Pass/Fail)
Any suggestion plz...
Thanks in advanceHai
Go For ALV tree like below:
*Fm for constructing the tree
CALL FUNCTION 'RS_TREE_CONSTRUCT'
TABLES
nodetab = it_node.
IF sy-subrc <> 0.
ENDIF.
CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
EXPORTING
callback_program = sy-repid
check_duplicate_name = '1'
color_of_node = '4'
color_of_mark = '3'
color_of_link = '1'
color_of_match = '5'
node_length = 30
text_length = 75
use_control = 'L'.ENDFORM. "build_tree
Edited by: shelly Malik on Aug 21, 2009 11:06 AM -
Urgent:Grand total in hierarchical alv
I am printing a hierarchical alv with subtotals. I want to print the grand total for the whole numeric columns ...
Can anyone explain me how i can do this.
Thanks and regards,
SubhakarHi,
In this case you not only require the totals but the subtotals also.
For achieving this output you will have to sort the alv on the first column and also give subtotals there.
use
data: SORTF TYPE SLIS_SORTINFO_ALV,
TSORT TYPE SLIS_T_SORTINFO_ALV.
in the function module reuse_alv_grid_display give
it_sort = tsort.
eg:
FORM ALV_SHOW.
LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
LAYOUT-BOX_TABNAME = 'IT_DISPLAY'.
LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.
LAYOUT-ZEBRA = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = LAYOUT
IT_FIELDCAT = TCATALOG
IS_VARIANT = VAR1
I_SAVE = 'A'
IT_SORT = TSORT
IT_EVENTS = TEVENT[]
TABLES
T_OUTTAB = IT_DISPLAY.
ENDFORM . "ALV_SHOW
and write a subroutine for sort...
form sort.
CLEAR SORTF.
SORTF-spos = 1.
SORTF-fieldname = 'column_1'.
SORTF-tabname = 'IT_table used for display in alv'.
SORTF-up = 'X'.
SORTF-subtot = 'X'.
APPEND SORTF TO TSORT.
endform.
If this doesn't help I will send you the whole source of a sample program..
Abdullah -
How to save data in ztable after editing in alv report
how to save data in ztable after editing in alv report?
Hi,
Please find the attachment below.This may be usefull to you.
[http://wiki.sdn.sap.com/wiki/display/Snippets/ALV-Editingandsavingtheeditedvaluesin+Database%28OOPS%29]
Regards,
Ramakrishna Yella. -
Changing totals value in hierarchical alv for a particular level/row
Hi,
I am displaying a hierarchical ALV having 4 levels.
Using field catalog, totals for all dynamic columns are found out.
I have a requirement not to display totals value for first and second levels.
And if possible, to display another value.
Tried using CL_GUI_ALV_TREE->change_node.
But it not updating.
Please suggest a solution.
Thanks,
Nisha Vengal.Hi Ten Mariga,
I wonder why the second select Query is needed at all instead you can use
---> Not Needed
FORM DATA_RETRIEVAL1.
SELECT * FROM zcontact INTO TABLE it_zcontact WHERE id EQ wa_zcontact-id.
ENDFORM.
----> Instead you can do
READ TABLE it_zcontact INTO wa_zcontact INDEX p_seltab-tabindex.
Append wa_zcontact to Second_table.
And you can use the Second_table to display the second ALV. The second Select Query will affect the performance too.
Cheers,
Krishnakumar B. -
Switching between Hierarchical ALV and List/Grid ALV
Hello!
I was checking out the List of GR/IR Balances report (tcode MB5S), which uses Hierarchical ALV. I noticed that there's a button in the output toolbar that enables you to switch from Hierarchical ALV to Grid ALV. Is there a specific setting in the ALV that you need to define in order to use this feature?
Thanks in advance.Hi,
there is no need of any specific settings.
those properties will came when u use the related function module.all the code for this will exist in the function module u r using for creating the hierarchial display.
regards,
bharat. -
Make rows as non editable in ALV
Hi Experts,
I have a standard ALV table where records are fetched from backend table. Here I have a field Approved as check box.
My requirement is I need to make all the rows as non editable, if the Approved checkbox is checked. How can I achieve this.
I went through the below discussion, but still am not clear of how to achieve it.
How to set some rows in ALV to be editable or some non editable.
I know to set a field as non editable in WD, but don't know how to set some specific rows as non editable in alv.
Please help me.
With Regards,
Ramakrishnan MHi,
Create an Attribute in the Context say READ_ONLY of type wdy_boolean and bind the read only of cell editor to that attribute using set_read_only_fieldname( ) method. Then set the value of attribute READ_ONLY to abap_true/abap_false based on check box value.
check this wiki for reference: How to edit conditionally row of a ALV table in Web Dynpro for ABAP - Web Dynpro ABAP - SCN Wiki
Hope this helps u,
Regards,
Kiran -
Get the header in centre,make bold, change font in hierarchical alv list
Hi all
I need to get the following header in the centre for hierarchical alv list:
ex:
General Ledger -
want it to be bold
July 2009 -
want to change font to be less than 1st line
Please help me to achieve this.
I have got the header in the middle using write statements in top of page.
But am not able to get it bold and change the font.
Thanking in advance.Hi all
I need to get the following header in the centre for hierarchical alv list:
ex:
General Ledger ( want it to be bold)
July 2009 (want to change font to be less than 1st line )
Please help me to achieve this.
I have got the header in the middle using write statements in top of page.
But am not able to get it bold and change the font.
Thanking in advance. -
How to create space between Header text of Hierarchical ALV List.
hi,
I am display data using Hierarchical ALV List.
In Perform of field catalog, I am writing this code:
PERFORM fill_catalogue USING :
'CHKBX' 'T_HEADER' 20 'Sess Decision Box'(t19) 'X',
'SESS_NO' 'T_HEADER' 11 'Session'(t20) ' ' ,
'SESS_STAT' 'T_HEADER' 4 'Status'(t39) ' ',
'HOLD_STAT' 'T_HEADER' 4 'HOLD'(t52) ' ',
'ICON' 'T_HEADER' 9 'Tracking'(t21) ' ' ,
'CREATE_DT' 'T_HEADER' 10 'Archiving Date'(t22) ' ' ,
'AGING' 'T_HEADER' 50 'Aging'(t23) ' ',
'OBJECT' 'T_HEADER' 12 'Archive Obj'(t24) ' ',
'HOLD_INFO' 'T_HEADER' 100 'Hold Reason' ' ' ,
'YFY_DATA' 'T_HEADER' 4 'Data Fiscal Year'(t48) ' ' ,
'COMMENTS' 'T_HEADER' 50 'Session Notes'(t26) ' ' ,
'DATATYPE' 'T_HEADER' 50 'Archive Object Description'(t25) ' ',
'APPR_STAT' 'T_ITEM' 16 'Approval Status'(t29) ' ',
'DESTR_DT_REV' 'T_ITEM' 10 'New Date'(t30) ' ',
'REJCT_REASON' 'T_ITEM' 60 'Rejection Reason'(t31) ' ' .
At output of this program , there are two rows in HEADER details.
I want text 'Session notes' of 2nd row under 'Archiving Date' of 1st row.
For this i have to create space between 'Data Fiscal Year' & 'Session notes' text.
How i can do this.
Regards,
MamtaHi,
You can use TOP-OF-PAGE event and pass this event to Hierarchical ALV FM.
Thanks,
Kartavya Kaushik. -
How to make a particular row and column field editable in ALV
Hi Experts,
I have a requirement to make a particular row and column field editable in ALV output. Like i need to make 2nd row - 4th column editable of ALV output.
Kindly help me out to solve this.
Any help would be appreciated.
Thanks,
AshutoshHi Ashutosh,
please check below, explained by some experts.
In the below link editing two columns MOD_RANK and TECH_RANK.
These two columns will be in edit mode once after selecting the required record
Editing single cell in a row of ALV table
And also look for more info
http://scn.sap.com/thread/884976 -
Need information regarding Hierarchical ALV display
How to total sub items in an Heirarchical ALV List display?
Hi,
I have one Hierarchical alv example .. please see it. Also check B*ALV in se38.
*& Report ZLAXMI_ALVEXER4 *
REPORT ZLAXMI_ALVEXER4 MESSAGE-ID ZZ .
*& TABLES DECLARATION *
TABLES: VBAK, VBAP.
*& TYPE POOLS DECLARATION *
TYPE-POOLS: SLIS.
DATA DECLARATIONS *
DATA: V_FLAG TYPE C. "Flag to display the header
DATA: V_REPID TYPE SY-REPID.
*& INTERNAL TABLE DECLARATION *
DATA: BEGIN OF IT_VBAK OCCURS 0,
VBELN LIKE VBAK-VBELN,
AUDAT LIKE VBAK-AUDAT,
AUART LIKE VBAK-AUART,
NETWR LIKE VBAK-NETWR,
EXPAND(1),
END OF IT_VBAK.
DATA: BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
MATNR LIKE VBAP-MATNR,
PSTYV LIKE VBAP-PSTYV,
CHARG LIKE VBAP-CHARG,
END OF IT_VBAP.
DATA: IT_FLDCAT TYPE SLIS_T_FIELDCAT_ALV,
IT_FLDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
*events
IT_EVENTS TYPE SLIS_T_EVENT WITH HEADER LINE,
V_CALL TYPE C,
X_USER TYPE SLIS_EXIT_BY_USER,
IT_VARIANT LIKE DISVARIANT OCCURS 0 WITH HEADER LINE,
X_KEYINFO TYPE SLIS_KEYINFO_ALV,
*layout
X_LAYOUT TYPE SLIS_LAYOUT_ALV,
*sort
IT_SORT TYPE SLIS_T_SORTINFO_ALV,
WA_SORT LIKE LINE OF IT_SORT,
X_CAT TYPE SLIS_FIELDCAT_ALV,
V_TABIX LIKE SY-TABIX.
Selection screen Declaration
*--BLOCK1
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN,
S_AUART FOR VBAK-AUART.
SELECTION-SCREEN END OF BLOCK B1.
AT SELECTION-SCREEN *
*- Validations
AT SELECTION-SCREEN.
PERFORM VALIDATE_SCREEN.
START OF SELECTION *
START-OF-SELECTION.
*- To get data from VBAK
PERFORM GET_DATA.
*to get data from VBAP
PERFORM GET_DATA_VBAP.
PERFORM PREPARE_ALV.
END OF SELECTION *
END-OF-SELECTION.
PERFORM DISPLAY_REPORT.
*& Form VALIDATE_SCREEN
text
--> p1 text
<-- p2 text
FORM VALIDATE_SCREEN .
DATA: LV_VBELN LIKE VBAK-VBELN,
LV_AUART LIKE VBAK-AUART.
IF NOT S_VBELN[] IS INITIAL.
SELECT VBELN
INTO LV_VBELN
FROM VBAK
WHERE VBELN IN S_VBELN.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'INVALID SALES DOC'(002).
ENDIF.
ENDIF.
IF NOT S_AUART[] IS INITIAL.
SELECT AUART
INTO LV_AUART
FROM VBAK
WHERE AUART IN S_AUART.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'INVALID SALES DOC TYPE'(003).
ENDIF.
ENDIF.
ENDFORM. " VALIDATE_SCREEN
*& Form GET_DATA
text
--> p1 text
<-- p2 text
FORM GET_DATA .
SELECT VBELN
AUDAT
AUART
NETWR
FROM VBAK
INTO TABLE IT_VBAK
WHERE VBELN IN S_VBELN
AND AUART IN S_AUART.
IF SY-SUBRC = 0.
SORT IT_VBAK BY VBELN.
ENDIF.
ENDFORM. " GET_DATA
*& Form GET_DATA_VBAP
text
--> p1 text
<-- p2 text
FORM GET_DATA_VBAP .
SELECT VBELN
POSNR
MATNR
PSTYV
CHARG
INTO TABLE IT_VBAP
FROM VBAP
FOR ALL ENTRIES IN IT_VBAK
WHERE VBELN = IT_VBAK-VBELN.
IF SY-SUBRC = 0.
SORT IT_VBAP BY VBELN POSNR.
ENDIF.
ENDFORM. " GET_DATA_VBAP
*& Form prepare_alv
text
--> p1 text
<-- p2 text
FORM PREPARE_ALV .
Prepare field catalog .
PERFORM PREPARE_CATALOG.
Modify catalog
PERFORM CHANGE_ATTR_OF_CATALOG.
Modify Layout
PERFORM MODIFY_LAYOUT.
Sort Catalog
PERFORM SORT_CATALOG.
ENDFORM. " prepare_alv
*& Form prepare_catalog
text
--> p1 text
<-- p2 text
FORM PREPARE_CATALOG .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_VBAK'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = IT_FLDCAT1[]
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.
APPEND LINES OF IT_FLDCAT1 TO IT_FLDCAT.
CLEAR: IT_FLDCAT1[].
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_VBAP'
I_INCLNAME = SY-REPID
CHANGING
CT_FIELDCAT = IT_FLDCAT1[]
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.
APPEND LINES OF IT_FLDCAT1 TO IT_FLDCAT.
ENDFORM. " prepare_catalog
*& Form change_attr_of_catalog
text
--> p1 text
<-- p2 text
FORM CHANGE_ATTR_OF_CATALOG .
LOOP AT IT_FLDCAT INTO X_CAT.
V_TABIX = SY-TABIX.
CASE X_CAT-FIELDNAME.
WHEN 'EXPAND'.
IF X_CAT-TABNAME = 'IT_VBAK'.
X_CAT-NO_OUT = 'X'.
ENDIF.
when 'VBELN'.
if x_cat-tabname = 'IT_VBAK'.
x_cat-no_out = 'X'.
endif.
WHEN 'VBELN'.
IF X_CAT-TABNAME = 'IT_VBAK'.
X_CAT-COL_POS = '1'.
X_CAT-SELTEXT_M = 'SALES DOC'.
X_CAT-SELTEXT_L = 'SALES DOC'.
X_CAT-SELTEXT_S = 'SALES DOC'.
X_CAT-OUTPUTLEN = '10'.
ENDIF.
WHEN 'AUDAT'.
IF X_CAT-TABNAME = 'IT_VBAK'.
X_CAT-COL_POS = '2'.
X_CAT-SELTEXT_M = 'DOC DATE'.
X_CAT-SELTEXT_L = 'DOC DATE'.
X_CAT-SELTEXT_S = 'DOC DATE'.
X_CAT-OUTPUTLEN = '8'.
ENDIF.
WHEN 'AUART'.
IF X_CAT-TABNAME = 'IT_VBAK'.
X_CAT-COL_POS = '3'.
X_CAT-SELTEXT_M = 'ORDER REASON'.
X_CAT-SELTEXT_L = 'ORDER REASON'.
X_CAT-SELTEXT_S = 'ORDER REASON'.
X_CAT-OUTPUTLEN = '5'.
ENDIF.
WHEN 'NETWR'.
IF X_CAT-TABNAME = 'IT_VBAK'.
X_CAT-COL_POS = '4'.
X_CAT-SELTEXT_M = 'NET PRICE'.
X_CAT-SELTEXT_L = 'NET PRICE'.
X_CAT-SELTEXT_S = 'NET PRICE'.
X_CAT-OUTPUTLEN = '15'.
ENDIF.
ENDCASE.
MODIFY IT_FLDCAT FROM X_CAT.
CLEAR X_CAT.
ENDLOOP.
ENDFORM. " change_attr_of_catalog
*& Form modify_layout
text
--> p1 text
<-- p2 text
FORM MODIFY_LAYOUT .
X_LAYOUT-DEFAULT_ITEM = 'X'.
X_LAYOUT-ZEBRA = 'X'.
X_LAYOUT-EXPAND_FIELDNAME = 'EXPAND'.
ENDFORM. " modify_layout
*& Form sort_catalog
text
--> p1 text
<-- p2 text
FORM SORT_CATALOG .
CLEAR WA_SORT.
WA_SORT-SPOS = '01'.
WA_SORT-FIELDNAME = 'VBELN' .
WA_SORT-TABNAME = 'IT_VBAP'.
WA_SORT-UP = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
WA_SORT-SPOS = '02'.
WA_SORT-FIELDNAME = 'POSNR' .
WA_SORT-TABNAME = 'IT_VBAP'.
WA_SORT-UP = 'X'.
APPEND WA_SORT TO IT_SORT.
ENDFORM. " sort_catalog
*& Form DISPLAY_REPORT
text
--> p1 text
<-- p2 text
FORM DISPLAY_REPORT .
IT_VARIANT-REPORT = SY-REPID.
SORT IT_VBAK BY VBELN.
SORT IT_VBAP BY VBELN POSNR.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = X_LAYOUT
IT_FIELDCAT = IT_FLDCAT[]
IT_SORT = IT_SORT
IS_VARIANT = IT_VARIANT
IT_EVENTS = IT_EVENTS[]
I_TABNAME_HEADER = 'IT_VBAK'
I_TABNAME_ITEM = 'IT_VBAP'
IS_KEYINFO = X_KEYINFO
IMPORTING
E_EXIT_CAUSED_BY_CALLER = V_CALL
ES_EXIT_CAUSED_BY_USER = X_USER
TABLES
T_OUTTAB_HEADER = IT_VBAK
T_OUTTAB_ITEM = IT_VBAP
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DISPLAY_REPORT
Regards,
Laxmi.
Maybe you are looking for
-
Migrate ODI 10.1.3.5 to the last version
Hi, I would like to migrate my ODI 10G (10.1.3.5) to the last version of ODI 11g (11.1.1.7 I think). Do you know if it is possible and if an guide exist? Thanks
-
Print Messages in webdynpro abap
Hi Experts, I have this requirement to print all the message which are displayed in the message area (top of the page). The user requires to get all messages in a file so that he wants to do the action offline. Please let me know if there is any way
-
Shocking speed and trouble loading up web pages wi...
last Wednesday my GigE has stopped working so i have to use normal ethernet, since then my internetspeeds have been really slow and i have had problems logging into pages with a https. Sites like my email, forums, bank account etc. I have spoken to
-
Adobe premiere pro cc doesnt open
Hello! I ve got one problem. My file does not open. I noticed in Preview Files that at one time started to create Copy of files. None of these copies doesnt open. Original file can be opened, but i lost 5 hours of work. If anybody know what could be
-
HT5129 How can I stop the message
I keep getting a message telling me Mobile me has gone and I already haave i cloud on my i pad.