on 11-26-2014 10:28 AM
Hi Experts,
my issue is..when i restart my sap ides system the uploaded image in ztable is not displaying in the alv table.
i should explain briefly.
Scenario 1) When i start my application. i have one alv table with some values (details of players).
2) then i will multiselect the rows and press mutliselect button at the top of the table
3) after i can able to see values which i selected in the another alv table in the same page.
4) when i restart my sap ides..the images are disappered.
i understand there is some cache issue ...i dont know how to resolve this..am using file upload ui element to upload images to ztable. the following code is used to upload images. and also please tell me in real time..what is procedure to upload images??? in this scenario.
data:
Node_Img_Upload type ref to If_Wd_Context_Node,
Ele_Img_Upload type ref to If_Wd_Context_Element,
ls_Img_Upload type wd_this->Element_Img_Upload .
data:
lv_file_name TYPE string,
lv_lfname TYPE chkfile,
lv_ext TYPE sdba_funct,
lv_file_content TYPE xstring,
lv_guid TYPE guid_32,
lv_host TYPE string,
lv_port TYPE string,
lv_protocol TYPE string,
lv_url TYPE string.
DATA:
lo_api_controller TYPE REF TO if_wd_controller,
lo_message_manager TYPE REF TO if_wd_message_manager,
lv_msg_text TYPE string,
lv_msg_type TYPE i.
Data cached_response TYPE REF TO if_http_response.
Data ls_img type zcri_india.
***********************88***********************************************
*msg intialize
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
**********************
* IF wd_this->gv_last_id IS INITIAL.
* wd_this->gv_last_id = 1.
* ENDIF.
Node_img_upload = wd_context->get_child_node( Name = IF_INDIA_PLAYERDETAILS=>wdctx_Img_Upload ).
ele_img_upload = Node_img_upload->get_element( ).
ele_img_upload->get_static_attributes(
IMPORTING
static_attributes = ls_img_upload ).
IF ls_img_upload-name IS INITIAL.
lv_msg_text = 'Select any Image then click save button'.
lv_msg_type = 2.
ELSE.
CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH'
EXPORTING
FULL_NAME = ls_img_upload-name
IMPORTING
STRIPPED_NAME = lv_file_name
* FILE_PATH =
EXCEPTIONS
X_ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
lv_msg_text = 'System error: while reading file location'.
lv_msg_type = 3.
ELSE.
SHIFT lv_file_name LEFT DELETING LEADING '0'.
lv_lfname = lv_file_name.
CALL FUNCTION 'SPLIT_FILENAME'
EXPORTING
LONG_FILENAME = lv_lfname
IMPORTING
* PURE_FILENAME =
PURE_EXTENSION = lv_ext.
TRANSLATE lv_ext TO LOWER CASE.
IF lv_ext = 'png' OR lv_ext = 'gif' OR lv_ext = 'jpeg' OR lv_ext = 'jpg' OR lv_ext = 'bmp'.
CREATE OBJECT cached_response
TYPE
cl_http_response
EXPORTING
add_c_msg = 1.
lv_file_content = ls_img_upload-data.
cached_response->set_data( lv_file_content ).
cached_response->set_header_field( name = if_http_header_fields=>content_type
value = 'image/jpeg' ).
* Create a unique URL for the object
CALL FUNCTION 'GUID_CREATE'
IMPORTING
EV_GUID_32 = lv_guid.
***Set the Response Status
cached_response->set_status( code = 200 reason = 'OK' ).
***Set the Cache Timeout - 60 seconds - we only need this in the cache
***long enough to build the page and allow the IFrame on the Client to request it.
cached_response->server_cache_expire_rel( expires_rel = 360 ).
CALL METHOD CL_HTTP_SERVER=>IF_HTTP_SERVER~GET_LOCATION
EXPORTING
SERVER = cl_wdr_task=>server
IMPORTING
HOST = lv_host
PORT = lv_port
OUT_PROTOCOL = lv_protocol.
CONCATENATE
lv_protocol '://' lv_host ':' lv_port '/sap/bc/webdynpro/sap/'
lv_guid '.JPG'
INTO lv_url.
cl_http_server=>server_cache_upload( url = lv_url
response = cached_response ).
* set single attribute
ele_img_upload->set_attribute(
name = `LINK`
value = lv_url ).
ls_img-image_cri = ls_img_upload-data.
data:
Node_India type ref to If_Wd_Context_Node,
Elem_India type ref to If_Wd_Context_Element,
lS_India type If_India_Playerdetails=>Element_India ,
lS_India1 type If_India_Playerdetails=>Element_India ,
lt_India type If_India_Playerdetails=>Elements_India .
* navigate from <CONTEXT> to <INDIA> via lead selection
Node_India = wd_Context->get_Child_Node( Name = IF_INDIA_PLAYERDETAILS=>wdctx_India ).
* @TODO handle not set lead selection
if ( Node_India is initial ).
endif.
* get element via lead selection
Elem_India = Node_India->get_Element( ).
* @TODO handle not set lead selection
if ( Elem_India is initial ).
endif.
* alternative access via index
* Elem_India = Node_India->get_Element( Index = 1 ).
* @TODO handle non existant child
* if ( Elem_India is initial ).
* endif.
* get all declared attributes
Elem_India->get_Static_Attributes(
importing
Static_Attributes = ls_India1 ).
node_India->get_Static_Attributes_table(
IMPORTING
table = lt_India ).
read table lt_india into ls_india WITH KEY name = ls_india1-name.
ls_india-image_cri = ls_img_upload-data.
ls_india-url = lv_url.
modify zcri_india from ls_india.
Do you really restart your SAP System? Or just refresh your Browser?
If the data are saved to you Z* table, your upload is correct.
Can you post your code where you read your z* table?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chris,
Thankyou for your quick reply.
when i refresh the browser it is fine.but when i stop the sap ides server( demo server ) and again start the application.. the issue exists..
the following code helps to read ztable
data:
Node_India type ref to If_Wd_Context_Node,
Elem_India type ref to If_Wd_Context_Element,
it_india type wd_this->elements_india.
* navigate from <CONTEXT> to <INDIA> via lead selection
Node_India = wd_Context->get_Child_Node( Name = 'INDIA' ).
CALL METHOD WD_ASSIST->GET_ITAB_INDALV
IMPORTING
IT_INDIA_AC = it_india
.
node_india->bind_table( it_india ).
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
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.