Hi,
I've followed some tutorials and now created a webdynpro application that gets the carriername form the carrier-id.
It works good.
Now i want to add a message when no carriername is found. I've added a field on my view to receive the message and i've added the lines to the assist method, but i'm struggling to get it from there to the field.
In the layout it has an inputfield for carrier ID, a button to search, an outputfield for the carrier name, and an output for the message.
method ONACTIONSEARCH_AIRL_NAME .
DATA lo_nd_zz_carrier TYPE REF TO if_wd_context_node.
DATA lo_el_zz_carrier TYPE REF TO if_wd_context_element.
DATA ls_zz_carrier TYPE wd_this->element_zz_carrier.
DATA lv_id LIKE ls_zz_carrier-carrid.
DATA lv_name LIKE ls_zz_carrier-carrname.
* navigate from <CONTEXT> to <ZZ_CARRIER> via lead selection
lo_nd_zz_carrier = wd_context->get_child_node( name = wd_this->wdctx_zz_carrier ).
lo_el_zz_carrier = lo_nd_zz_carrier->get_element( ).
* get single attribute
* first determine the carrier id from the value we fill on screen.
lo_el_zz_carrier->get_attribute(
EXPORTING
name = 'CARRID'
IMPORTING
value = lv_id ).
* then use the assistance class method to get the carrier name
wd_assist->GET_CARRIERNAME(
EXPORTING
CARR_ID = lv_id
IMPORTING
CARR_NAME = lv_name ).
* now export the carrier name to the view and will be shown in the output field
lo_el_zz_carrier->Set_attribute(
EXPORTING
NAME = 'CARRNAME'
value = lv_name
).
endmethod.
method GET_CARRIERNAME.
SELECT SINGLE CARRNAME FROM SCARR
INTO CARR_NAME
WHERE CARRID = CARR_ID.
IF CARR_NAME IS INITIAL.
MESSAGE = 'NOTHING FOUND'.
ENDIF.
endmethod.
My question is what must i add to the method ONACTIONSEARCH_AIRL_NAME to pass my 'NOTHING FOUND' message from the assist class to the view?
I must declare it obviously but not sure how to declare an attribute from the context.
I must do a SET_ATTRIBUTE i think at the end but how to do that.
Thx for the input.
Regards
Robert