on 12-01-2010 10:21 AM
Hi,
I have a scnario to upload a image to DMS through BAPI_DOCUMENT_CREATE2.
I have created a input filed filed which can accept the path of file and i need to get that path and fill in the import parameters of the BAPI.but i when i tried to do that i am getting the below error:
The following error text was processed in the system DTE : Access via 'NULL' object reference not possible.
The error occurred on the application server Duetsp02_DTE_00 and in the work process 1 .
The termination type was: RABAX_STATE
The ABAP call stack was:
Method: ONACTIONUPLOAD of program /1BCWDY/9DDUX1XKYP1AS28KP86Q==CP
Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/9DDUX1XKYP1AS28KP86Q==CP
Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_VIEW========CP
Method: IF_WDR_ACTION~FIRE of program CL_WDR_ACTION=================CP
Method: DO_HANDLE_ACTION_EVENT of program CL_WDR_WINDOW_PHASE_MODEL=====CP
Method: PROCESS_REQUEST of program CL_WDR_WINDOW_PHASE_MODEL=====CP
Method: PROCESS_REQUEST of program CL_WDR_WINDOW=================CP
Method: EXECUTE of program CL_WDR_MAIN_TASK==============CP
Method: IF_WDR_RUNTIME~EXECUTE of program CL_WDR_MAIN_TASK==============CP
Method: HANDLE_REQUEST of program CL_WDR_CLIENT_ABSTRACT_HTTP===CP
And the code extracted from ST22 is:
514 DATA ls_context TYPE wd_this->Element_context.
515 DATA lv_file TYPE wd_this->Element_context-file.
516
517 * get element via lead selection
518 lo_el_context = wd_context->get_element( ).
519 * @TODO handle not set lead selection
520 IF lo_el_context IS INITIAL.
521 ENDIF.
522
523 * get single attribute
524 lo_el_context->get_attribute(
525 EXPORTING
526 name = `FILE`
527 IMPORTING
528 value = lv_file ).
529
530 DATA lo_nd_documentdata TYPE REF TO if_wd_context_node.
531
532 DATA lo_el_documentdata TYPE REF TO if_wd_context_element.
533 DATA ls_documentdata TYPE wd_this->Element_documentdata.
534 DATA lv_documenttype TYPE wd_this->Element_documentdata-documenttype.
535 DATA lv_username TYPE wd_this->Element_documentdata-username.
536 * navigate from <CONTEXT> to <DOCUMENTDATA> via lead selection
537 lo_nd_documentdata = wd_context->path_get_node( path = `BAPI_DOCUMENT_CREATE.IMPORTING
538
539 * @TODO handle non existant child
540 * IF lo_nd_documentdata IS INITIAL.
541 * ENDIF.
542
543 * get element via lead selection
>>>> lo_el_documentdata = lo_nd_documentdata->get_element( ).
545
546 lv_documenttype = 'DES:WS'.
547 * set single attribute
548 lo_el_documentdata->set_attribute(
549 name = `DOCUMENTTYPE`
550 value = lv_documenttype ).
551
Please let me know where has it gone wrong
Thanks,
Kishore.
Did you use the service call wizard to generate this code and the context? The importing element doesn't exist yet. You would need to create the initial element. However I think you would be better not even using a context node for the importing parameter of the element, but instead using controller attributes or method parameters (settings you can control on the service call wizard).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas,
Yes i have used service call and while creating it i made the importing parametes as context node/attributes.
can u tell me how to create initial element and u also mentioned to change them to controller attributes can u provide some code to populete the controller attributes.
Hi Bruce,
I tried to do the same what u have suggested and i am getting the same error again and abt the cordinality it is 1:1 cordinality,
do i have to change the cordinality please advise.
Thanks,
Kishore.
hi,
what is the cardinality of node documentdata.?
i think it is 0..1 or 0..n. There is no element created the time you are accessing that.
You do the following.
1. you can change the cardinality to 1..1 or 1..n. // in this way framework creates a empty element for you.
OR
2. You can create a element yourself at
IF lo_nd_documentdata IS INITIAL.
lo_el_documentdata = lo_nd_documentdata->create_element( static_attribute_values =
).
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.