Creating Tree using programmed ViewObject
Hi,
I'm currently trying to create a Tree in a JSF page using a programmatic ViewObject, wich means that I don't have any entity objects, only one ViewObject that is recursive through itself using a ViewLink to connect it.
Structure:
ViewObject name: GroupsView
Atributes:
-Name: String; PK
-Owner: String;
ViewLink name: GroupsLink
Connects like this:
-Cardinality: 1 to *
-Source: GroupsView.Name
-Destination: GroupsView.Owner
and then I drag the link to the page and generate a tree from it, using GroupsView(<NameGroupsview>) level rules, but it seem to give me all the levels inside each level to the infinity, so it doesn't seem to verify the content groups inside each other.
is there any problem with the structure I've used?
thanks
Yes thanks, I've already seen that link before and it worked when using an entity based View Object, my problem is when using a programmatic ViewObject, the link doesn't seem to recognize the structure.
this is what I have in the GroupViewImpl.java:
protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs) {
// Create and populate a new row
ViewRowImpl r = createNewRowForCollection(qc);
int pos = getFetchPos(qc);
try {
int a = 0;
RoleProfile Group = rowData.get(pos).getRoleProfile();
populateAttributeForRow(r, a++, new Number(pos));
populateAttributeForRow(r, a++, Group.getName());
populateAttributeForRow(r, a++, null);
//populateAttributeForRow(r, 2, Group.getName());
} catch (IMException e) {
e.printStackTrace();
setFetchPos(qc, pos + 1);
return r;
and this is my selectionlistener from the Bean class:
public void groupSelectionListener(SelectionEvent selectionEvent) {
JSFUtils.invokeMethodExpression("#{bindings.GroupsView1.treeModel.makeCurrent}", Object.class, SelectionEvent.class, selectionEvent);
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("setroleNameVar");
operationBinding.execute();
CurrentUser = getSelectedUser();
CurrentGroup = getSelectedGroup();
try {
System.out.println(CurrentGroup.getName());
} catch (IMException e) {
but I still get the entire collection repeated inside each item of the tree, I wasn't suposed
This is irritating me, because I've searched much for this and still nothing
Thanks again
Similar Messages
-
Error - Create chemical using program
Hi All,
I am trying to create a chemical using BO EHFND_CHEMICAL using program. Referring the sample code listed in 'Navigating to BOPF' blog series.
I have passed ROOT node and BI_CHEMICAL nodes. But I am getting error 'Mandatory node ROLE is missing'.
When I tried to add ROLE node , in the code its giving errors like 'Mandatory node ROLE is missing' OR can not create, source object does not exist'.
I went through the node structure for the BO. In it we have Root - > Revision -> Role.
So my query is how to pass information for ROLE node? We need to add REVISION node also?
If anybody can guide, will be really helpful.Hi Shubhada,
The problem is that determinations are creating instances of some of the nodes. A determination is creating an instance of the REVISION node, but without the ROLE subnode instance—despite that the cardinality is 1:1…n. This results in the error Mandatory node ROLE missing.
The problem can be resolved by making two calls to the MODIFY method of the service manager. Create only the ROOT node instance with the first call, and the determinations will create additional node instances, including the REVISION node instance. Next get the key of the REVISION node instance, and use it to create an instance of the ROLE subnode by calling the MODIFY method again. Finally, commit the transaction by invoking the SAVE method of the transaction manager. Following is a code sample:
"Create the ROOT
CREATE DATA lr_s_root.
lr_s_root->key = /bobf/cl_frw_factory=>get_new_key( ).
lr_s_root->chm_nature = 'M'.
APPEND INITIAL LINE TO lt_mod ASSIGNING <ls_mod>.
<ls_mod>-node = if_ehfnd_chm_c=>sc_node-root.
<ls_mod>-change_mode = /bobf/if_frw_c=>sc_modify_create.
<ls_mod>-key = lr_s_root->key.
<ls_mod>-data = lr_s_root.
CALL METHOD me->mo_chm_bo->mo_svc_mngr->modify
EXPORTING
it_modification = lt_mod
IMPORTING
eo_change = lo_change
eo_message = lo_message.
FREE lt_mod.
"The REVISION node instance was created via a
"determination. Get its key; it's needed to
"create the ROLE node instance.
lt_change = lo_change->get_changes( ).
READ TABLE lt_change ASSIGNING <ls_change> INDEX 1.
<ls_change>-change_object->get_changes( IMPORTING et_change = lt_node_change ).
READ TABLE lt_node_change
WITH KEY key1 COMPONENTS node_key = if_ehfnd_chm_c=>sc_node-revision
ASSIGNING <ls_node_change>.
lv_rev_key = <ls_node_change>-key.
"Create the ROLE node instance; it's mandatory but was
"not created in a determination
CREATE DATA lr_s_role.
lr_s_role->key = /bobf/cl_frw_factory=>get_new_key( ).
lr_s_role->chemical_role = '1'.
APPEND INITIAL LINE TO lt_mod ASSIGNING <ls_mod>.
<ls_mod>-node = if_ehfnd_chm_c=>sc_node-role.
<ls_mod>-change_mode = /bobf/if_frw_c=>sc_modify_create.
<ls_mod>-source_node = if_ehfnd_chm_c=>sc_node-revision.
<ls_mod>-association =
if_ehfnd_chm_c=>sc_association-revision-role.
<ls_mod>-source_key = lv_rev_key.
<ls_mod>-key = lr_s_role->key.
<ls_mod>-data = lr_s_role.
CALL METHOD me->mo_chm_bo->mo_svc_mngr->modify
EXPORTING
it_modification = lt_mod
IMPORTING
eo_change = lo_change
eo_message = lo_message.
"Commit the transaction
CALL METHOD me->mo_chm_bo->mo_txn_mngr->save
IMPORTING
eo_message = lo_message
ev_rejected = lv_rejected. -
Hi,
We are using BOBJ 3.1 and using Designer SDK reference in .net application to create universe (.unv) by .net code. Now, we have to move with BOBJ 4.1 and need to create .unx using .net application. Can anyone guide me how to do. I am trying to find IDT api reference but not getting anything. Please suggest.
Thanks,
PankajHello Pankaj,
Unfortunately there is no .NET SDK available as of now for create UNX universe. But you can use Semantic Layer Java SDKs for building UNX universe from scratch.
This SDK is available from BI 4.1 onwards. You can find all the Semantic Layer Java SDKs resources from the below link in the section Developer Documentation: Java:
SAP BusinessObjects Business Intelligence platform 4.1 – SAP Help Portal Page
You can download the relevant resources according to your environment specification.
The other part that you can use is Semantic Layer REST SDKs. You can use .NET application for consuming the Semantic Layer REST Web services SDKs, but it doesn't gives you that level of flexibility which is provided through Semantic Layer Java SDKs(like creating universe from scratch, edit business layer, add/delete/refresh objects in DataFoundation etc.). You can also explore the functionality of Semantic Layer REST Web Service SDKs by following the link. The Semantic Layer REST Web Services is available from the BI 4.1 SP 2 onwards.
Hope this helps.
Thanks,
Shailendra -
Creating InfoObjects using program and assignment under InfoObject Catalog
Hi All,
There is a FM BAPI_IOBJ_CREATE which can create an Infoobject but the problem is it is not having provisions to get assigned to a particular " Infoobject Catalog".
Is there any other program or some way by which we can do it using the same FM.
Thanks in advanceTo assign your Infoobject you must use a separate BAPI:
BAPI_IOBC_CHANGE
This function module changes an existing InfoObject catalog. Enter all the InfoObject catalog properties in the DETAILS parameter
If the Catalog doesn't exist you have another BAPI:
BAPI_IOBC_CREATE
This function module creates a new InfoObject catalog. You have to give all the InfoObject catalog properties in the DETAILS parameter
Regards,
Sergio -
Error while trying to create tree using same EMP how to tutorial
Hi,
I get the following error while trying to create a sample tree similar to the one
posted in the how-tos web page.
The final query that creates the tree is also as follows
The Current Query shown in my apex window and the one on the howtos tutorial is as follows
select "EMPNO" id,
"MGR" pid,
"ENAME" name,
null link,
null a1,
null a2
from "RJOSEEMPCLUB"."EMP"
where DEPTNO = 1
The error is as follows
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
Debug:
1: begin
2: wwv_flow_wiz_confirm.create_tree (
3: p_flow_id => :FB_FLOW_ID,
4: p_region_template => replace(:F4000_P112_REGION_TEMPLATE,'%'||'null%',null),
5: p_start_option => :F4000_P112_START_OPTION,
6: p_owner => :F4000_P112_OWNER,
7: p_table_name => :F4000_P112_TABLE,
8: p_id => :F4000_P112_ID,
9: p_pid => :F4000_P112_PID,
10: p_name => :F4000_P112_NAME,
11: p_link_option => :F4000_P112_LINK_OPTION,
12: p_link_page_id => :F4000_P112_LINK_PAGE_ID,
13: p_link_item => :F4000_P112_LINK_ITEM,
14: p_where => :F4000_P112_WHERE,
15: p_order_by => :F4000_P112_ORDER_BY,
16: p_page_id => :F4000_P112_PAGE_ID,
17: p_page_name => :F4000_P112_PAGE_NAME,
18: p_tab_set => :F4000_P112_TAB_SET,
19: p_tab_text => :F4000_P112_TAB_TEXT,
20: p_region_name => :F4000_P112_REGION_NAME,
21: p_tree_name => :F4000_P112_TREE_NAME,
22: p_tree_type => :F4000_P112_TREE_TYPE,
23: p_max_levels => :F4000_P112_MAX_LEVELS);
24: end;Hi Kart,
If you have the sample EMP table, the DEPTNO values are 10, 20 or 30.
Did you specify a root value for the tree?
Regards
Andy -
How to use standard classes to create custom modulepool program like ME21N
I am at the Starting Point of doing a classical dynpro program via Abap Objects which address all controls with MVC Architecture .So i debugged the standard ME21n transaction to find out how i can start with. I came across this interface which has no Attributes and Methods.I wondered y .Thats y i posted a Question .I also seen a lot of Standard classes
CL_TABLE_VIEW_MM
CL_BASIC_MODEL_VIEW_MM
CL_COMPOSITE_SCREEN_VIEW_MM
CL_SCREEN_VIEW_MM
CL_TABLE_VIEW_MM
CL_TABSTRIP_VIEW_MM
CL_TC_BUTTON_VIEW_MM
CL_TC_ITEM_VIEW_MM
CL_TOGGLE_VIEW_MM
CL_VALUE_MODEL_VIEW_MM
and much more for Model and Controllers ..Can u plz guide me how i can make use of this classes effictively in my custom module pool programmingI think all these classes serve the purpose of embracing the basic ones and are used specificalty in MM module.
If you want to create similar module pool program with nice expand/collapse buttons in relation to subscreens please refer the some tips [here|expand/collapse button functionality on module pool screen;
Also there are transactions like BIBS, DWDM which you can follow the examples from. I think SAP has covered all GUI controlls there so you can create really complex programs with various GUI controlls independently of module used for.
Of course you can still stick to classes you mentioned but I think the better is to learn some standard approach of creating such screens, then if you feel more advanced go for using module specific ones if you really need that.
Regards
Marcin -
Hi Everyone,
I am really very new to Labview and i am in great need for some help.I am assigned a task where i am supposed to create a labview program to control or moniter a BPC203 3 channel benchtop Piezo controller. I created a program with the help of the instructions provided in the APT-Labview guide provided by Thorlabs.But th program doesnt run . Whenever i try to run it i get the same error which says that "Control HW Communications disabled".I have attached a snapshot of the error message.So i tried to create a small program in labview which would read the volage output.Even there i got the same error message.I suppose there is some mistake on my part which i am not able to correct due to the lack of proper knowledge.Could anyone please help me to solve this problem.A slight elaboration would be highly appreciated.Also i think the error lies in the use of invoke node with the get Voltage output method. I am not sure whether the parameters i have provided to the invoke node are correct.Any help of any sort would be highly appreciated.
Attachments:
Front Panel with error message.PNG 202 KB
Block diagram.PNG 101 KBHi
I had the same problem today. However, I noticed that the piezo controller has 3 channels with separate slots and they are packaged in the same box. Therefore the whole box has a serial number, probably something like 71822280, and this is written with large letter. Now, in order to communicate with any of the channels, this does not help, but one needs to communicate directly with the interested channel and they have thier OWN SERIAL NUMBERS.
For example channel 1 (my X direction in the nanoMax stage) has serial 91822281, Y has 91822282 and Z has 91822283. So try looking if you have the right serial number Hopefully you found out this yourself but this might help others, I took me3 hours to get this thing working when I started to plug-in the cables and everything.
Lasse -
Creating SAP users using Program RHPROFL0
Hi Experts,
I want to create SAP users and assign authorisation using program RHPROFL0.
Whenever I execute this program Generate new user field is greyed out. I can not select it to create users.
I have already activated switch 'ORGPD' for Structural Authorisation check.
Is there any additional setting/config I am missing.
Pls helpHi, Syed!
As I can see from the source code in my system, this field is grayed out according to the following rule: "not a central system, no user generation".
Thus, it is likely that your system is a child CUA system, so logins are supposed to be created by CUA. -
Error when generating program when creating CVC using infoprovider
We are receiving the message "Error when generating program" when
creating CVC using infoprovider.
This may have something to do with the fact that we added an attribute
to the infoObject 9ALOCNO. We are getting an information message if we
run a consistency check in the POS.
We had this same issue in our development system. Here, I deactivated
and then reactivated the CVCs and this resolved the problem. However,
this is not a good solution since this is also a problem in our
production system and we do not want to deactivate the POS.
is there another option to fix this problem?
Thank you,
RumiHi Rumi,
i would try these:
1. Make sure the cube is active and every thing ok there
2. Run programs /SAPAPO/TS_PSTRU_CONS_CHECK on POS and /SAPAPO/TS_LCM_CONS_CHECK on planning area respectively.
3. Check the CVC creation log in transaction /n/sapapo/mc62 for more details. -
Creating Certificate using Acrobat dll in C# program
Hello,
I need to create a certificate, basically .pfx file in C#. I used makecert tool to create the certificate first and then export it into .pfx file through command line. My attempt was successful. Then I used the .pfx file to encrypt a pdf using iTextSharp. The pdf is encrypted successfuly but when i try to open the pdf, Acrobat/Reader shows a message "You do not have access rights to this encrypted document". I intalled the .pfx file but the problem still remains.
Can anyone please guide me what am I doing wrong. I used the following code from command prompt to create a certificate and then export the certificate to a pxf file
Create certificate - makecert -r -pe -n "CN=My CA" -ss CA -sr CurrentUser -a sha1 -sky signature -sv MyCA.pvk MyCA.cer
Export to pfx - pvk2pfx -pvk MyCA.pvk -spc MyCA.cer -pfx MySPC.pfx -po <password>
Is it possible to create a pfx file using acrobat dll in C#??
Please help me, its urgent.
Thanks in advance!No, there are no APIs for working with certificates from C#.
From: Adobe Forums <[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
Date: Tue, 13 Dec 2011 22:35:57 -0800
To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
Subject: Creating Certificate using Acrobat dll in C# program
Re: Creating Certificate using Acrobat dll in C# program
created by poortip87<http://forums.adobe.com/people/poortip87> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4083490#4083490 -
How to create a ztable using program?
Hi ,
How to create a ztable using programs for SQL database?
Can anyone plz explain it with a program!
Thanks in advance.hi,
Your purpose can be achieved through BDC programming too..
data:
t_bdcdata type table of bdcdata with header line.
start-of-selection.
perform bdc_dynpro using 'SAPMSRD0' '0102'.
perform bdc_field using 'BDC_OKCODE'
'=ADD'.
perform bdc_field using 'RSRD1-TBMA'
'X'.
perform bdc_field using 'RSRD1-TBMA_VAL'
'ztable_demo'.
perform bdc_dynpro using 'SAPLSD41' '2200'.
perform bdc_field using 'BDC_OKCODE'
'=CHANGE_MAINTFLAG'.
perform bdc_field using 'DD02D-DDTEXT'
'Ztable'.
perform bdc_field using 'DD02D-CONTFLAG'
'A'.
perform bdc_field using 'DD02D-MAINFLAG'
'X'.
perform bdc_dynpro using 'SAPLSD41' '2200'.
perform bdc_field using 'BDC_OKCODE'
'=DEF'.
perform bdc_field using 'DD02D-DDTEXT'
'Ztable'.
perform bdc_field using 'DD02D-CONTFLAG'
'A'.
perform bdc_field using 'DD02D-MAINFLAG'
'X'.
perform bdc_dynpro using 'SAPLSD41' '2200'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'DD02D-DDTEXT'
'Ztable'.
perform bdc_field using 'DD03D-ROLLNAME(01)'
'mandt'.
perform bdc_field using 'DD03D-FIELDNAME(01)'
'mandt'.
perform bdc_field using 'DD03P-KEYFLAG(01)'
'X'.
perform bdc_field using 'DD03P-NOTNULL(01)'
'X'.
perform bdc_dynpro using 'SAPLSD41' '2200'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'DD02D-DDTEXT'
'Ztable'.
perform bdc_field using 'DD03D-ROLLNAME(02)'
'S_CARR_ID'.
perform bdc_field using 'DD03D-FIELDNAME(02)'
'carrid'.
perform bdc_field using 'DD03P-KEYFLAG(02)'
'X'.
perform bdc_field using 'DD03P-NOTNULL(02)'
'X'.
perform bdc_dynpro using 'SAPLSD41' '2200'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'DD02D-DDTEXT'
'Ztable'.
perform bdc_field using 'DD03D-ROLLNAME(03)'
'S_CONN_ID'.
perform bdc_field using 'DD03D-FIELDNAME(03)'
'connid'.
perform bdc_dynpro using 'SAPLSD41' '2200'.
perform bdc_field using 'BDC_OKCODE'
'=SE13'.
perform bdc_field using 'DD02D-DDTEXT'
'Ztable'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_dynpro using 'SAPLSTRD' '0100'.
perform bdc_field using 'BDC_CURSOR'
'KO007-L_DEVCLASS'.
perform bdc_field using 'BDC_OKCODE'
'=TEMP'.
perform bdc_field using 'KO007-L_AUTHOR'
'SAPDEV02'.
perform bdc_dynpro using 'SAPMSEDS' '0050'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
perform bdc_field using 'DD09V-TABART'
'APPL0'.
perform bdc_field using 'DD09V-TABKAT'
'0'.
perform bdc_field using 'ALLOWSTATE-NOT_ALLOWED'
'X'.
perform bdc_dynpro using 'SAPMSEDS' '0050'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_field using 'DD09V-TABART'
'APPL0'.
perform bdc_field using 'DD09V-TABKAT'
'0'.
perform bdc_field using 'ALLOWSTATE-NOT_ALLOWED'
'X'.
perform bdc_dynpro using 'SAPLSD41' '2200'.
perform bdc_field using 'BDC_OKCODE'
'=WB_ACTIVATE'.
perform bdc_field using 'DD02D-DDTEXT'
'Ztable'.
perform bdc_dynpro using 'SAPLSEWORKINGAREA' '0205'.
perform bdc_field using 'BDC_OKCODE'
'=WEIT'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=NO'.
perform bdc_dynpro using 'SAPLSD41' '2200'.
perform bdc_field using 'BDC_OKCODE'
'=WB_BACK'.
perform bdc_field using 'DD02D-DDTEXT'
'Ztable'.
perform bdc_dynpro using 'SAPMSRD0' '0102'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_field using 'RSRD1-TBMA'
'X'.
perform bdc_field using 'RSRD1-TBMA_VAL'
'ZTABLE_DEMO'.
call transaction 'SE11' using t_bdcdata..
form BDC_DYNPRO using value(p_program)
value(p_num).
clear t_bdcdata.
t_bdcdata-program = p_program.
t_bdcdata-dynpro = p_num.
append t_bdcdata.
endform. " BDC_DYNPRO
form BDC_FIELD using value(p_fnam)
value(p_fval).
clear t_bdcdata.
t_bdcdata-fnam = p_fnam.
t_bdcdata-fval = p_fval.
append t_bdcdata.
endform. " BDC_FIELD
Thanks
Sharath -
How to extract data in order to create file for using program RFBIBL00?
Hi all!
In order to correct data in mass I need to select corresponding data (3000 FI documents) and extract these into a file in order to correct a field. This extract must having segment 1BKPF 2BSEG... the same file structure than in SXDA_TOOLS for FI documents.
Which program must I use in order to have the correct extract in order to use the standard program RFBIBL00 for creating FI document?
Must I create a specific program in order to create this file or only administrator can do this?
Thanks for your help!
DavidHi
RFBIBL00 is arranged on main strucuters BGR00 (for batcinput session data), BBKPF (for header data) and BBSEG (for item data).
Both structures BBKPF and BBSEG have to be filled, but only the fields have to be used or changed, the rest of the fields have to have the symbol for NO DATA, i.e /.
So there are no standard program can do it automatically, so it needs to creaste a program ad hoc....but it can use the Legacy System Migration Worbech (transaction LSMW) in order to do it,
so your problem can be really how to extract the data to be elaborated by LSMW, but you can do a simple query by se16 and download the result in a excel file
Max -
Unable to create Tree (af:tree and af:menuTree) using ADF 10G
Hi All,
I have tried creating a tree af:menuTree and af:tree using ADF 10G (JDeveloper 10.3.1.4) and i am unable to see the output on the screen.
Can you please guide me on this.
Some searchs on OTN suggested that it is not supported in 10G. If this is so, can you suggest any workaround?
Thanks,
RamHi Michael,
**Here is the code I used for Menu Tree
<afh:cellFormat valign="top">
<af:menuTree var="node" value="TEST">
<f:facet name="testNode">
<af:commandMenuItem text="testCM" action="#{node.action}"/>
</f:facet>
</af:menuTree>
</afh:cellFormat>
**Here is the code I used for Tree
<afh:cellFormat valign="top">
<af:tree id="productCategoriesTree" value="testTree" var="node" >
<f:facet name="nodeStamp">
<af:panelGroup >
<af:outputText rendered="#{node.ParentCategoryId eq null}" value="#{node.CategoryName}" inlineStyle="color:#FF8000;font-weight:bold;"/>
<af:outputText rendered="#{node.ParentCategoryId ne null}" value="#{node.CategoryName}"/>
</af:panelGroup>
</f:facet>
</af:tree>
</afh:cellFormat>
Kindly advice.
Thanks in advance,
Ram -
Control problem in trees using class
Hi all i am creating tree structure using class method in that when i am creating only one node it is working properly but when i try to crate multiple nodes it is giving me dump my program is as follow.
I search these on sdn and try the things but it still giving me same error.
*& Report ZIRPT_HR_TEST_SPLITTER_01
report zirpt_hr_test_splitter_01.
tables : pa0001,t582s.
select-options : p_pernr for pa0001-pernr no intervals.
* CLASS screen_init DEFINITION
class screen_init definition create private.
public section.
class-methods init_screen.
methods constructor.
private section.
data: splitter_h type ref to cl_gui_splitter_container,
splitter_v type ref to cl_gui_splitter_container,
picture type ref to cl_gui_picture,
tree type ref to cl_gui_simple_tree,
it_pa0001 type table of pa0001,
it_pa0000 type table of pa0000.
methods: fill_tree,
fill_picture.
endclass. "screen_init DEFINITION
* CLASS screen_handler DEFINITION
class screen_handler definition.
public section.
methods: constructor importing container
type ref to cl_gui_container,
handle_node_double_click
for event node_double_click
of cl_gui_simple_tree
importing node_key.
private section.
data: html_viewer type ref to cl_gui_html_viewer,
it_pa0001 type table of pa0001,
it_pa0000 type table of pa0000,
list_viewer type ref to cl_gui_alv_grid.
methods:
fill_list importing pernr type pa0001-pernr
infty type t582s-infty.
endclass. "screen_handler DEFINITION
* CLASS screen_init IMPLEMENTATION
class screen_init implementation.
method init_screen.
data screen type ref to screen_init.
create object screen.
endmethod. "init_screen
method constructor.
data: events type cntl_simple_events,
event like line of events,
event_handler type ref to screen_handler,
container_left type ref to cl_gui_container,
container_right type ref to cl_gui_container,
container_top type ref to cl_gui_container,
container_bottom type ref to cl_gui_container.
create object splitter_h
exporting
parent = cl_gui_container=>screen0
rows = 1
columns = 2.
call method splitter_h->set_border
exporting
border = cl_gui_cfw=>false.
call method splitter_h->set_column_mode
exporting
mode = splitter_h->mode_absolute.
call method splitter_h->set_column_width
exporting
id = 1
width = 110.
container_left = splitter_h->get_container( row = 1 column = 1 ).
container_right = splitter_h->get_container( row = 1 column = 2 ).
create object splitter_v
exporting
parent = container_left
rows = 2
columns = 1.
call method splitter_v->set_border
exporting
border = cl_gui_cfw=>false.
call method splitter_v->set_row_mode
exporting
mode = splitter_v->mode_absolute.
call method splitter_v->set_row_height
exporting
id = 1
height = 160.
container_top = splitter_v->get_container( row = 1 column = 1 ).
container_bottom = splitter_v->get_container( row = 2 column = 1 ).
create object picture
exporting parent = container_top.
create object tree
exporting parent = container_bottom
node_selection_mode =
cl_gui_simple_tree=>node_sel_mode_single.
create object event_handler
exporting container = container_right.
event-eventid = cl_gui_simple_tree=>eventid_node_double_click.
event-appl_event = ' '.
append event to events.
call method tree->set_registered_events
exporting
events = events.
set handler event_handler->handle_node_double_click for tree.
call method: me->fill_tree,
me->fill_picture.
call method cl_gui_cfw=>flush.
endmethod. "constructor
method fill_picture.
types pict_line(256) type c.
data pict_tab type table of pict_line.
data url(255) type c.
data : file type rlgrap-filename value 'C:\Documents and Settings\sapgroup.NITCOWRL\My Documents\nitco.gif'.
translate file to upper case.
*CALL FUNCTION 'WS_UPLOAD'
*EXPORTING
*filename = file
*filetype = 'BIN'
*TABLES
*data_tab = pict_tab.
data query_table_wa type w3query.
data query_table type table of w3query." OF like w3query occurs 1 with header line.
data html_table type table of w3html." like w3html occurs 1.
data return_code type w3param-ret_code.
data content_type type w3param-cont_type.
data content_length type w3param-cont_len.
data pic_data type table of w3mime." like w3mime occurs 0.
data pic_size type i.
refresh query_table.
query_table_wa-name = '_OBJECT_ID'.
query_table_wa-value = 'ENJOYSAP_LOGO'.
append query_table_wa to query_table.
call function 'WWW_GET_MIME_OBJECT'
tables
query_string = query_table
html = html_table
mime = pic_data
changing
return_code = return_code
content_type = content_type
content_length = content_length
exceptions
object_not_found = 1
parameter_not_found = 2
others = 3.
if sy-subrc = 0.
pic_size = content_length.
endif.
call function 'DP_CREATE_URL'
exporting
type = 'image'
subtype = cndp_sap_tab_unknown
size = pic_size
lifetime = cndp_lifetime_transaction
tables
data = pic_data
changing
url = url
exceptions
others = 1.
*IMPORT pict_tab = pict_tab FROM DATABASE abtree(pi) ID 'FLIGHTS'.
*CALL FUNCTION 'DP_CREATE_URL'
*EXPORTING
*type = 'IMAGE'
*subtype = 'GIF'
*TABLES
*data = pict_tab
*CHANGING
*url = url.
call method picture->load_picture_from_url
exporting
url = url.
call method picture->set_display_mode
exporting
display_mode = picture->display_mode_fit_center.
* CALL METHOD cl_gui_cfw=>flush.
endmethod. "fill_picture
method fill_tree.
data: node_table type table of abdemonode,
node type abdemonode.
*data : it_pa0001 TYPE TABLE OF p0001,
data :wa_pa0001 type pa0001,
wa_pa0000 type pa0000,
it_t582s type table of t582s,
wa_t582s type t582s.
types : begin of ttab,
itext type t582s-itext,
infty type t582s-infty,
pernr type p0001-pernr,
end of ttab.
data : itab type table of ttab,
wa_tab type ttab.
field-symbols : <fs> like p_pernr.
data : text1 type c.
node-hidden = ' '.
node-disabled = ' '.
node-isfolder = 'X'.
node-expander = ' '.
select * from t582s
into corresponding fields of table it_t582s
where sprsl = sy-langu
and infty in ('0001','0000')."'0002','0006',
* '0008','0015','0019').
loop at it_t582s into wa_t582s .
move-corresponding wa_t582s to wa_tab.
node-node_key = wa_t582s-infty.
clear node-relatkey.
clear node-relatship.
node-text = wa_t582s-itext.
node-n_image = ' '.
node-exp_image = ' '.
append node to node_table.
loop at p_pernr assigning <fs>.
wa_tab-pernr = <fs>-low.
append wa_tab to itab.
clear p_pernr-low.
node-node_key = <fs>-low.
node-relatkey = wa_tab-infty.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-text = <fs>-low.
node-n_image = '@AV@'.
append node to node_table.
endloop.
* SELECT SINGLE * FROM pa0001 INTO wa_pa0001 WHERE pernr in p_pernr.
* WHEN '0000'.
* SELECT SINGLE * FROM pa0000 INTO wa_pa0000 WHERE pernr = p_pernr.
* wa_tab-pernr = wa_pa0000-pernr.
* endcase.
clear : wa_tab,wa_pa0001,wa_pa0000.
endloop.
*node-hidden = ' '.
*node-disabled = ' '.
*node-isfolder = 'X'.
*node-expander = ' '.
*LOOP AT itab INTO wa_tab.
*AT NEW infty.
*node-node_key = wa_tab-infty.
*CLEAR node-relatkey.
*CLEAR node-relatship.
*node-text = wa_tab-itext.
*node-n_image = ' '.
*node-exp_image = ' '.
*APPEND node TO node_table.
*ENDAT.
*AT NEW pernr.
* node-node_key = wa_tab-pernr.
*node-relatkey = wa_tab-infty.
*node-relatship = cl_gui_simple_tree=>relat_last_child.
*node-text = wa_tab-pernr.
*node-n_image = '@AV@'.
*node-exp_image = '@AV@'.
*ENDAT.
*APPEND node TO node_table.
*ENDLOOP.
call method tree->add_nodes
exporting
table_structure_name = 'ABDEMONODE'
node_table = node_table.
* CALL METHOD cl_gui_cfw=>flush.
endmethod. "fill_tree
endclass. "screen_init IMPLEMENTATION
* CLASS screen_handler IMPLEMENTATION
class screen_handler implementation.
method constructor.
create object: html_viewer exporting parent = container,
list_viewer exporting i_parent = container.
endmethod. "constructor
method handle_node_double_click.
data: infty type t582s-infty,
pernr type pa0001-pernr.
infty = node_key(4).
pernr = node_key+4(8).
*IF pernr IS INITIAL.
*CALL METHOD: fill_html EXPORTING infty = infty,
*html_viewer->set_visible EXPORTING visible = 'X',
*list_viewer->set_visible EXPORTING visible = ' '.
*ELSE.
call method: fill_list exporting infty = infty
pernr = pernr,
list_viewer->set_visible exporting visible = 'X',
html_viewer->set_visible exporting visible = ' '.
*ENDIF.
* CALL METHOD cl_gui_cfw=>flush.
endmethod. "handle_node_double_click
*METHOD fill_html.
*DATA url TYPE scarr-url.
*SELECT SINGLE url
*FROM scarr
*INTO url
*WHERE infty = infty.
*CALL METHOD html_viewer->show_url EXPORTING url = url.
*ENDMETHOD.
method fill_list.
data: flight_tab type table of demofli,
begin of flight_title,
carrname type scarr-carrname,
cityfrom type spfli-cityfrom,
cityto type spfli-cityto,
end of flight_title,
list_layout type lvc_s_layo.
*DATA : it_pa0001 TYPE TABLE OF p0001.
if infty = '0001'.
select * from pa0001 into table it_pa0001 where pernr = pernr.
elseif infty = '0000'.
select * from pa0001 into table it_pa0001 where pernr = pernr.
endif.
*SELECT SINGLE c~carrname p~cityfrom p~cityto
*INTO CORRESPONDING FIELDS OF flight_title
*FROM ( scarr AS c
*INNER JOIN spfli AS p ON c~carrid = p~carrid )
*WHERE p~carrid = carrid AND
*p~connid = connid.
*SELECT fldate seatsmax seatsocc
*INTO CORRESPONDING FIELDS OF TABLE flight_tab
*FROM sflight
*WHERE carrid = carrid AND connid = connid
* ORDER BY fldate.
*CONCATENATE flight_title-carrname
*connid
*flight_title-cityfrom
*flight_title-cityto
list_layout-grid_title = 'TEST'.
list_layout-smalltitle = 'X'.
list_layout-cwidth_opt = 'X'.
list_layout-no_toolbar = 'X'.
*if infty = '0001'.
call method list_viewer->set_table_for_first_display
exporting
i_structure_name = 'PA0001'
is_layout = list_layout
changing
it_outtab = it_pa0001.
* CALL METHOD cl_gui_cfw=>flush.
*ELSEIF infty = '0001'.
*CALL METHOD list_viewer->set_table_for_first_display
*EXPORTING i_structure_name = 'PA0000'
*is_layout = list_layout
*CHANGING it_outtab = it_pa0000.
*endif.
endmethod. "fill_list
endclass. "screen_handler IMPLEMENTATION
start-of-selection.
data : it_pa0001 type table of p0001.
call screen 100.
* MODULE status_0100 OUTPUT
module status_0100 output.
set pf-status 'SCREEN_100'.
set titlebar 'TIT_100'.
call method screen_init=>init_screen.
* CALL METHOD cl_gui_cfw=>flush.
endmodule. "status_0100 OUTPUT
* MODULE cancel INPUT
module cancel input.
set screen 0.
leave program.
endmodule. "cancel INPUT
Plz Suggest ,
Regards ,
Paresh G.METHOD fill_tree.
DATA: node_table TYPE TABLE OF abdemonode,
node TYPE abdemonode.
*data : it_pa0001 TYPE TABLE OF p0001,
DATA :wa_pa0001 TYPE pa0001,
wa_pa0000 TYPE pa0000,
it_t582s TYPE TABLE OF t582s,
wa_t582s TYPE t582s.
TYPES : BEGIN OF ttab,
itext TYPE t582s-itext,
infty TYPE t582s-infty,
pernr TYPE p0001-pernr,
END OF ttab.
DATA : itab TYPE TABLE OF ttab,
wa_tab TYPE ttab.
FIELD-SYMBOLS : <fs> LIKE p_pernr.
DATA : text1 TYPE c.
node-hidden = ' '.
node-disabled = ' '.
node-isfolder = 'X'.
node-expander = ' '.
SELECT * FROM t582s
INTO CORRESPONDING FIELDS OF TABLE it_t582s
WHERE sprsl = sy-langu
AND infty IN ('0001','0000')."'0002','0006',
'0008','0015','0019').
LOOP AT it_t582s INTO wa_t582s .
MOVE-CORRESPONDING wa_t582s TO wa_tab.
node-node_key = wa_t582s-infty.
CLEAR node-relatkey.
CLEAR node-relatship.
node-text = wa_t582s-itext.
node-n_image = ' '.
node-exp_image = ' '.
APPEND node TO node_table.
LOOP AT p_pernr ASSIGNING <fs>.
wa_tab-pernr = <fs>-low.
APPEND wa_tab TO itab.
CLEAR p_pernr-low.
node-node_key = <fs>-low.
node-relatkey = wa_tab-infty.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-text = <fs>-low.
node-n_image = '@AV@'.
APPEND node TO node_table.
ENDLOOP.
CLEAR : wa_tab,wa_pa0001,wa_pa0000.
ENDLOOP.
CALL METHOD tree->add_nodes
EXPORTING
table_structure_name = 'ABDEMONODE'
node_table = node_table.
CALL METHOD cl_gui_cfw=>flush.
ENDMETHOD. "fill_tree -
How to create tree structure in abap
hi,
I am mohan. Please send the how to create the tree structure. how to insert the child nodes in root node. actually our requirement is we have list transaction codes. We are planning to put all transaction codes in tree level.
please tell me how to do the program in tree structure.Hi Mohan,
Check the following program on ALV tree.
REPORT zalvtree.
CLASS cl_gui_column_tree DEFINITION LOAD.
CLASS cl_gui_cfw DEFINITION LOAD.
DATA: go_grid TYPE REF TO cl_gui_alv_grid.
DATA: ro_grid TYPE REF TO cl_gui_alv_grid.
DATA tree1 TYPE REF TO cl_gui_alv_tree.
DATA mr_toolbar TYPE REF TO cl_gui_toolbar.
DATA : gt_checked TYPE lvc_t_chit,
gs_checked LIKE LINE OF gt_checked,
l_part_key TYPE lvc_nkey,
gt_node TYPE lvc_s_chit-nodekey.
INCLUDE <icon>.
INCLUDE zamit_alv_tree_toolbar_event.
INCLUDE zbcalv_tree_event_receiver.
*DATA: toolbar_event_receiver TYPE REF TO lcl_toolbar_event_receiver.
DATA: gt_sflight TYPE sflight OCCURS 0, "Output-Table
gt_fieldcatalog TYPE lvc_t_fcat, "Fieldcatalog
ok_code LIKE sy-ucomm. "OK-Code
START-OF-SELECTION.
END-OF-SELECTION.
CALL SCREEN 100.
*& Module PBO OUTPUT
process before output
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
IF tree1 IS INITIAL.
PERFORM init_tree.
else.
CALL METHOD me->refresh_table_display
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.
ENDIF.
CALL METHOD cl_gui_cfw=>flush.
ENDMODULE. " PBO OUTPUT
*& Module PAI INPUT
process after input
MODULE pai INPUT.
CASE ok_code.
WHEN 'EXIT' OR 'BACK' OR 'CANC'.
PERFORM exit_program.
*mrk
WHEN 'MOVE'.
PERFORM check_selection.
WHEN 'MBAK'.
PERFORM another_selection.
WHEN 'ALL'.
PERFORM select_all.
WHEN 'CLEAR'.
PERFORM clear_all.
WHEN 'DELETE'.
PERFORM delete_all.
WHEN 'EXPAND'.
PERFORM expand_all.
WHEN 'COLLAPSE'.
PERFORM collapse_all.
WHEN OTHERS.
CALL METHOD cl_gui_cfw=>dispatch.
ENDCASE.
CLEAR ok_code.
CALL METHOD cl_gui_cfw=>flush.
ENDMODULE. " PAI INPUT
*& Form build_fieldcatalog
build fieldcatalog for structure sflight
FORM build_fieldcatalog.
get fieldcatalog
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
ct_fieldcat = gt_fieldcatalog.
change fieldcatalog
DATA: ls_fieldcatalog TYPE lvc_s_fcat.
LOOP AT gt_fieldcatalog INTO ls_fieldcatalog.
CASE ls_fieldcatalog-fieldname.
WHEN 'CARRID' OR 'CONNID' OR 'FLDATE'.
ls_fieldcatalog-no_out = 'X'.
ls_fieldcatalog-key = ''.
WHEN 'PRICE' OR 'SEATSOCC' OR 'SEATSMAX' OR 'PAYMENTSUM'.
ls_fieldcatalog-do_sum = 'X'.
ENDCASE.
MODIFY gt_fieldcatalog FROM ls_fieldcatalog.
ENDLOOP.
ENDFORM. " build_fieldcatalog
*& Form build_hierarchy_header
build hierarchy-header-information
-->P_L_HIERARCHY_HEADER strucxture for hierarchy-header
FORM build_hierarchy_header CHANGING
p_hierarchy_header TYPE treev_hhdr.
p_hierarchy_header-heading = 'Hierarchy Header'. "#EC NOTEXT
p_hierarchy_header-tooltip =
'This is the Hierarchy Header !'. "#EC NOTEXT
p_hierarchy_header-width = 30.
p_hierarchy_header-width_pix = ''.
ENDFORM. " build_hierarchy_header
*& Form exit_program
free object and leave program
FORM exit_program.
CALL METHOD tree1->free.
LEAVE PROGRAM.
ENDFORM. " exit_program
*& Form check_selection
text
--> p1 text
<-- p2 text
FORM check_selection .
create container for alv-tree
DATA: l_tree_container_name(30) TYPE c,
l_custom_container2 TYPE REF TO cl_gui_custom_container.
l_tree_container_name = 'TREE2'.
IF sy-batch IS INITIAL.
CREATE OBJECT l_custom_container2
EXPORTING
container_name = l_tree_container_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
ENDIF.
CREATE OBJECT go_grid
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = l_custom_container2
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
PERFORM load_data_into_grid.
*data: lt_nodes type LVC_T_NKEY,
ls_nodes like line of lt_nodes,
ls_checked like line of gt_checked.
*loop at gt_checked into ls_checked.
ls_nodes = ls_checked-nodekey.
append ls_nodes to lt_nodes.
*endloop.
*CALL METHOD tree1->unselect_nodes
EXPORTING
it_node_key = lt_nodes
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
DP_ERROR = 2
MULTIPLE_NODE_SELECTION_ONLY = 3
ERROR_IN_NODE_KEY_TABLE = 4
FAILED = 5
others = 6
*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. " check_selection
*& Form another_selection
text
--> p1 text
<-- p2 text
FORM another_selection .
create container for alv-tree
DATA: l_tree_container_name(30) TYPE c,
l_custom_container2 TYPE REF TO cl_gui_custom_container.
l_tree_container_name = 'TREE2'.
IF sy-batch IS INITIAL.
CREATE OBJECT l_custom_container2
EXPORTING
container_name = l_tree_container_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
ENDIF.
CREATE OBJECT ro_grid
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = l_custom_container2
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
PERFORM load_data_into_grid1.
DATA: lt_unsel TYPE lvc_t_nkey,
ls_unsel LIKE LINE OF lt_unsel.
LOOP AT gt_checked INTO gs_checked.
ls_unsel = gs_checked-nodekey.
APPEND ls_unsel TO lt_unsel.
ENDLOOP.
CALL METHOD tree1->unselect_nodes
EXPORTING
it_node_key = lt_unsel
EXCEPTIONS
cntl_system_error = 1
dp_error = 2
multiple_node_selection_only = 3
error_in_node_key_table = 4
failed = 5
OTHERS = 6.
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->unselect_all
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
FAILED = 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.
DATA: text TYPE lvc_value,
item TYPE lvc_t_layi,
node TYPE lvc_s_layn,
inode TYPE lvc_nkey.
FIELD-SYMBOLS: <wa> TYPE ANY.
DATA: l_dref_wa LIKE LINE OF gt_sflight.
ASSIGN l_dref_wa TO <wa>.
READ TABLE gt_checked INTO gs_checked WITH KEY nodekey = 3.
inode = gs_checked-nodekey.
CALL METHOD tree1->get_outtab_line
EXPORTING
i_node_key = inode
IMPORTING
e_outtab_line = <wa>
e_node_text = text
et_item_layout = item
es_node_layout = node
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.
DATA: lt_layout TYPE lvc_t_laci,
layout LIKE LINE OF lt_layout.
layout-chosen = 'X'.
layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-chosen = 'X'. "To give default checkbox value checked
layout-class = cl_gui_column_tree=>item_class_checkbox.
layout-editable = 'X'.
LAYOUT-U_CHOSEN = 'X'.
APPEND layout TO lt_layout.
CALL METHOD tree1->change_node
EXPORTING
i_node_key = inode
i_outtab_line = <wa>
IS_NODE_LAYOUT =
it_item_layout = lt_layout
I_NODE_TEXT =
I_U_NODE_TEXT =
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.
*CALL METHOD tree1->change_item
EXPORTING
i_node_key = inode
i_fieldname = gs_checked-FIELDNAME
i_data = <wa>
I_U_DATA = ''
IS_ITEM_LAYOUT = layout
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.
*loop at lt_unsel into ls_unsel.
*CALL METHOD tree1->update_checked_items
EXPORTING
i_node_key = ls_unsel
i_fieldname = ''
i_checked = ''
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.
*endif.
ENDFORM. " another_selection
*& Form select_all
text
--> p1 text
<-- p2 text
FORM select_all .
CONSTANTS: c_x(1) TYPE c VALUE 'X'.
*********Check box modifications.
CALL METHOD tree1->delete_all_nodes
EXCEPTIONS
failed = 1
cntl_system_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.
clear l_part_key.
create hierarchy
PERFORM create_hierarchy USING c_x.
CALL METHOD tree1->expand_node
EXPORTING
i_node_key = gt_node
I_LEVEL_COUNT = 1
i_expand_subtree = 'X'
EXCEPTIONS
failed = 1
illegal_level_count = 2
cntl_system_error = 3
node_not_found = 4
cannot_expand_leaf = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
add own functioncodes to the toolbar
perform change_toolbar.
register events
perform register_events.
adjust column_width
call method tree1->COLUMN_OPTIMIZE.
ENDFORM. " select_all
*& Form clear_all
text
--> p1 text
<-- p2 text
FORM clear_all .
CONSTANTS: c_x(1) TYPE c VALUE space.
*********Check box modifications.
CALL METHOD tree1->delete_all_nodes
EXCEPTIONS
failed = 1
cntl_system_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.
create hierarchy
PERFORM create_hierarchy USING c_x.
CALL METHOD tree1->expand_node
EXPORTING
i_node_key = gt_node
I_LEVEL_COUNT = 1
i_expand_subtree = 'X'
EXCEPTIONS
failed = 1
illegal_level_count = 2
cntl_system_error = 3
node_not_found = 4
cannot_expand_leaf = 5
OTHERS = 6
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. " clear_all
*& Form delete_all
text
--> p1 text
<-- p2 text
FORM delete_all .
*********Check box modifications.
CALL METHOD tree1->delete_all_nodes
EXCEPTIONS
failed = 1
cntl_system_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.
ENDFORM. " delete_all
*& Form expand_all
text
--> p1 text
<-- p2 text
FORM expand_all .
CALL METHOD tree1->expand_node
EXPORTING
i_node_key = gt_node
I_LEVEL_COUNT = 1
i_expand_subtree = 'X'
EXCEPTIONS
failed = 1
illegal_level_count = 2
cntl_system_error = 3
node_not_found = 4
cannot_expand_leaf = 5
OTHERS = 6
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. " expand_all
*& Form collapse_all
text
--> p1 text
<-- p2 text
FORM collapse_all .
CALL METHOD tree1->collapse_all_nodes
EXCEPTIONS
failed = 1
cntl_system_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.
ENDFORM. " collapse_all
*& Form load_data_into_grid
text
--> p1 text
<-- p2 text
FORM load_data_into_grid .
DATA:
For parameter IS_VARIANT
l_layout TYPE disvariant,
gs_layout TYPE lvc_s_layo.
DATA gi_sflight TYPE TABLE OF zsflight.
Load data into the grid and display them
l_layout-report = sy-repid.
gs_layout-grid_title = 'Amits Test Program'.
gs_layout-sel_mode = 'A'.
SELECT *
FROM zsflight
INTO TABLE gi_sflight.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
is_layout = gs_layout
is_variant = l_layout
i_save = 'A'
CHANGING
it_outtab = gi_sflight.
ENDFORM. " load_data_into_grid
*& Form load_data_into_grid
text
--> p1 text
<-- p2 text
FORM load_data_into_grid1.
DATA:
For parameter IS_VARIANT
l_layout TYPE disvariant,
gs_layout TYPE lvc_s_layo.
DATA gi_sflight TYPE TABLE OF zapempl.
Load data into the grid and display them
l_layout-report = sy-repid.
gs_layout-grid_title = 'Rams Test Program'.
gs_layout-sel_mode = 'A'.
SELECT *
FROM zapempl
INTO TABLE gi_sflight.
CALL METHOD ro_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'ZAPEMPL'
is_layout = gs_layout
is_variant = l_layout
i_save = 'A'
CHANGING
it_outtab = gi_sflight.
ENDFORM. " load_data_into_grid1
*& Form build_header
build table for html_header
--> p1 text
<-- p2 text
FORM build_comment USING
pt_list_commentary TYPE slis_t_listheader
p_logo TYPE sdydo_value.
DATA: ls_line TYPE slis_listheader.
LIST HEADING LINE: TYPE H
CLEAR ls_line.
ls_line-typ = 'H'.
LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'ALV-tree-demo: flight-overview'. "#EC NOTEXT
APPEND ls_line TO pt_list_commentary.
STATUS LINE: TYPE S
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-key = 'valid until'. "#EC NOTEXT
ls_line-info = 'January 29 1999'. "#EC NOTEXT
APPEND ls_line TO pt_list_commentary.
ls_line-key = 'time'.
ls_line-info = '2.00 pm'. "#EC NOTEXT
APPEND ls_line TO pt_list_commentary.
ACTION LINE: TYPE A
CLEAR ls_line.
ls_line-typ = 'A'.
LS_LINE-KEY: NOT USED FOR THIS TYPE
ls_line-info = 'actual data'. "#EC NOTEXT
APPEND ls_line TO pt_list_commentary.
p_logo = 'ENJOYSAP_LOGO'.
ENDFORM. "build_comment
*& Form create_hierarchy
text
--> p1 text
<-- p2 text
FORM create_hierarchy USING p_x.
DATA: ls_sflight TYPE sflight,
lt_sflight TYPE sflight OCCURS 0.
get data
SELECT * FROM sflight INTO TABLE lt_sflight
UP TO 200 ROWS .
SORT lt_sflight BY carrid connid fldate.
add data to tree
DATA: l_carrid_key TYPE lvc_nkey,
l_connid_key TYPE lvc_nkey,
l_last_key TYPE lvc_nkey.
l_part_key TYPE lvc_nkey
PERFORM add_carrid_line USING ls_sflight
CHANGING l_part_key.
gt_node = l_part_key.
LOOP AT lt_sflight INTO ls_sflight.
ON CHANGE OF ls_sflight-carrid.
PERFORM add_carrid_line USING ls_sflight
l_part_key
CHANGING l_carrid_key.
PERFORM add_connid_line USING ls_sflight
l_carrid_key
CHANGING l_connid_key.
PERFORM add_complete_line USING ls_sflight
l_connid_key
p_x
CHANGING l_last_key.
CONTINUE.
ENDON.
ON CHANGE OF ls_sflight-connid.
PERFORM add_connid_line USING ls_sflight
l_carrid_key
CHANGING l_connid_key.
PERFORM add_complete_line USING ls_sflight
l_connid_key
p_x
CHANGING l_last_key.
CONTINUE.
ENDON.
PERFORM add_complete_line USING ls_sflight
l_connid_key
p_x
CHANGING l_last_key.
ENDLOOP.
calculate totals
CALL METHOD tree1->update_calculations.
this method must be called to send the data to the frontend
CALL METHOD tree1->frontend_update.
ENDFORM. " create_hierarchy
*& Form add_carrid_line
add hierarchy-level 1 to tree
-->P_LS_SFLIGHT sflight
-->P_RELEATKEY relatkey
<-->p_node_key new node-key
FORM add_carrid_line USING ps_sflight TYPE sflight
p_relat_key TYPE lvc_nkey
CHANGING p_node_key TYPE lvc_nkey.
DATA: l_node_text TYPE lvc_value,
ls_sflight TYPE sflight.
set item-layout
DATA: lt_item_layout TYPE lvc_t_layi,
ls_item_layout TYPE lvc_s_layi.
ls_item_layout-t_image = '@3P@'.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-style =
cl_gui_column_tree=>style_intensifd_critical.
APPEND ls_item_layout TO lt_item_layout.
add node
l_node_text = ps_sflight-carrid.
CALL METHOD tree1->add_node
EXPORTING
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_sflight
it_item_layout = lt_item_layout
IMPORTING
e_new_node_key = p_node_key.
ENDFORM. " add_carrid_line
*& Form add_connid_line
add hierarchy-level 2 to tree
-->P_LS_SFLIGHT sflight
-->P_RELEATKEY relatkey
<-->p_node_key new node-key
FORM add_connid_line USING ps_sflight TYPE sflight
p_relat_key TYPE lvc_nkey
CHANGING p_node_key TYPE lvc_nkey.
DATA: l_node_text TYPE lvc_value,
ls_sflight TYPE sflight.
set item-layout
DATA: lt_item_layout TYPE lvc_t_layi,
ls_item_layout TYPE lvc_s_layi.
ls_item_layout-t_image = '@3Y@'.
ls_item_layout-style =
cl_gui_column_tree=>style_intensified.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
APPEND ls_item_layout TO lt_item_layout.
add node
l_node_text = ps_sflight-connid.
CALL METHOD tree1->add_node
EXPORTING
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_sflight
it_item_layout = lt_item_layout
IMPORTING
e_new_node_key = p_node_key.
ENDFORM. " add_connid_line
*& Form add_cmplete_line
add hierarchy-level 3 to tree
-->P_LS_SFLIGHT sflight
-->P_RELEATKEY relatkey
<-->p_node_key new node-key
FORM add_complete_line USING ps_sflight TYPE sflight
p_relat_key TYPE lvc_nkey
p_x
CHANGING p_node_key TYPE lvc_nkey.
DATA: l_node_text TYPE lvc_value.
set item-layout
DATA: lt_item_layout TYPE lvc_t_layi,
ls_item_layout TYPE lvc_s_layi.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-chosen = p_x. "To give default checkbox value checked
ls_item_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_item_layout-editable = 'X'.
APPEND ls_item_layout TO lt_item_layout.
l_node_text = ps_sflight-fldate.
CALL METHOD tree1->add_node
EXPORTING
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
is_outtab_line = ps_sflight
i_node_text = l_node_text
it_item_layout = lt_item_layout
IMPORTING
e_new_node_key = p_node_key.
ENDFORM. " add_complete_line
*& Form register_events
text
--> p1 text
<-- p2 text
FORM register_events.
define the events which will be passed to the backend
DATA: lt_events TYPE cntl_simple_events,
l_event TYPE cntl_simple_event.
define the events which will be passed to the backend
l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_header_click.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
APPEND l_event TO lt_events.
CALL METHOD tree1->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
set Handler
DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
CREATE OBJECT l_event_receiver.
SET HANDLER l_event_receiver->handle_node_ctmenu_request
FOR tree1.
SET HANDLER l_event_receiver->handle_node_ctmenu_selected
FOR tree1.
SET HANDLER l_event_receiver->handle_item_ctmenu_request
FOR tree1.
SET HANDLER l_event_receiver->handle_item_ctmenu_selected
FOR tree1.
SET HANDLER l_event_receiver->handle_checkbox_change FOR tree1.
ENDFORM. " register_events
*& Form change_toolbar
text
--> p1 text
<-- p2 text
FORM change_toolbar.
DATA: toolbar_event_receiver TYPE REF TO lcl_toolbar_event_receiver.
get toolbar control
CALL METHOD tree1->get_toolbar_object
IMPORTING
er_toolbar = mr_toolbar.
CHECK NOT mr_toolbar IS INITIAL.
add seperator to toolbar
CALL METHOD mr_toolbar->add_button
EXPORTING
fcode = ''
icon = ''
butn_type = cntb_btype_sep
text = ''
quickinfo = 'This is a Seperator'. "#EC NOTEXT
add Standard Button to toolbar (for Delete Subtree)
CALL METHOD mr_toolbar->add_button
EXPORTING
fcode = 'DELETE'
icon = '@18@'
butn_type = cntb_btype_button
text = ''
quickinfo = 'Delete subtree'. "#EC NOTEXT
add Dropdown Button to toolbar (for Insert Line)
CALL METHOD mr_toolbar->add_button
EXPORTING
fcode = 'INSERT_LC'
icon = '@17@'
butn_type = cntb_btype_dropdown
text = ''
quickinfo = 'Insert Line'. "#EC NOTEXT
set event-handler for toolbar-control
CREATE OBJECT toolbar_event_receiver.
SET HANDLER toolbar_event_receiver->on_function_selected
FOR mr_toolbar.
SET HANDLER toolbar_event_receiver->on_toolbar_dropdown
FOR mr_toolbar.
ENDFORM. " change_toolbar
*& Form init_tree
text
--> p1 text
<-- p2 text
FORM init_tree.
create fieldcatalog for structure sflight
PERFORM build_fieldcatalog.
create container for alv-tree
DATA: l_tree_container_name(30) TYPE c,
l_custom_container TYPE REF TO cl_gui_custom_container.
l_tree_container_name = 'TREE1'.
IF sy-batch IS INITIAL.
CREATE OBJECT l_custom_container
EXPORTING
container_name = l_tree_container_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
ENDIF.
create tree control
CREATE OBJECT tree1
EXPORTING
parent = l_custom_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple "node_sel_mode_single
item_selection = 'X'
no_html_header = ''
no_toolbar = ''
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
create Hierarchy-header
DATA l_hierarchy_header TYPE treev_hhdr.
PERFORM build_hierarchy_header CHANGING l_hierarchy_header.
create info-table for html-header
DATA: lt_list_commentary TYPE slis_t_listheader,
l_logo TYPE sdydo_value.
PERFORM build_comment USING
lt_list_commentary
l_logo.
repid for saving variants
DATA: ls_variant TYPE disvariant.
ls_variant-report = sy-repid.
create emty tree-control
CALL METHOD tree1->set_table_for_first_display
EXPORTING
is_hierarchy_header = l_hierarchy_header
it_list_commentary = lt_list_commentary
i_logo = l_logo
i_background_id = 'ALV_BACKGROUND'
i_save = 'A'
is_variant = ls_variant
CHANGING
it_outtab = gt_sflight "table must be emty !!
it_fieldcatalog = gt_fieldcatalog.
CONSTANTS: c_s(1) TYPE c VALUE space.
create hierarchy
PERFORM create_hierarchy USING c_s.
add own functioncodes to the toolbar
PERFORM change_toolbar.
register events
PERFORM register_events.
adjust column_width
call method tree1->COLUMN_OPTIMIZE.
ENDFORM. " init_tree
Award points if found useful.
Regards
Indrajit
Maybe you are looking for
-
Select All in ADF RichTable gets exception
One of my ADF tables gets the traceback below when I do a select all (either via ctrl/a or clicking on the row header). Can anyone suggest what I might do to prevent it -- it appears to not involve any custim code [2012-05-23T14:51:40.984-07:00] [oim
-
Printing directly on CDs/DVDs on a HP Officejet Pro 8600 Premium printer??
I have the HP Officejet Pro 8600 Premium and was wondering if I can print on CD and DVD discs with this printer and How do I do this?? And if not how do I print on DVDs and with what HP product do I use for it??
-
Generating document in XML in RM
Hi, I have a function module where I create a document in XML and store it in RM. In the code of this funcion module, I first create the empty document using the FM SRM_DOCUMENT_CREATE, and then I add the content to this document with the FM SRM_DOCU
-
Hi everyone ! Since now a few hours I have a problem with my after effect montage : As you can see on the screenshot of my montage, a picture of one of my video appears everywhere there's not any layer ;.. This really weird and annoying because it al
-
I need to reinstall microsoft word on 10.4.11
I got the following message when I try to open MS Word: Microsoft Word cannot load the Microsoft Office shared libraries. The files may have been moved from their original locations. Try the following: Move Word back to the