on 2009 Mar 12 11:19 AM
Hi Experts,
There is following thread in this forum, which asks exactly for my request:
Short description of the problem:
The original thread-poster seems to have solved the problem and was asked to share his knowledge. Unfortunately I was unable to find it on this Forum or on Wiki.
I also couldn't find any other guide, post, book, help that shows how to do this step by step.
I found many threads that maybe show a couple of steps but mostly these steps are not really explained and like I said - it's never complete.
Does anyone know how to do this or how I can find help?
Help is very appreciated!
Best regards,
/ Melanie
Hello Melanie,
I guess there are four different approaches for this:
1. The fast one:
You create a new view using the wizard that has one valuenode. In the last step you specify it to be a table view with the value node as source.
In the DO_INIT method of the view you do a RFC_READ_TABLE to your ERP database and put the data into the value node.
2. Using simple objects:
If this table is standalone. Meaning not related to any BOL component in CRM you could create a new simple object. I have not done this myself and I hope to be hearing about it in the SAP Developer Deep Dive Workshop.
3. Related object in an existing BOL component:
The table from ERP is somehow related to an object in CRM. For instance a business. You could then enhance the BOL component for this object an create a new dependent object in there. The coding would be very much like in 1., with the difference that you have a BOL object and can use it directly in tableview in multiple views.
4. New BOL componentn:
Maybe a little overkill. Create a new BOL component with a new root object. Then implement the same logic as in 1. and 3.
I am positive I wrote this text already in another post:
If you need the funtionality once go for option 1. Otherwise try if option 3 is applicable. In your case 3 should be working...
For the second part of your question:
- Help is offered by various consulting firms or even SAP consulting itself.
- There are quite some trainings SAP is offering. The RKT workshops, the DeepDive courses and the new CR580 I believe.
- Search SDN, the answers are out there
- get ahold of some (internal) SAP documentation named something with "How To". I saw an OSS note yesterday on how to make input by valuehelps mandatory for inputfields. In it they linked to internal documents
cheers Carsten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Carsten,
Thank you so much for your answer.
And I apologize if you had to write the same again, just because I didn't find it anywhere - I really tried to though.
I think for my case I'll go with your third option.
Once I figured it out I'll maybe create a "step by step" guide for SDN Wiki - I like to help others too.
I've had the CR580 training but for my requests it seems I need some deeper training. As a matter of fact I was searching the SAP training database recently and I hopefully can attend some courses soon.
I'm using the SDN alot - also got a bit better in searching with it, it's a great help!
Thanks also for the tip about the internal documents - didn't try them yet, but I shall in future ;).
Best regards,
Melanie
Hi everyone again,
I finally got time to look into this again. But unfortunately I didn't get too far. I've done following steps:
create new BOL entity (ZCustomTable) and assigned it as dependant object to BuilHeader
create new Component & Window & View
My View has two Context Nodes:
- BUILHEADER from BOL entity BuilHeader
- ZTABLE from BOL entity ZCustomTable
Context Node ZTABLE is a table (so a tableView view was created through Wizard)
Added some random text "Z-Table Test" to Ztable.htm to check if the view is being called
If I test my component, I see my text "Z-Table Test".
So my next step now is to display values from my z-table. To keep it simple I don't care about the relation to the Business Partner at the moment. I simply select all data from my z-table. But here is where I've already got problems...
Where is the right place to put the data selection?
I've tried several places but none seemed to work.
method DO_INIT from the Superclass ZL_ZTABLE from Implementation Class ZL_ZTABLE_IMPL: problem is, the context has not been created so I can't access attribute typed_context
method DO_INIT from Implementation Class ZL_ZTABLE_IMPL: same problem as above
method DO_INIT_CONTEXT from Superclass ZL_ZTABLE of ZL_ZTABLE_IMPL: I could access the typed_context object and I could fill typed_context->ztable->table with data BUT (see below...)
- method IF_BSP_MODEL~INIT of Implementation Class ZL_ZTABLE_CN01 of Context Node ZTABLE: I could fill attribute table with data BUT (see below...)
So above methods I've tried... BUT it never worked out for me. Even though the table attribute was filled with data, whenever I tested my Component I only saw my text and no table at all.
What am I doing wrong?
I did find out that the method call of typed_context->ZTABLE->build_table( ).(in method DO_PREPARE_OUTPUT) does remove the values from the table and leaves a table with the same amount of rows but now values. Why is that? Should I prevent that?
Here is the two codings I've tried:
method if_bsp_model~init.
super->if_bsp_model~init( id = id
owner = owner ).
data: lt_test type table of z102_test,
ls_test type z102_test,
lr_tabline type ref to data,
lr_bol_coll type ref to if_bol_bo_col,
lr_value_node type ref to cl_bsp_wd_value_node,
lr_entity type ref to cl_crm_bol_entity.
field-symbols: <tabline> type data.
" get data from table
select * from z102_test into table lt_test.
" get table line
lr_tabline = get_table_line_sample( ).
" create collection object
create object lr_bol_coll
type
cl_crm_bol_bo_col.
" loop through all found data...
loop at lt_test into ls_test.
"...assign current line
assign lr_tabline->* to <tabline>.
"...set values
move-corresponding ls_test to <tabline>.
"...create object with current line for object colleciton
create object lr_value_node
exporting
iv_data_ref = lr_tabline.
"...add current line object to object collection
lr_bol_coll->add( lr_value_node ).
endloop.
" set collection
me->set_collection( lr_bol_coll ).
endmethod.
method do_init_context.
* set initial selection mode for all tables
typed_context->ztable->set_selection_mode(
*--> begin - 31/03/09 - Melanie Lauber
iv_selection_mode = cl_bsp_wd_context_node_tv=>selmode_none
*<-- end - 31/03/09 - Melanie Lauber
).
* local table type definition
types: begin of t_tabline.
include type z102_test.
types:
end of t_tabline.
data: lt_test type table of z102_test,
ls_test type z102_test,
lr_tabline type ref to t_tabline.
field-symbols: <tabline> type data,
<table> type index table.
create data lr_tabline.
assign lr_tabline->* to <tabline>.
create data typed_context->ztable->table
like standard table of <tabline>.
assign typed_context->ztable->table->* to <table>.
" get data
select * from z102_test into table lt_test.
" set data into assigned table <table>
loop at lt_test into ls_test.
move-corresponding ls_test to <tabline>.
append <tabline> to <table>.
endloop.
endmethod.
Sorry for the huge post. But I rather give all information, so that whoever is trying to help, doesn't have to ask me back.
Help is appreciated!
Cheers, Melanie
Hi Melanie,
I will try to keep it short: Do not mess with the TABLE attribute of the node! It gets filled by the BUILD_TABLE() method during DO_PREPARE_OUTPUT() with the correct entries.
What you ought to do is create entries in the collection of the table context node.
Here is some example coding that should get you started. Put it in the DO_INIT_CONTEXT.
data: lt_test type table of z102_test,
ls_test type z102_test,
lr_tabline type ref to z102_test .
field-symbols:
<ls_data> type z102_test.
data:
lr_col type ref to cl_crm_bol_bo_col,
lr_valuenode type ref to cl_bsp_wd_value_node.
select * from z102_test into table lt_test.
create object lr_col.
loop at lt_test into ls_test.
create data lr_tabline.
create object lr_valuenode exporting iv_data_ref = lr_tabline.
lr_valuenode->set_properties( ls_test ).
lr_col->add( lr_valuenode ).
endloop.
typed_context->table->set_collection( lr_col ).
I typed this coding in here, it has not been tested. You should be able to find possible errors easily.
In a final state it is a good idea to create a new method on_adminh_changed() and make it an event listener for the NEW_FOCUS of the collection_wrapper of the BTAdminH. In there paste the coding from here to keep it updated once the root object is changed.
cheers Carsten
Hi again Carsten,
Sorry I didn't know I shouldn't touch the TABLE attribute. Because I haven't done such a thing in CRM 2007 before did I just go to the View-HTML page and there I saw table="//ztable/Table". So I tried to fill that. 😛
I've tried your coding (also in different variations) but even though the object lr_col is filled with entities with different values I don't see the table at all.
I've debugged the View RolesList component BP_SALES (seeing it's doing something similar). I never really found where the roles collection gets filled. But I found out that the only difference is that the collection of the roles-table-node has a BOL entitiy collection -> CL_CRM_BOL_ENTITY_COL / IF_BOL_ENTITY_COL.
So is it possible that I also need to fill a BOL collection? How would I do that?
Another strange thing that I didn't mention so far because it seemed unimportant... But now that I just can't get it to work I might as well ask if someone else had this problem...
After creating the View with the Wizard and choosing Table view... When I go into the View-HTML page (MyView.htm) is there a htmlb-tray and a htmlb-tableView (as it should be). But once I added a text and tried to activate the view, I coulnd't because of following error:
The type of "ME->ZTABLE->SELECTION_TAB" cannot be converted to the type of "%_O2X"
Because the table is supposed to be diplay only, I just removed following attributes from the tableView:
selectedRowIndex = "<%= ztable->SELECTED_INDEX %>"
selectedRowIndexTable = "<%= ztable->SELECTION_TAB %>"
Then I could activate. But isn't that error very strange?
I hope someone has more ideas. I ran out of them...
Best regards,
/ Melanie
Hi Melanie,
I had similar requirement and finally delivered the solution. I learnt it by looking into standard SAP demo UI component UIF_FLIGHT_O and view UIF_FLIGHT_O/MealList. I would suggest you to look into demo UI component UIF_FLIGHT_O. You can also run this UI application by using business role UIF.
Unfortunately, I can not publish my solution here because of my client policy.
Good luck.
Paparao
Hi Paparao and thanks for your answer!
I was looking at the UIF components but I can't seem to figure it out.
F.i. View UIF_FLIGHT_O/MealList. Where/How/When is the table-context-node UIFMEAL filled with data?
That is actually all I'm trying to find out - it sounds so simple but I can't make it work.
I have the additional problem that I can't test this Demo UI because our SCARR, SPFLI etc. tables are all empty.
I understand you cannot publish your solution. Maybe you can tell me where in UIF_FLIGHT_O I should keep looking?
Help is very appreciated!
Thanks & Best regards,
Melanie
Hi Melanie,
You can create sample flight data using tcode BC_DATA_GEN. This fills relevant tables for Flight Data Model and later you can see the data.
View UIF_FLIGHT_O/MealList, context node UIFMEAL is bound to Custom Controller UIF_FLIGHT_O/CuCoFlight Node UIFMEAL. Please look into ON_NEW_FOCUS method of CUCO node UIFMEAL Implementation Class CL_UIF_FLIG_CUCOFLIGHT_CN03 to see how the u201CMEALu201D table data is getting selected.
Regards,
Paparao
Edited by: Paparao Undavali on Apr 7, 2009 3:08 PM
Hi everyone,
I've finally solved this. I believe it's probably not the "common" way to do it, but I lacked time to keep searching for a "better" way. Unfortunatelly I'm still short on time so I won't be posting now how I've done it - but I promise to do so in future - hopping it helps someone else.
Thanks everyone for the helps and hints!
Best regards,
Melanie
Melanie,
Good to hear that you solved your problem. I'm actually working on building a UI component from scratch here. I will be interested in hearing your solution for the additional assignment block, as I know I will have a requirement in the future.
This thread was also useful for me as I finally found that example to get started. I have already built my "search" component and I'm now working on the overview component in "display" mode.
As a side note, I have put a request to SAP for better documentation on UI component creation and enhancement in the case where you have an existing z-table or Z-transaction that you need to convert over. We will have to see whether the community comes back with the information or SAP with the information faster.
Take care,
Stephen
Hi Melanie,
I was looking for some explantion where in i can create a custom Assignment block for Accounts.
Your explantion to this satisfy my requirement... I followed all the steps in your WIKI 'How to display a z-table in an assignment block ' But facing some problems.
My assignment block does not get refreshed when a new account is opened.
How to debug and find out whether the view is receiving the BP number.
I am new to MVC concept so i think i am lost ..... is there any thing else we need to do .....also if your explanation had screen shots on every step , then it would be more clear.
Hope you see this reply and get back with some suggestions.
Carsten,
I have a problem at the moment. I've been trying to work out what's going wrong for ages now, but simply can't.
All I've done is add a new view to the existing Account factsheet via the component BP_FACTSHEET. I've done this with my view in the Mainwindow, but the Mainwindow is not showing the InboundPlug for the view and therefore I can't add it to the config so that the new assignment block can be seen within the UI Factsheet. This is obviously in CRM 7.
Can you be of any help?.
Jason
Melanie,
Many thanks for your posting 'How to display a z-table in an assignment block'.
I have a very similar requirement where by I'm trying to add a new assignment block into the MainWindow of the component BP_FACTSHEET. In your doc you have create a seperate component obejct and then added it to the BP_HEAD component. However in my case I have created the new view directly in MainWindow of BP_FACTSHEET. I have manged to get it to use an internal table and have the code in place to load the data from ERP. However, I can not get the mainWindow to show the InboundPlug for the new view. Therefore I can't add the new view/assignment block in the config tool for this Factsheet.
Have you encountered this problem before?.
Jason
User | Count |
---|---|
12 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.