on 03-09-2007 12:33 PM
I have to read the selected value in a drop down box and then pass it on as an input to a BAPI in webdynpro ABAP.
I need to know how to read this value?
Thanks & regards,
Priyank
Hi.
The lead selection is set to the actual selected element by the system.
So you just have to get the corresponding node and call get_element( ) on it.
You also can add an actionhandler to the onSelect event in order to act on user selection directly.
Hope this helps.
Cheers,
Sascha
Message was edited by:
Sascha Dingeldey
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sascha,
I put the following code to read the context node and to call the get_element method.
****************
DATA:
node_et_years TYPE REF TO if_wd_context_node,
elem_et_years TYPE REF TO if_wd_context_element,
stru_et_years TYPE if_viewindice=>element_et_years ,
item_year LIKE stru_et_years-year.
navigate from <CONTEXT> to <ET_YEARS> via lead selection
node_et_years = wd_context->get_child_node( name = if_viewindice=>wdctx_et_years ).
@TODO handle not set lead selection
IF ( node_et_years IS INITIAL ).
ENDIF.
get element via lead selection
elem_et_years = node_et_years->get_element( ).
@TODO handle not set lead selection
IF ( elem_et_years IS INITIAL ).
ENDIF.
alternative access via index
Elem_Et_Years = Node_Et_Years->get_Element( Index = 1 ).
@TODO handle non existant child
if ( Elem_Et_Years is initial ).
endif.
get single attribute
elem_et_years->get_attribute(
EXPORTING
name = `YEAR`
IMPORTING
value = item_year ).
DATA:
node_et_indices TYPE REF TO if_wd_context_node,
elem_et_indices TYPE REF TO if_wd_context_element,
stru_et_indices TYPE if_viewindice=>element_et_indices ,
item_zzindice LIKE stru_et_indices-zzindice.
navigate from <CONTEXT> to <ET_INDICES> via lead selection
node_et_indices = wd_context->get_child_node( name = if_viewindice=>wdctx_et_indices ).
@TODO handle not set lead selection
IF ( node_et_indices IS INITIAL ).
ENDIF.
get element via lead selection
elem_et_indices = node_et_indices->get_element( ).
@TODO handle not set lead selection
IF ( elem_et_indices IS INITIAL ).
ENDIF.
alternative access via index
Elem_Et_Indices = Node_Et_Indices->get_Element( Index = 1 ).
@TODO handle non existant child
if ( Elem_Et_Indices is initial ).
endif.
get single attribute
elem_et_indices->get_attribute(
EXPORTING
name = `ZZINDICE`
IMPORTING
value = item_zzindice ).
data : lv_year type char4,
lv_indice type char3.
lv_year = item_year.
lv_indice = item_zzindice.
**now the call to the execute_BAPI method.
wd_comp_controller->execute_z_bapi_get_indices_ite(
i_indice = lv_indice " Char3
i_year = lv_year " Char4
).
******************
After doing this, when i select something on the drop down, it is giving me a strange error.
***
The following error text was processed in the system ERD : Could not find attribute VIEW_TABLE.1.DATA.1.MEINS
The error occurred on the application server pioerp01_ERD_00 and in the work process 0 .
The termination type was: RABAX_STATE
The ABAP call stack was:
Method: IF_WD_CONTEXT_ELEMENT~GET_ATTRIBUTE of program CL_WDR_CONTEXT_ELEMENT========CP
Method: IF_WD_CONTEXT_ELEMENT~GET_ATTRIBUTE_REF of program CL_WDR_CONTEXT_ELEMENT========CP
Method: GET_ATTRIBUTE_AS_INTERNAL of program CL_WDR_DATA_CONTAINER=========CP
Method: GET_REFERENCE_FIELD of program CL_WDR_DATA_CONTAINER=========CP
Method: GET_AND_FORMAT of program CL_WDR_DATA_CONTAINER=========CP
Method: GET_ATTRIBUTE_EXTERNAL of program CL_WDR_VIEW_ELEMENT_ADAPTER===CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L0STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L3STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L3STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L3STANDARD==============CP
***
I am nowhere using any attribute MEINS in my application and nor is there any view by the name VIEW_TABLE.
is there something i can do to resolve this???
Hi Priyank,
As far as my understanding is concerned you are using a dropdown box and then trying to retrieve 2 information, i mean field values, using LeadSelection but then point is that at a time only one entry would be selected so the other remains blank henc you get a null point reference in one of the cases.
So I would suggest you try to retireve only one of the information, the one that you are selecting on screen, and then execute your code.. it should work fine as per my understanding..
Hope this helps.
Regards,
Anoop
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
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.