on 09-07-2007 2:20 PM
Hi Gurus,
I have two columns(date and status) in table view in WDP for Abap application. In the corresponding source table, if date is 00/00/0000, then I need to populate an approve button in the status column of table view, otherwise the actual date has to be populated from the table. After populating the approve button, if its clicked the system date should be displayed in the date column and the approve button should be disappeared.
You have not mentioned what you want in the button column when the date is some valid date. I assume you dont want anything in that case. Do some minor changes if that is not the case.
In your context node, have two attributes, date of type DATS and visible type char01. With the help of your API, get the node data in an internal table. Loop through this, and when date = 00/00/0000, set the visible attribute to true, else set it to false. So your button will be visible only if the date is initial.
In your UI, create a table with the date column bound to the date attribute. Create another column with the button as cell editor, and bind the 'visible' property of the button to the Visible context attribute. Statically define the button text as 'Approve'. In the onClick event of the button, use the following code:
data: lr_element type ref to if_wd_context_element.
lr_element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).
lr_element->set_attribute( name = 'DATE' value = sy-datum ).
lr_element->set_attribute( name = 'DATE' value = abap_false ).
This will set the date field to the current date and also make the button invisible.
Hope this helps.
Regards
Nithya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
The visible attribute can be of type wdui_visibility or simply char01. If it is of type wdui_visibility, you should set it to '01' or '02' depending on whether you want to make it visible or invisible. If it is of type char01, just set to abap_true or abap_false. Both will work.
Regards
Nithya
Hi Nithya,
first am trying to set the visible to true for all rows, but,I'm getting an error "Access via 'NULL' object reference not possible" in the below code. Please suggest me how to fix it. I have declared wdevent as type ref to CL_WD_CUSTOM_EVENT. Is that true?
Here is the code.
data:
Node_Plan type ref to If_Wd_Context_Node,
Elem_Plan type ref to If_Wd_Context_Element,
Stru_Plan type If_View_Plan_Table=>Element_Plan ,
wdevent type ref to CL_WD_CUSTOM_EVENT,
Item_VISIBLE like Stru_Plan-VISIBLE.
navigate from <CONTEXT> to <PLAN> via lead selection
Node_Plan = wd_Context->get_Child_Node( Name = IF_VIEW_PLAN_TABLE=>wdctx_Plan ).
@TODO handle not set lead selection
if ( Node_Plan is initial ).
endif.
get element via lead selection
Elem_Plan = Node_Plan->get_Element( ).
@TODO handle not set lead selection
if ( Elem_Plan is initial ).
endif.
Elem_Plan = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).
get single attribute
Elem_Plan->set_attribute(
exporting
Name = `VISIBLE`
Value = abap_true ).
Thanks,
David.
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
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.