on 04-06-2011 2:19 PM
Hi Experts,
I have created WD4A program. This program calls RFC. The output of RFC has to populate a UI table. THe different cells of the table should have different color based on data.
I have gone through following link:
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/707fb792-c181-2d10-61bd-ce15d58b5cf1
The above link fetches data from directly from table. Then it passes the data into internal table.
If I am using RFC, then how I can insert data of RFC into a internal table in WD4A program (se80 In drop down Web Dynpro Comp / Intf)
My motto is to have table ouput whose different cells should have different color based on data.
Please help.
Regards,
Gary
Edited by: Jason Lax on Dec 28, 2011 2:52 PM (Fixed broken link)
Hi,
Follow like this..
Click on component name-> right click -> create service call-> you use your BAPI or FM i think you know this.
it will create one execute method.
Go to view - > do mapping.
Create Table ui element. bind source property of table to context changing parameter( which is created by service call ).
For Ex: your BAPI or FM is using ITAB as table, that itab you get as changing parameter in context.
create any button or in WDDOINIT method.
call execute method of component controller. or use wizard to create coding.
Hope it helps..
Cheers,
Kris.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kris, Baskaran, Experts,
Thanks a lot.
I have called the FM using service call. I have bound the context with UI table. The table is getting populated. But this does not cater to my requirement.
Now I have to color the different cells of table. For this purpose, I have to create 'new context'. This 'new context' should NOT be mapped to FM. I have to populate table using 'new context'.
I have to read the data from context of FM, do some modification for coloring the cells and then transfer into 'new context'. The 'new context' has to populate the table.
My challenge is how to read the data from context of FM, convert into internal table, take into in loop.
Please refer following link. This link suggests creation of new context.
Pls help.
Regards,
Gary
HI.
You can read the Context node which has data from the FM as a table.
Somthing like this will work.
DATA lo_nd_main TYPE REF TO if_wd_context_node.
DATA lt_main TYPE wd_this->elements_main. "This is a internal table of whatever is your context node.
navigate from <CONTEXT> to <MAIN> via lead selection
lo_nd_main = wd_context->get_child_node( name = wd_this->wdctx_main )."Pass the name of the context node here
lo_nd_main->get_static_attributes_table( IMPORTING table = lt_main ).
Thanks,
Aditya.
Hi Aditya, Experts,
Thanks. Could you please let me know how to define internal table elements_main. If possible please provide me the complete code. Thanks in advance.
DATA lo_nd_main TYPE REF TO if_wd_context_node.
DATA lt_main TYPE wd_this->elements_main. "This is a internal table of whatever is your context node.
* navigate from <CONTEXT> to <MAIN> via lead selection
lo_nd_main = wd_context->get_child_node( name = wd_this->wdctx_main )."Pass the name of the context node here
lo_nd_main->get_static_attributes_table( IMPORTING table = lt_main ).
Regards,
Gary
Hi Aditya,
Thanks. My code looks like as shown below. Please let me know how I can move the data of node RESULT_FINAL to internal table itab.
types: begin of str,
aa type ZMSS_ATT_OVE,
end of str.
data itab type table of str.
DATA lo_nd_zep_mss_team_calenda TYPE REF TO if_wd_context_node.
DATA lo_nd_changing_1 TYPE REF TO if_wd_context_node.
DATA lo_nd_result_final TYPE REF TO if_wd_context_node.
DATA lo_el_result_final TYPE REF TO if_wd_context_element.
DATA ls_result_final TYPE wd_this->element_result_final.
* navigate from <CONTEXT> to <ZEP_MSS_TEAM_CALENDA> via lead selection
lo_nd_zep_mss_team_calenda = wd_context->get_child_node( name = wd_this->wdctx_zep_mss_team_calenda ).
* navigate from <ZEP_MSS_TEAM_CALENDA> to <CHANGING_1> via lead selection
lo_nd_changing_1 = lo_nd_zep_mss_team_calenda->get_child_node( name = wd_this->wdctx_changing_1 ).
* navigate from <CHANGING_1> to <RESULT_FINAL> via lead selection
lo_nd_result_final = lo_nd_changing_1->get_child_node( name = wd_this->wdctx_result_final ).
* @TODO handle not set lead selection
IF lo_nd_result_final IS INITIAL.
ENDIF.
* get element via lead selection
lo_el_result_final = lo_nd_result_final->get_element( ).
* @TODO handle not set lead selection
IF lo_el_result_final IS INITIAL.
ENDIF.
* alternative access via index
* lo_el_result_final = lo_nd_result_final->get_element( index = 1 ).
* @TODO handle non existant child
* IF lo_el_result_final IS INITIAL.
* ENDIF.
* get all declared attributes
lo_el_result_final->get_static_attributes(
IMPORTING
static_attributes = ls_result_final ).
Regards,
Gary
What happened to your table? It looks like you are just retrieving the structure.
This... DATA ls_result_final TYPE wd_this->element_result_final.
Really should be something like this...DATA lt_result_final TYPE wd_this->elements_result_final.
Once you call the get_static_attributes_table method...its just a matter of looping through there and appending your internal table with the desired data.
Edited by: Josh Dunlap on Apr 7, 2011 8:33 PM
OK, so you are not trying to retrieve an internal table from your function call? You are retrieving a structure? If your function call returns just a record, I am not sure how you are populating a table with multiple records.
Well if you want to just add the structure to an internal table, the get_static_attributes method will return just one record. Then you could just append the values to your internal table.
Edited by: Josh Dunlap on Apr 7, 2011 10:32 PM
Hi Experts,
I have resolved the issue. I have created WD4A program. This WD4A program calls the RFC.
The RFC has a structure as export parameters called 'RESULT_FINAL'. I have altered the associated type of this table export parameter. I added Component 'Color' of component type 'WDUI_TABLE_CELL_DESIGN'.
In the RFC I have added some code. The code is as below:
loop at it_t1.
select pernr from pa0000 into table it_t2 where pernr = it_t1-pernr and stat2 ='3'
and begda <= sy-datum AND endda >= sy-datum.
if sy-subrc = 0.
result_final-org_unit = result_objec-objid.
result_final-pernr = it_t1-pernr.
result_final-name = it_t1-name.
result_final-color = '02'. append result_final.
endif.
endloop.
The line result_final-color = '02'.
code returns Color.
In the WD4A program, I have changed the Cell Design property of selected table coloumn to Color.
This resolved the issue.
Thanks every one for the reply.
I have added above information for other SDN users.
I am closing this thread,
Regards,
Gary
Hallo Gary,
i hope you mean " I have created WD4A program" as you have created a WebDynpro component.
There is a tool in WebDynpro browser in se80.
Just select your component and right click->create->service call
Use this tool to generate the call to FM . This will make sure that you get the context and call to be FM.
Bind this context to the UI TABLE as explained in the link you already have.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.