ALV Tree Problem with Checkboxes
Hello,
i've got a problem.
I have an ALV-Tree and die ALV-Detaillist of the tree are type checkbox.
That's working correct.
But i want to fill initial data in the checkboxes but the checkbox isnt set.
i've done as followed:
CALL METHOD go_alv_tree->set_table_for_first_display
EXPORTING
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
i_default = abap_false
is_hierarchy_header = ls_header
IS_EXCEPTION_FIELD =
IT_SPECIAL_GROUPS =
IT_LIST_COMMENTARY =
I_LOGO =
I_BACKGROUND_ID =
IT_TOOLBAR_EXCLUDING =
CHANGING
it_outtab = <go_data_tab>
IT_FILTER =
it_fieldcatalog = lt_fcat.
fieldcat are several fields all as checkbox.
Then i get a component of the output structure and set a X.
ASSIGN COMPONENT lv_help_arbpl OF STRUCTURE <go_data_struc>
TO <fs_arbl>.
IF <fs_arbl> IS ASSIGNED.
<fs_arbl> = lc_xfeld.
ENDIF.
CALL METHOD go_alv_tree->add_node
EXPORTING
i_relat_node_key = lv_matnr
i_relationship = cl_gui_column_tree=>relat_last_child
is_outtab_line = <go_data_struc>
is_node_layout = ls_layout
IT_ITEM_LAYOUT =
i_node_text = lv_node_text
IMPORTING
e_new_node_key = lv_period
EXCEPTIONS
relat_node_not_found = 1
node_not_found = 2
OTHERS = 3.
in <go_data_struc> the fields which should be set, are set with X.
But after i add all of my nodes and do CALL METHOD p_go_alv_tree->frontend_update, the checkbox is empty but there is an X in the field beside the checkbox.
Thanks in advance.
best regards,
Dennis
Ok i solved the problem.
best regards,
Dennis
Similar Messages
-
Problem with checkbox group in row popin of table.
In table row popin I have kept Check Box Group.I have mapped the texts property of checkbox group to the attribute which is under the subnode of the table.the subnode properties singleton=false,selectioncardinality=0-n,and cardinality=0-n.
if there are 'n' number of records in the table.each record will have its own row popin and in the row popin there is check box group.
the check box group in the row popin belongs to that perticular row.
but the checkboxegroup values in row popins of all the rows are getting changed to the row which is lead selected.
The same scenario (table in the row popin is showing the values corresponding to its perticular row and all the table values in popin are not getting changed to the one lead selected in the main table)is working fine with the table in place of checkbox group in row popin with datasource property of table binded to the subnode
I cant trace out the problem with checkbox group in place of table.
Please help me in this regard.I have to place check box group in place of table in row popin.
Thanks and Regards
Kiran Kumar KI have done the same thing successfully with normal check box ui element. Try using check box in your tabel cell editor instead of check box group.
-
Problem with checkbox column in matrix
Hello.
I have a little problem with checkbox column in matrix.
Column is binded to the UserData.
It has ValOn="Y", ValOff="N".
I use C++. It is wird problem. In matrix I have 10 columns - scrollbar role and if You want see checkbox column, You must role to the right. If this column is on the screen, and I use:
checkcell->PutChecked(VARIANT_TRUE);
then the checkbox is cheched, and if the checkbox isn`t on the screen and I use this comment - it nothing happening.
I tried to use ValOn="Y", PutChecked...
The problem i solved if the column is on the screen - if the column is first in matrix or second, but if it`s last I have a big problem.
My column with checkbox is not editable, but I tried to make it editable, check it, and then make it uneditable - the same efect.
How can I solve it ?
Sorry for my english.
Kamil WydraHello Kamil,
I am not sure about your problem, but here is an example of how to use checkbox in UI API.
First, create the matrix with checkbox column in Screen painter, and the output is an xml file, like this. Type as 121 indicates that it is a check box.
- <column AffectsFormMode="0" backcolor="-1" description="" disp_desc="0" editable="0" right_just="0" title="Rented" type="121" uid="Rented" val_off="N" val_on="Y" visible="1" width="41">
<databind alias="U_RENTED" databound="1" table="@VIDS" />
<ExtendedObject />
Second, bind the column to table from DB. This is a bug of 2004 Screen Painter, so if you are using 2005 Screen Painter, there is no problem.
Third, when you open the form, you can check and uncheck the cell.
BTW, please set the editable of the column to true.
Hope this helps,
Nick -
Problem with checkbox on table component
Hello i am having a problem with checkbox in table component
i am developing something like a shopping cart app and i have a checkbox in my table component , i want users to select items from the checkbox to add to thier cart, They can select the items from cartegory combobox , my problem is when they select the items from the checkbox if they select another category the alread selected once do not display in my collection opbject please how can i maintain the state of the already selected items in my collection objectHi,
Please go through the tutorial "Understanding scope and managed beans". This is available at:
http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/scopes.html
The details of the selected items need to be stored in an object that is in session scope.
Hope this helps
Cheers
Girish -
ALV - Problem with checkbox.
Dear All,
I have created an ALV Grid Control and have one column as a check box.
when i tick one checkbox in a line item i pop up a message saying "Do you wish to continue".
If the user selects NO then i automatically want to deselect the checkbox.
I tried clearing the work area of the internal table in the data change event.
But when the alv is refreshed the checkbox is still ticked.What should be done to avoid this.
Is freeing the custom container and creating it again everytime the user selects NO a good option?
Kindly suggest.
Regards,
VarunIn ALV you put check box like
X_FIELDCAT-FIELDNAME = 'CHK'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
X_FIELDCAT-INPUT = 'X'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-CHECKBOX = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
in between you put logic
IF CHK = 'X'
*---popup_to_continue_yes_no
PERFORM POPUP_TO_CONT_YES_NO.
endif.
FORM POPUP_TO_CONT_YES_NO .
CALL FUNCTION 'POPUP_CONTINUE_YES_NO'
EXPORTING
TEXTLINE1 = 'Click OK to leave program'
TITEL = 'POPUP_CONTINUE_YES_NO'
IMPORTING
ANSWER = ANS.
IF ANS = 'J'.
LEAVE PROGRAM.
ENDIF.
ENDFORM. " POPUP_TO_CONT_YES_NO -
Creating TREE REPORT with CHECKBOX against each row
Hi Friends,
I need to create a <b>TREE REPORT with CHECK BOX</b> against each row. when the user selects a row and clicks on a custom button then those should get populated into an internal table. <b>This is HIGH priority</b> one and I have tried my best but couldnt find any solution. Please advise me some sol.
thanks in advance for your valuable time and help.
Regards
srithan
Message edited by me for easyness
ReddyHi
Following code is to add checkboxes in ALV tree:
FORM add_root_request USING pls_data_ TYPE csg_gs_outtab_p_key__l_is_sub_node_ TYPE c
CHANGING pl_carrid_key._node = nodes->add_node( related_node = p_key
relationship = cl_gui_column_tree=>relat_last_child ).
... §0.2 if information should be displayed at
the hierarchy column set the carrid as text for this node
text = p_ls_data-object.
node->set_text( text ).
... §0.3 set the data for the nes node
node->set_data_row( p_ls_data ).
item = node->get_hierarchy_item( ).
item = node->get_item( 'FCHECKBOX' ). "FCHECKBOX is my radio button field in internal table which I am using to populate the ALV
item->set_type( if_salv_c_item_type=>checkbox ).
pl_carrid_key = node->get_key( )._
CATCH cx_salv_msg.
ENDFORM_._Following code is for handling checbox_change event
PERFORM application_action_events.
FORM application_action_events .
data: lr_events type ref to cl_salv_events_tree.
*data gr_events type ref to lcl_handle_events.
lr_events = gr_tree->get_event( ).
create object gr_events.
set handler gr_events->check for lr_events.
set handler gr_events->on_link_click for lr_events.
set handler gr_events->on_before_user_command for lr_events.
set handler gr_events->on_after_user_command for lr_events.
set handler gr_events->on_keypress for lr_events.
endform. " application_action_events----
CLASS lcl_handle_events DEFINITION.
PUBLIC SECTION.
METHODS:
check FOR EVENT checkbox_change OF cl_salv_events_tree IMPORTING node_key columnname checked. "Here node_key is the row number
ENDCLASS. "lcl_handle_events DEFINITION
CLASS lcl_handle_events IMPLEMENTATION
§4.2 implement the events for handling the events of cl_salv_table
CLASS lcl_handle_events IMPLEMENTATION_._
METHOD check_._
WRITE 'hello'_._
DATA lwa_modify_check_ TYPE REF TO csg_gs_outtab.
node_key = node_key - 1_._
READ TABLE csg_gt_list INDEX node_key REFERENCE INTO lwa_modify_check._
if columnname = 'FCHECKBOX'_._
IF checked = 'X'_._
If the value in internal table is set to X, then it is deselct
lwa_modify_check->fcheckbox =_ ' '_._
ELSE_._
lwa_modify_check->fcheckbox =_ 'X'_._
ENDIF_._
ENDIF_._
if columnname = 'CHECKBOX_READ'_._
IF checked = 'X'_._
If the value in internal table is set to X, then it is deselct
lwa_modify_check->checkbox_read =_ ' '_._
ELSE_._
lwa_modify_check->checkbox_read =_ 'X'_._
ENDIF_._
ENDIF_._
*MODIFY TABLE csg_gt_list from l_wa_modify_check.
flag_test = flag_test + 1_._
ENDMETHOD_._ "check
ENDCLASS_._ "lcl_handle_events IMPLEMENTATION
Please give me reward points -
Problem with checkbox value and app.settings.getSetting()
Hello everyone.
I`ve got a problem with getting saved settings for checkbox.
Saved settings doesn`t apply on checkbox value.
It`s strange, but it always "true".
So here piece of code:
checkMe = 11; //any value for the first time running
if (app.settings.haveSetting("savea", "chck")) {
checkMe = app.settings.getSetting("savea", "chck"); // get saved value, else 11
alert("checkMe = "+checkMe)
if(checkMe == 11){
checkMe= false; //if there is no saved settings, checkbox value will be false/ unchecked
alert("You run this script first time, so manual value will be 'false'")
}else{
checkMe = app.settings.getSetting("savea", "chck"); // if saved settings exist, get true or false
alert("Yes, checkMe will = "+checkMe)
win.checkPanel.chkOne.value = checkMe; /// checkbox value will equal saved checkMe
var fff = win.checkPanel.chkOne.value; // string for alert
alert("aha! but checkbox value is = " +fff+ "\n Why so?") // here we`ve got always "true"
win.checkPanel.chkOne.onClick = function () {
var path11 = win.checkPanel.chkOne.value; // checkbox value to variable
app.settings.saveSetting("savea", "chck", path11); //saving checkbox value
alert("Saved this value - " + app.settings.getSetting("savea", "chck"))
win.checkPanel.chkOne.value is always true.
Can someone exmplain why and how to get rid of this static value?
P.S. just in case, here is full code:
function mainFun()
this.windowRef = null;
mainFun.prototype.run = function()
/*----- UI -----*/
var retval = true;
var win = new Window("palette", "Check option", [150, 150, 460, 455]);
this.windowRef = win;
win.checkPanel = win.add("panel", [25, 150, 285, 265], "Checkbox");
win.checkPanel.chkOne = win.checkPanel.add("checkbox", [10, 15, 125, 35], "Checkbox One");
//win.checkPanel.chkTxtOne = win.checkPanel.add('edittext', [140, 15, 230, 35], '');
win.quitBtn = win.add("button", [110,275,200,295], "Close");
checkMe = 11; //any value for the first time running
if (app.settings.haveSetting("savea", "chck")) {
checkMe = app.settings.getSetting("savea", "chck"); // get saved value, else 11
alert("checkMe = "+checkMe)
if(checkMe == 11){
checkMe= false; //if there is no saved settings, checkbox value will be false/ unchecked
alert("You run this script first time, so manual value will be 'false'")
}else{
checkMe = app.settings.getSetting("savea", "chck"); // if saved settings exist, get true or false
alert("Yes, checkMe will = "+checkMe)
win.checkPanel.chkOne.value = checkMe; /// checkbox value will equal saved checkMe
var fff = win.checkPanel.chkOne.value; // string for alert
alert("aha! but checkbox value is = " +fff+ "\n Why so?") // here we`ve got always "true"
win.checkPanel.chkOne.onClick = function () {
var path11 = win.checkPanel.chkOne.value; // checkbox value to variable
app.settings.saveSetting("savea", "chck", path11); //saving checkbox value
alert("Saved this value - " + app.settings.getSetting("savea", "chck"))
win.quitBtn.onClick = function() {
win.close();
win.center();
win.show();
return retval;
if(typeof(mainFun_unitTest) == "undefined") {
new mainFun().run();Played around with different values, combinations...
Doesn`t work too:
checkMe = 111; //any value for the first time running
if (app.settings.haveSetting("333", "check")) {
checkMe = app.settings.getSetting("333", "check");
alert(checkMe);
if(checkMe == 111){
win.checkPanel.chkOne.value= false;
}else{
if (checkMe != false){
win.checkPanel.chkOne.value= true;
}else{
win.checkPanel.chkOne.value= false;
win.checkPanel.chkOne.onClick = function () {
var path11 = win.checkPanel.chkOne.value;
var path12 = path11.toString();
app.settings.saveSetting("333", "check", path12);
alert("Saved value - " + app.settings.getSetting("333", "check")) -
Problem with checkbox in the selection screen
Hi guys,
I have a problem with the check box in the selection screen.When i select a check box then a field in the selection screen should be enabled for entering a value.Again if i unselect the checkbox then the field should be disabled for entering a value.I have written the code in at selection-screen output.
The problem is when i select the check box ,the field is not enabled.But when i press enter after selecting the checkbox then the field is enabled for input.It is the same when i unselect the checkbox,after i press enter only the field is getting disabled.What could be the problem.Any suggestions please?
Thanks.Hi d p
Please try this code . I think this code have some way that you would like.
REPORT zdownload_to_application_server.
TABLES : caufvd, jest.
I N C L U D E P R O G R A M *
*INCLUDE znrpstnd.
Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
PARAMETERS: p_outb RADIOBUTTON GROUP g1 USER-COMMAND outb DEFAULT 'X' ,
p_inb RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
PARAMETERS : p_werks LIKE caufvd-werks MODIF ID a. " Plant "OBLIGATORY
SELECT-OPTIONS : s_auart FOR caufvd-auart MODIF ID a, " Order Type
s_aufnr FOR caufvd-aufnr MODIF ID a. " Order number
PARAMETERS: p_path TYPE string DEFAULT 'C:\SchedulerInterface-OutboundTextFile\' MODIF ID a,
p_actual AS CHECKBOX MODIF ID a. " Transfer Actual
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
PARAMETERS : p_werks2 LIKE caufvd-werks MODIF ID b, " Plant "OBLIGATORY
p_path2 TYPE string DEFAULT 'C:\SchedulerInterface-InboundTextFile\' MODIF ID b,
p_path3 TYPE string DEFAULT 'C:\SchedulerInterface-InboundTextFile\' MODIF ID b,
p_sessio TYPE apqi-groupid MODIF ID b. " BDC Session
SELECTION-SCREEN END OF BLOCK b2.
AT SELECTION-SCREEN OUTPUT.
IF p_outb EQ 'X'. " Outbound --> Hide inbound
LOOP AT SCREEN.
"IF screen-name = '%BT02011_BLOCK_1000'.
IF screen-group2 = 'BLK'.
screen-active = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'A'.
screen-active = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'B'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
"IF screen-name = '%BT01004_BLOCK_1000'.
IF screen-group3 = 'BLK'.
screen-active = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'A'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'B'.
screen-active = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path2.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_path = 'C:\SchedulerInterface-InboundTextFile\'
mask = ',Text Files,.txt,All files,.*.'
IMPORTING
filename = p_path2
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path3.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_path = 'C:\SchedulerInterface-InboundTextFile\'
mask = ',Text Files,.txt,All files,.*.'
IMPORTING
filename = p_path3
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
TOP-OF-PAGE.
START-OF-SELECTION.
Regards
Wiboon -
Problem with checkbox selection in Tableview
Hi All
I am using table view with 8 columns - in the last 4 columns i have checkboxes for user input - i have a strange problem - when the table has multiple entries - for the last column i can only select the checkbox on line 1 - and i cannot select the checkbox on the remaining entries below - but for the other colums with checkboxes this is not the case
The selection mode for the table is no line selection - since the table is already displayed with input enabled fields - this is to reduce the no of clicks for user
Can anyone point out what is going wrong - how can i fix this - what i am doing wrong ?
Thanks
SenHi
When i click on the checkbox for the 2nd or 3rd rows of the last column - nothing happens - the checkox is still active but nothing happens -
this is the tableview code
<htmlb:tableView id = "Detail"
design = "ALTERNATING"
headerText = "Header Text"
onNavigate = "onMyNavigate"
emptyTableText = "test"
onRowSelection = "onMyRowSelection"
fillUpEmptyRows = "false"
footerVisible = "true"
visibleRowCount = "5"
table = "<%= DETAILTAB %>"
iterator = "<%= iterator %>" >
and this is the code for the last column
<htmlb:tableViewColumn columnName = "OBSOFLGICON"
width = "3"
type = "user"
horizontalAlignment = "CENTER"
title = "Obs" >
<htmlb:checkbox />
</htmlb:tableViewColumn>
Thanks
Sen -
Problem with checkbox and Event.stop(event)
Hello,
I cannot change the checkbox in a row, if the Event.stop(event) is fired on checkbox. My aim is, that the event OnRowClick is stoped, if I change the checkbox in the row.
<rich:extendedDataTable id="requestTable" value="#{requestListHandler.normalisedRawRequestList}" var="req"
rows="#{requestListHandler.limitRows}" selectionMode="single">
<a4j:support event="onRowClick" action="#{requestListHandler.viewRequest}">
<f:setPropertyActionListener value="#{req}"
target="#{requestHandler.selectedRequest}" />
</a4j:support>
<rich:column>
<h:outputText value="#{req.offerListSize}">
<f:convertNumber type="number" />
</h:outputText>
</rich:column>
<rich:column id="checkBoxColumns">
<h:selectBooleanCheckbox onclick="Event.stop(event);"
value="#{req.firstInterpreterTimeChecked}"/>
</rich:column>
</rich:extendedDataTable>I know I am using richfaces, but I have problem with sun-ri component <h:selectBooleanCheckbox..../>.
Have you any idea?
Manu
Edited by: Argonist on Jun 16, 2009 8:27 AM
Edited by: Argonist on Jun 16, 2009 12:25 PMI had the same problem. I read you post and was so disappointed that no one had answered you. But I have a good news for you :) My team leader managed to solve this awkward problem.Add to h:selectBooleanCheckbox style="z-index: 20;" so that it is "above" the table row that fires its own onclick event.
-
Problem with Checkbox that disables/enables other components.
Hi
As I show in the title, I have problems with a checkbox that enables/disables another components (three exactly).
I have done the follow:
1.- Set property "AutoSubmit" true in the SelectOneChoice
2.- Set "Disabled" property true or false depending if the SelectOneChoice is selected or not
(#...selectBooleanCheckbox.value?false:true})
3.- Set the Partial triggers to the SelectOneChoice in the three components.
CASE 1: The SelectOneChoice is unmarked. The three components appears disabled and when I mark the SelectOneChoice, this components appears enabled. The thing works ;)
CASE 2: The SelectOneChoice is marked. The three components appears enabled and when I unmark the SelectOneChoice, the components continue enabled. They don't disable until I press the submit button.
how can i make that the components appears disabled when i unmark the checkbox?
i try with de ChangeValueListener, but it only works where the SelectOneChoice changes from unmarked to marked.
thanks!I think the problem is, when the value is null the checkbox return with the selected state, b'coz u r
returning the checkbox (as it is). so pl'z try with below code (ADDED).
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus,
int row, int column){
if(value != null){
Boolean booleanValue = (Boolean)value;
setSelected(booleanValue.booleanValue());
else /// ADDED
setSelected(false);/// ADDED
return this;
Nediaph. -
ALV GRID Problem with reading contents
Hi there! I'm quite new with ABAP and I have some problems with the syntax of it. Maybe I should first describe my aim and then I'll show you my code.
1. I read contents from two database tables, called 'zbc_dan_registry' and 'zbc_dan_category'.
'zbc_dan_registry' has 2 columns: name, value.
zbc_dan_category' has 1 column: category.
Now I want to have an ALV Grid, that displays the contents of 'zbc_dan_registry' and one additional column with dropdown fields, where the user can select a category for each row. This is, what my code already does.
Now I want to save the contents of the whole table in a new table 'zbc_dan_registrz' (you see: 'registrz', not 'registry'!) with 3 columns:
name, category, value.
My problem is, how can I read the contents of the ALV Grid, with the user selected category for each row, and save them in an internal table? I've tried to adapt the code of "BCALV_EDIT_04", but I don't get it running.
Some detailled help would be great, you know, I'm really working hard to understand ABAP, but it's really hard for me. Thanks for your support and help!!
Here's my code so far:
*& Report ZBC400_DAN_TESTNO4
REPORT ZBC400_DAN_TESTNO4.
DATA: lt_registrz TYPE TABLE OF zbc_dan_regstrz WITH HEADER LINE,
lt_category TYPE TABLE OF zbc_dan_category WITH HEADER LINE,
ls_category TYPE zbc_dan_category, "Struktur Kategorie
ok_code LIKE sy-ucomm,
container_r TYPE REF TO cl_gui_custom_container,
grid_r TYPE REF TO cl_gui_alv_grid,
gc_custom_control_name TYPE scrfname VALUE 'CONTAINER_REG',
fieldcat_r TYPE lvc_t_fcat,
layout_r TYPE lvc_s_layo,
lt_ddval TYPE lvc_t_drop,
ls_ddval TYPE lvc_s_drop,
c TYPE i.
CLASS lcl_event_receiver DEFINITION DEFERRED.
DATA g_verifier TYPE REF TO lcl_event_receiver.
DATA: BEGIN OF gt_outtab OCCURS 0.
INCLUDE STRUCTURE zbc_dan_regstrz.
DATA: celltab TYPE lvc_t_styl.
DATA: END OF gt_outtab.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
TYPES: BEGIN OF lt_registrz_key. "Struktur mit den Schlüsseln der Tabelle 'Registry'
TYPES: name TYPE zbc_dan_name,
value TYPE zbc_dan_value,
category TYPE zbc_dan_cat.
TYPES: END OF lt_registrz_key.
TYPES: ls_registrz_keys TYPE STANDARD TABLE OF lt_registrz_key,
ls_registrz_table TYPE STANDARD TABLE OF zbc_dan_regstrz.
METHODS: get_inserted_rows EXPORTING inserted_rows TYPE ls_registrz_keys.
METHODS: refresh_delta_tables.
METHODS: handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING er_data_changed.
* METHODS: get_inserted_rows EXPORTING inserted_rows TYPE registrz_keys.
* METHODS: refresh_delta_tables.
PRIVATE SECTION.
DATA: inserted_rows TYPE ls_registrz_keys.
DATA: error_in_data TYPE c.
METHODS: get_cell_values IMPORTING row_id TYPE int4 pr_data_changed TYPE REF TO cl_alv_changed_data_protocol EXPORTING key TYPE lt_registrz_key.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_data_changed.
DATA: ls_good TYPE lvc_s_modi,
ls_new TYPE lvc_s_moce.
error_in_data = space.
IF error_in_data = 'X'.
CALL METHOD er_data_changed->display_protocol.
ENDIF.
ENDMETHOD.
METHOD get_cell_values.
CALL METHOD pr_data_changed->get_cell_value
EXPORTING i_row_id = row_id i_fieldname = 'NAME'
IMPORTING e_value = key-name.
CALL METHOD pr_data_changed->get_cell_value
EXPORTING i_row_id = row_id i_fieldname = 'VALUE'
IMPORTING e_value = key-value.
CALL METHOD pr_data_changed->get_cell_value
EXPORTING i_row_id = row_id i_fieldname = 'CATEGORY'
IMPORTING e_value = key-category.
ENDMETHOD.
METHOD get_inserted_rows.
inserted_rows = me->inserted_rows.
ENDMETHOD.
METHOD refresh_delta_tables.
clear me->inserted_rows[].
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
SELECT client name value
INTO CORRESPONDING FIELDS OF TABLE lt_registrz FROM zbc_dan_regstry.
SELECT category INTO CORRESPONDING FIELDS OF TABLE lt_category FROM zbc_dan_category.
CALL SCREEN 0100.
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'BACK'.
SET SCREEN 0.
MESSAGE ID 'BC400' TYPE 'S' NUMBER '057'.
WHEN 'SAVE'.
PERFORM save_data.
WHEN OTHERS.
ENDCASE.
ENDMODULE.
MODULE clear_ok_code OUTPUT.
CLEAR ok_code.
ENDMODULE.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'DYNPRO100'.
SET TITLEBAR 'D0100'.
ENDMODULE.
MODULE display_alv OUTPUT.
PERFORM display_alv.
ENDMODULE.
FORM display_alv.
IF grid_r IS INITIAL.
*----Creating custom container instance
CREATE OBJECT container_r
EXPORTING
container_name = gc_custom_control_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
*----Creating ALV Grid instance
CREATE OBJECT grid_r
EXPORTING
i_parent = container_r
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
CREATE OBJECT g_verifier.
SET HANDLER g_verifier->handle_data_changed FOR grid_r.
*----Preparing field catalog.
PERFORM prepare_field_catalog CHANGING fieldcat_r.
*----Preparing layout structure
PERFORM prepare_layout CHANGING layout_r.
*----Here will be additional preparations
*--e.g. initial sorting criteria, initial filtering criteria, excluding
*--functions
CALL METHOD grid_r->set_table_for_first_display
EXPORTING
* I_BUFFER_ACTIVE =
* I_CONSISTENCY_CHECK =
* I_STRUCTURE_NAME =
* IS_VARIANT =
* I_SAVE =
* I_DEFAULT = 'X'
is_layout = layout_r
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
CHANGING
it_outtab = lt_registrz[]
it_fieldcatalog = fieldcat_r
* IT_SORT =
* IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
ELSE.
CALL METHOD grid_r->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
ENDIF.
CALL METHOD grid_r->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
CALL METHOD grid_r->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
ENDFORM.
FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZBC_DAN_REGSTR2'
CHANGING
ct_fieldcat = pt_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
LOOP AT pt_fieldcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN 'NAME'.
ls_fcat-coltext = 'Name'.
ls_fcat-outputlen = '40'.
MODIFY pt_fieldcat FROM ls_fcat.
WHEN 'VALUE'.
ls_fcat-coltext = 'Wert'.
ls_fcat-outputlen = '30'.
MODIFY pt_fieldcat FROM ls_fcat.
WHEN 'CATEGORY'.
LOOP AT lt_category into ls_category.
ls_ddval-handle = 1.
ls_ddval-value = ls_category-category.
* ls_ddval-style = cl_gui_alv_grid=>mc_style_enabled.
APPEND ls_ddval TO lt_ddval.
ENDLOOP.
CALL METHOD grid_r->set_drop_down_table
EXPORTING it_drop_down = lt_ddval.
ls_fcat-edit = 'X'.
ls_fcat-drdn_hndl = '1'.
ls_fcat-coltext = 'Kategorie'.
MODIFY pt_fieldcat FROM ls_fcat.
ENDCASE.
ENDLOOP.
ENDFORM.
FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo.
ps_layout-zebra = 'X'.
ps_layout-grid_title = 'Kategorie zur Registry hinzufügen'.
ps_layout-smalltitle = 'X'.
ENDFORM.
FORM save_data.
DATA: ls_ins_keys TYPE g_verifier->ls_registrz_keys,
ls_ins_key TYPE g_verifier->lt_registrz_key,
ls_registrz TYPE zbc_dan_regstrz,
ls_outtab LIKE LINE OF gt_outtab,
lt_instab TYPE TABLE OF zbc_dan_regstrz.
CALL METHOD g_verifier->get_inserted_rows IMPORTING inserted_rows = ls_ins_keys.
LOOP AT ls_ins_keys INTO ls_ins_key.
READ TABLE gt_outtab INTO ls_outtab
WITH KEY name = ls_ins_key-name
value = ls_ins_key-value
category = ls_ins_key-category.
IF sy-subrc = 0.
MOVE-CORRESPONDING ls_outtab TO ls_registrz.
APPEND ls_registrz TO lt_instab.
ENDIF.
ENDLOOP.
INSERT zbc_dan_regstrz FROM TABLE lt_instab.
CALL METHOD g_verifier->refresh_delta_tables.
ENDFORM.Hi Hans,
You raised the Question in the Webdynpro ABAP forum. Here its very diffcult to get the answer from this forum. Please close it here and raise the same question in ABAP General Forum there you will get faster and so many anwsers.
Please close the question here.
Warm Regards,
Vijay -
Hi
I want a report in which the report should have tree structure and along with check box
Regards
SnehaHI
Check this standard report
SAPCOLUMN_TREE_CONTROL_DEMO
*& Report ZTREE *
REPORT ZTREE .
DATA: BEGIN OF ITEMS OCCURS 100,
ID(10),
PARENT_ID(10),
TEXT(20),
SYMBOL,
END OF ITEMS,
TABIX_STACK LIKE SY-TABIX OCCURS 10 WITH HEADER LINE,
ITEMS_SHOW LIKE ITEMS OCCURS 100 WITH HEADER LINE.
INCLUDE <SYMBOL>.
\* append sample items (mixed order)
PERFORM APPEND_ITEM USING:
'1' '' 'Food',
'2' '' 'Drinks',
'12' '9' 'Pavan Praveen',
'17' '11' 'company',
'3' '' 'Tools',
'4' '1' 'Dairy milk',
'16' '11' 'Music',
'5' '1' 'Chocolate',
'6' '2' 'Alcoholic',
'8' '4' 'Megastar',
'10' '5' 'Milk',
'11' '3' 'Boost',
'13' '9' 'Sachin ',
'7' '4' 'Cricket',
'14' '2' 'Non-alcholic',
'35' '31' 'Pepsi',
'9' '6' 'Thumsup',
'15' '14' 'Coca-cola',
'18' '6' 'Win',
'28' '18' 'Ganguly ',
'33' '28' 'INDIA',
'34' '28' 'Gujarat',
'29' '18' 'State',
'30' '29' 'congrats',
'19' '33' 'chiranjeevi',
'20' '33' 'kalyan',
'22' '19' 'here comes',
'23' '19' 'Chandra',
'24' '20' 'chat',
'32' '31' 'Marvelous',
'25' '20' 'Memorable',
'31' '34' 'guess'.
\* show initial list (items with level 0 - parentless items)
LOOP AT ITEMS WHERE PARENT_ID = ''.
MOVE-CORRESPONDING ITEMS TO ITEMS_SHOW.
ITEMS_SHOW-SYMBOL = '+'.
APPEND ITEMS_SHOW.
ENDLOOP.
PERFORM PRINT_TREE TABLES ITEMS_SHOW.
\* at line-selection - when the node is opened/closed or item double-clk
AT LINE-SELECTION.
READ TABLE ITEMS WITH KEY PARENT_ID = ITEMS_SHOW-ID. "see 'hide'
IF SY-SUBRC = 0. "item has children - expand or collapse
SY-LSIND = 0.
PERFORM EXPAND_COLLAPSE USING ITEMS_SHOW-ID.
PERFORM PRINT_TREE TABLES ITEMS_SHOW.
ELSE. "item has NO children - perform some action
READ TABLE ITEMS WITH KEY ID = ITEMS_SHOW-ID.
WRITE: 'Action performed on item "' NO-GAP, ITEMS-TEXT NO-GAP,
'", id.', ITEMS-ID.
ENDIF.
\* form print_tree
FORM PRINT_TREE TABLES ITEMS STRUCTURE ITEMS.
DATA: V_TABIX LIKE SY-TABIX,
START_TABIX LIKE SY-TABIX,
V_LEVEL LIKE SY-TFILL,
V_OFFSET TYPE I,
V_ID LIKE ITEMS-ID,
V_PARENT_ID LIKE ITEMS-PARENT_ID,
V_PARENT_ID_FOR_VLINE LIKE ITEMS-PARENT_ID,
V_PREV_LEVEL TYPE I,
V_ITEMS_COUNT LIKE SY-TFILL,
V_VLINES_STRING(200).
CHECK NOT ITEMS[] IS INITIAL.
SORT ITEMS BY PARENT_ID ID.
READ TABLE ITEMS INDEX 1.
V_PARENT_ID = ITEMS-PARENT_ID.
START_TABIX = 1.
REFRESH TABIX_STACK.
DO.
LOOP AT ITEMS FROM START_TABIX.
V_TABIX = START_TABIX = SY-TABIX."remember current index
V_ID = ITEMS-ID.
V_PARENT_ID_FOR_VLINE = ITEMS-PARENT_ID.
\* decrease level and exit loop if parent not the same as previous
IF ITEMS-PARENT_ID NE V_PARENT_ID.
PERFORM READ_FROM_STACK CHANGING START_TABIX. "level = NoOfRecs
READ TABLE ITEMS INDEX START_TABIX.
V_PARENT_ID = ITEMS-PARENT_ID.
ADD 1 TO START_TABIX. "next loop starts from parent index + 1
\* clear vline
IF V_LEVEL > 1.
V_OFFSET = 2 + ( V_LEVEL - 2 ) * 3.
IF V_LEVEL = 1. V_OFFSET = 1. ENDIF.
V_VLINES_STRING+V_OFFSET = ' '.
ENDIF.
EXIT.
ENDIF.
V_PARENT_ID = ITEMS-PARENT_ID.
\* write item
FORMAT COLOR OFF.
DESCRIBE TABLE TABIX_STACK LINES V_LEVEL."level is no of StackRecs
WRITE: / V_VLINES_STRING.
V_OFFSET = V_LEVEL * 3.
IF V_LEVEL NE 0.
IF V_PREV_LEVEL < V_LEVEL.
WRITE: AT V_OFFSET '|', / ''.
WRITE: / V_VLINES_STRING.
ENDIF.
V_OFFSET = V_LEVEL * 3.
WRITE AT V_OFFSET '|--'.
ENDIF.
V_OFFSET = V_OFFSET + 3.
CASE ITEMS-SYMBOL.
WHEN '+'.
WRITE AT V_OFFSET SYM_PLUS_FOLDER AS SYMBOL
COLOR 4 INTENSIFIED HOTSPOT.
WHEN '-'.
WRITE AT V_OFFSET SYM_MINUS_FOLDER AS SYMBOL
COLOR 4 INTENSIFIED HOTSPOT.
WHEN OTHERS. FORMAT COLOR 5.
ENDCASE.
WRITE: ITEMS-TEXT.
V_PREV_LEVEL = V_LEVEL.
HIDE: ITEMS-ID.
ADD 1 TO V_ITEMS_COUNT.
READ TABLE ITEMS WITH KEY PARENT_ID = ITEMS-ID.
\* increase level and exit loop if item has children
IF SY-SUBRC = 0.
START_TABIX = SY-TABIX.
APPEND V_TABIX TO TABIX_STACK. "level is no of recs in stack
V_PARENT_ID = ITEMS-PARENT_ID.
\* set vline
V_TABIX = V_TABIX + 1.
READ TABLE ITEMS INDEX V_TABIX.
V_OFFSET = 2 + ( V_LEVEL - 1 ) * 3.
IF V_LEVEL > 0.
IF ITEMS-PARENT_ID = V_PARENT_ID_FOR_VLINE AND SY-SUBRC = 0.
V_VLINES_STRING+V_OFFSET = '|'.
ELSE.
V_VLINES_STRING+V_OFFSET = ' '.
ENDIF.
ENDIF.
EXIT.
ENDIF.
\* at last - decrease level
AT LAST.
\* clear vline
IF V_LEVEL > 1.
V_OFFSET = 2 + ( V_LEVEL - 2 ) * 3.
IF V_LEVEL = 1. V_OFFSET = 1. ENDIF.
V_VLINES_STRING+V_OFFSET = ' '.
ENDIF.
" next loop starts from parent index, not parent index + 1
" because of different parents level will decrease anyway
PERFORM READ_FROM_STACK CHANGING START_TABIX.
APPEND START_TABIX TO TABIX_STACK. "must return index to stack
ENDAT.
ENDLOOP.
DESCRIBE TABLE ITEMS.
IF START_TABIX > SY-TFILL OR V_ITEMS_COUNT >= SY-TFILL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
\* form expand_collapse
FORM EXPAND_COLLAPSE USING VALUE(V_ID).
DATA: V_NO_MORE_ORPHANS,
ITEMS_TEMP LIKE ITEMS OCCURS 100 WITH HEADER LINE.
DELETE ITEMS_SHOW WHERE PARENT_ID = V_ID. "try to collapse
IF SY-SUBRC = 0. "succesfull first collapse
DO. "cascade collapse - delete 'orphans' that are left
REFRESH ITEMS_TEMP.
MOVE ITEMS_SHOW\[] TO ITEMS_TEMP[].
SORT ITEMS_TEMP BY ID.
V_NO_MORE_ORPHANS = 'X'.
LOOP AT ITEMS_SHOW WHERE PARENT_ID NE ''.
READ TABLE ITEMS_TEMP WITH KEY ID = ITEMS_SHOW-PARENT_ID
BINARY SEARCH TRANSPORTING NO FIELDS.
IF SY-SUBRC NE 0. "no parent - it's an orphan
CLEAR V_NO_MORE_ORPHANS.
DELETE ITEMS_SHOW.
ENDIF.
ENDLOOP.
IF V_NO_MORE_ORPHANS = 'X'. EXIT. ENDIF.
ENDDO.
ITEMS_SHOW-SYMBOL = '+'.
MODIFY ITEMS_SHOW TRANSPORTING SYMBOL WHERE ID = V_ID.
ELSE. "unsuccessfull collapse - expand
ITEMS_SHOW-SYMBOL = '-'.
MODIFY ITEMS_SHOW TRANSPORTING SYMBOL WHERE ID = V_ID.
LOOP AT ITEMS WHERE PARENT_ID = V_ID. "show children
APPEND ITEMS TO ITEMS_SHOW.
ENDLOOP.
LOOP AT ITEMS_SHOW WHERE PARENT_ID = V_ID. "check grandchildren
READ TABLE ITEMS WITH KEY PARENT_ID = ITEMS_SHOW-ID.
IF SY-SUBRC = 0.
ITEMS_SHOW-SYMBOL = '+'.
ELSE.
ITEMS_SHOW-SYMBOL = ''.
ENDIF.
MODIFY ITEMS_SHOW.
ENDLOOP.
ENDIF.
ENDFORM.
\* form append_item
FORM APPEND_ITEM USING VALUE(ID) VALUE(PARENT_ID) VALUE(TEXT).
ITEMS-ID = ID.
ITEMS-PARENT_ID = PARENT_ID.
ITEMS-TEXT = TEXT.
APPEND ITEMS.
ENDFORM.
\* form read_from_stack
FORM READ_FROM_STACK CHANGING TABIX LIKE SY-TABIX.
DESCRIBE TABLE TABIX_STACK.
CHECK SY-TFILL NE 0.
READ TABLE TABIX_STACK INDEX SY-TFILL.
TABIX = TABIX_STACK.
DELETE TABIX_STACK INDEX SY-TFILL.
ENDFORM.
Or use this FM RS_TREE_SET_CURRENT_LAYOUT
*& Report ZTREESTRUC *
REPORT ZTREESTRUC .
Type-pools : fibs,stree.
data : t_node type snodetext.
data : node_tab like t_node occurs 0 with header line.
clear : node_tab, node_tab[].
node_tab-type = 'T'.
node_tab-name = 'Earth'.
node_tab-tlevel = '01'.
node_tab-nlength = '5'.
node_tab-color = '4'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 3.
append node_tab.
clear node_tab.
node_tab-type = 'P'.
node_tab-name = 'Europe'.
node_tab-tlevel = '02'.
node_tab-nlength = '6'.
node_tab-color = '1'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 4.
append node_tab.
clear node_tab.
node_tab-type = 'P'.
node_tab-name = 'Germany'.
node_tab-tlevel = '03'.
node_tab-nlength = '7'.
node_tab-color = '4'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 4.
append node_tab.
clear node_tab.
node_tab-type = 'P'.
node_tab-name = 'Berlin'.
node_tab-tlevel = '04'.
node_tab-nlength = '6'.
node_tab-color = '4'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 3.
append node_tab.
clear node_tab.
node_tab-type = 'P'.
node_tab-name = 'Asia'.
node_tab-tlevel = '02'.
node_tab-nlength = '4'.
node_tab-color = '1'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 3.
append node_tab.
clear node_tab.
node_tab-type = 'P'.
node_tab-name = 'India'.
node_tab-tlevel = '03-'.
node_tab-nlength = '5'.
node_tab-color = '1'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 3.
append node_tab.
clear node_tab.
node_tab-type = 'P'.
node_tab-name = 'Bombay'.
node_tab-tlevel = '04-'.
node_tab-nlength = '6'.
node_tab-color = '1'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 3.
append node_tab.
clear node_tab.
CALL FUNCTION 'RS_TREE_CONSTRUCT'
\* EXPORTING
INSERT_ID = '000000'
RELATIONSHIP = ' '
LOG =
TABLES
NODETAB = node_tab
\* EXCEPTIONS
TREE_FAILURE = 1
ID_NOT_FOUND = 2
WRONG_RELATIONSHIP = 3
OTHERS = 4
IF SY-SUBRC 0.
\* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA: type_mapping TYPE stree_ctl_type_mapping_tab.
DATA: wa_type TYPE stree_ctl_type_mapping.
CLEAR: type_mapping[].
wa_type-type = 'A'.
wa_type-icon = '@BL@'.
APPEND wa_type TO type_mapping.
*CALL FUNCTION 'RS_TREE_CONTROL_PREPARE'
\* EXPORTING
CONTROL_PATTERN = STREE_CTL_GENERIC
CONTROL_PATTERN = 'PH'
\** HIERARCHY_HEADER =
INITIAL_HEADER_WIDTH =
LIST_ITEM_HEADER =
MULTIPLE_SELECTION = 'X'
ITEM_SELECTION = STREE_FALSE
SUPPRESS_NODE_ICON = STREE_FALSE
SUPPRESS_FOLDER_ICON = STREE_FALSE
CALLBACK_PROGRAM =
CALLBACK_ITEM_DISPLAY =
COLOR_MAPPING =
TYPE_MAPPING = type_mapping
IMPORTING
SUBSCREEN_PROGRAM =
SUBSCREEN_DYNNR =
EXCEPTIONS
NOT_AVAILABLE = 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.
*CALL FUNCTION 'RS_TREE_SET_CURRENT_LAYOUT'
\** EXPORTING
CURSOR_COLUMN = 3
CURSOR_LINE = 2
FIRST_NODE = 1
FIRST_NODE_TYPE = ' '
LIST_COLUMN = 1
LIST_LINE = 1
LAYOUT_MODE = STREE_LAYOUT_NORMAL
IMPORTING
INCONSISTENT_LAYOUT =
TABLES
LAYOUT =
CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
EXPORTING
\* CALLBACK_PROGRAM =
CALLBACK_USER_COMMAND =
CALLBACK_TEXT_DISPLAY =
CALLBACK_MOREINFO_DISPLAY =
CALLBACK_COLOR_DISPLAY =
CALLBACK_TOP_OF_PAGE =
CALLBACK_GUI_STATUS =
CALLBACK_CONTEXT_MENU =
STATUS = 'IMPLICIT'
CHECK_DUPLICATE_NAME = '1'
COLOR_OF_NODE = '4'
COLOR_OF_MARK = '3'
COLOR_OF_LINK = '1'
COLOR_OF_MATCH = '5'
LOWER_CASE_SENSITIVE = ' '
MODIFICATION_LOG = ' '
NODE_LENGTH = 30
TEXT_LENGTH = 75
TEXT_LENGTH1 = 0
TEXT_LENGTH2 = 0
RETURN_MARKED_SUBTREE = ' '
SCREEN_START_COLUMN = 0
SCREEN_START_LINE = 0
SCREEN_END_COLUMN = 0
SCREEN_END_LINE = 0
SUPPRESS_NODE_OUTPUT = ' '
LAYOUT_MODE = ' '
USE_CONTROL = STREE_USE_LIST
USE_CONTROL = 'L'.
\* IMPORTING
F15 =
**********end of program
For Tree structure in alv
Check this
*& Report ZALVTREE *
REPORT ZALVTREE .
*Data Declaration
TABLES: ekko.
TYPE-POOLS: slis. "ALV Declarations
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
it_ekpo TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
it_emptytab TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko,
wa_ekpo TYPE t_ekko.
DATA: ok_code like sy-ucomm, "OK-Code
save_ok like sy-ucomm.
*ALV data declarations
DATA: fieldcatalog TYPE lvc_t_fcat WITH HEADER LINE.
DATA: gd_fieldcat TYPE lvc_t_fcat,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv.
*ALVtree data declarations
CLASS cl_gui_column_tree DEFINITION LOAD.
CLASS cl_gui_cfw DEFINITION LOAD.
DATA: gd_tree TYPE REF TO cl_gui_alv_tree,
gd_hierarchy_header TYPE treev_hhdr,
gd_report_title TYPE slis_t_listheader,
gd_logo TYPE sdydo_value,
gd_variant TYPE disvariant.
*Create container for alv-tree
DATA: l_tree_container_name(30) TYPE c,
l_custom_container TYPE REF TO cl_gui_custom_container.
*Includes
*INCLUDE ZDEMO_ALVTREEO01. "Screen PBO Modules
*INCLUDE ZDEMO_ALVTREEI01. "Screen PAI Modules
*INCLUDE ZDEMO_ALVTREEF01. "ABAP Subroutines(FORMS)
*Start-of-selection.
START-OF-SELECTION.
\* ALVtree setup data
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM build_hierarchy_header CHANGING gd_hierarchy_header.
PERFORM build_report_title USING gd_report_title gd_logo.
PERFORM build_variant.
\* Display ALVtree report
call screen 100.
*& Form DATA_RETRIEVAL
\* Retrieve data into Internal tables
FORM data_retrieval.
SELECT ebeln
UP TO 10 ROWS
FROM ekko
INTO corresponding fields of TABLE it_ekko.
loop at it_ekko into wa_ekko.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
FROM ekpo
appending TABLE it_ekpo
where ebeln eq wa_ekko-ebeln.
endloop.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_FIELDCATALOG
\* Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
\* Please not there are a number of differences between the structure of
ALVtree fieldcatalogs and ALVgrid fieldcatalogs.
For example the field seltext_m is replace by scrtext_m in ALVtree.
fieldcatalog-fieldname = 'EBELN'. "Field name in itab
fieldcatalog-scrtext_m = 'Purchase Order'. "Column text
fieldcatalog-col_pos = 0. "Column position
fieldcatalog-outputlen = 15. "Column width
fieldcatalog-emphasize = 'X'. "Emphasize (X or SPACE)
fieldcatalog-key = 'X'. "Key Field? (X or SPACE)
\* fieldcatalog-do_sum = 'X'. "Sum Column?
fieldcatalog-no_zero = 'X'. "Don't display if zero
APPEND fieldcatalog TO gd_fieldcat.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-scrtext_m = 'PO Iten'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-scrtext_m = 'Status'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-scrtext_m = 'Item change date'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-scrtext_m = 'Material Number'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-scrtext_m = 'PO quantity'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-scrtext_m = 'Order Unit'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-scrtext_m = 'Net Price'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 7.
fieldcatalog-datatype = 'CURR'.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-scrtext_m = 'Price Unit'.
fieldcatalog-outputlen = 15.
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO gd_fieldcat..
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
\* Build layout for ALV grid report
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
\* gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
ENDFORM. " BUILD_LAYOUT
*& Form build_hierarchy_header
\* build hierarchy-header-information
\* -->P_L_HIERARCHY_HEADER structure for hierarchy-header
FORM build_hierarchy_header CHANGING
p_hierarchy_header TYPE treev_hhdr.
p_hierarchy_header-heading = 'Hierarchy Header'(013).
p_hierarchy_header-tooltip = 'This is the Hierarchy Header !'(014).
p_hierarchy_header-width = 30.
p_hierarchy_header-width_pix = ''.
ENDFORM. " build_hierarchy_header
*& Form BUILD_REPORT_TITLE
\* Build table for ALVtree header
\* <-> p1 Header details
<-> p2 Logo value
FORM build_report_title CHANGING
pt_report_title TYPE slis_t_listheader
pa_logo TYPE sdydo_value.
DATA: ls_line TYPE slis_listheader,
ld_date(10) TYPE c.
\* List Heading Line(TYPE H)
CLEAR ls_line.
ls_line-typ = 'H'.
\* ls_line-key "Not Used For This Type(H)
ls_line-info = 'PO ALVTree Display'.
APPEND ls_line TO pt_report_title.
\* Status Line(TYPE S)
ld_date(2) = sy-datum+6(2).
ld_date+2(1) = '/'.
ld_date3(2) = sy-datum4(2).
ld_date+5(1) = '/'.
ld_date+6(4) = sy-datum(4).
ls_line-typ = 'S'.
ls_line-key = 'Date'.
ls_line-info = ld_date.
APPEND ls_line TO pt_report_title.
\* Action Line(TYPE A)
CLEAR ls_line.
ls_line-typ = 'A'.
CONCATENATE 'Report: ' sy-repid INTO ls_line-info SEPARATED BY space.
APPEND ls_line TO pt_report_title.
ENDFORM.
*& Form BUILD_VARIANT
\* Build variant
form build_variant.
\* Set repid for storing variants
gd_variant-report = sy-repid.
endform. " BUILD_VARIANT
Regards
Pavan -
Hi all,
Please help,
I have created ALV tree, with the help of standard program bcalv_tree_01. now i want to create it interative like DOUBLE CLICK on any ITEM or NODE. so i have define class and implement it with two method for event NODE_DOUBLE_CLICK and ITEM_DOUBLE_CLICK. and i have register it. when i display the tree it doesn't expand, but i comments the CALL METHOD gd_tree->set_registered_events it works fine. should i have to implement the event EXPAND_NO_CHILDREN also?
and what should be the code, becoz i am new in alv tree and oops. for sytex please refer BCALV_TREE_01.
please help as soon as possible.
Thanks in advance.Hi!
Ya you have to code for the method EXPAND_NO_CHILDREN
Where you will be defining the childs to the particular node.
the better example for it you can refer to SAPSIMPLE_TREE_CONTROL_DEMO
where
HANDLE_EXPAND_NO_CHILDREN method implemented shows the childs added and METHOD HANDLE_NODE_DOUBLE_CLICK
implemented to handle the doulbe click.
Regards. -
Christmas Tree Table with checkboxes
I am using the JTable (CTTable, CTTableCellRenderer, and VisibleTableModelEvent) found at http://java.sun.com/products/jfc/tsc/articles/ChristmasTree/.
The problem that I am having is that I inserted a column with checkboxes. In that column, it shows the text value (true/false) instead of the checkbox. When I click on a cell in the column, it shows the checkbox while the mouse button is depressed. After clicking on the cell, the checkbox disappears and the value changes (example: if it was false before clicking, it becomes true after clicking).
Also, I have tried using my table with the standard JTable class and the checkboxes work correctly.Thanks Frank.
You are correct I am setting the Bind variable via client method dropped as default activity in TF.
I tried to utilize ensureVariableManager method in VOImpl and setting the Variable Value but when I try accessing the value of bind variable via get<BindVariableName>
I end up in stackOverFlow error.
Then I tried to override execute query by putting this lines before super.executeQuery();
ensureVariableManager().setVariableValue("BindVariableName", value);
but I guess this is not setting the Bind Variable too..
What am I doing wrong ?
Amit
Maybe you are looking for
-
Can delete mail only ONE at a TIME
Ever since the macmail app, changed it's appearence etc., I have been unable to delete unwanted messages I spot in my inbox. In order to delete them I have to open them one at a time, hit delete and w a i t. Going through 150 emails a day one at a ti
-
I downloaded about 100 cds to my library and I can no longer view the downloaded artwork it's shows a black picture or blank. How can I get the artwork back? Please help! Thank you.
-
Cannot copy and paste plot from LabVIEW to PPT
I am plotting a simple Y vs X curve using XY Graph and 2D Error Bar plot. When I highlight the two plots, and do CTRL-C, and go to MS PowerPoint and do a CTRL-V, only the XY Graph is pasted. My 2D Error Bar plot is NOT pasted, but I do see the label
-
I have just put my apple tv back to my TV after a long time absence and I am unable to trasfer itunes content like music to my apple tv. I see that my computer is sync as I have the chain icon in the settings menu but cant figure out what to do next.
-
Hi, I am using windows server 2008 R2 as PDC and ADC. My ADC was offline for more than 7 month .Now when it come online i am facing issue wit replication... Problem: "Trust relation between this computer and the primary domain failed" Event viewer lo