on 01-06-2011 9:20 AM
Hi friends,
I have seen lot of threads on uploading data comming in Excel file.
I have requirement where the data is Comming in Notepad.
Please help me wether we can upload Notepad in webdynpro abap.
if possible some sample code or links.
Regards,
Xavier.P
And for uploading the notepad and reading its content is very easy.
1. create one fileupload Ui element in the view and one button.
2. create a context attribute of type Xstring and bind it to File UPload UI element's Data property.
3. then create one action for the buton and write the following code in teh event handler of the action.
Data: l_xstring type xstring.
data: l_string type string.
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_datasource LIKE ls_context-datasource.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
* get single attribute
lo_el_context->get_attribute(
EXPORTING
name = `DATASOURCE` " datasource is the name of the context attribute bound to FIleUpload
IMPORTING
value = lv_datasource ).
l_xstring = lv_datasource.
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
* FROM_CODEPAGE = '8500'
IN_XSTRING = l_xstring
* OUT_LEN =
IMPORTING
OUT_STRING = l_string
.
This way now the variable l_string will have thave the content of the notepad in its value.
You can use it for doing whatever you want.
Thanks,
Sarbjeet Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is really no such thing as a record in notepad. I assume you want to simply split the string at the carrage return/linefeed.
Use the ABAP SPLIT command. You can do a SPLIT AT CL_ABAP_CHAR_UTILITIES=>CR_LF INTO TABLE. This will split each line into a separate record in an ABAP internal table.
Actully its the other way around. the txt file you can upload but xls fiel you need to convert them to txt to upload them.
Thanks
Sarbjeet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
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.