cancel
Showing results for 
Search instead for 
Did you mean: 

File Upload in WebDynpro ABAP

Former Member
0 Kudos

HI,

Could someone please tell me how to design a screen with a file upload button that pops up a file browser and then the selected file is saved on the server in a fixed location.

Regards,

Shobhit

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member196517
Contributor
0 Kudos

there is a control fileupload which allows you to add files thru machine.. have you tried that.. lemme know if you want code for it.. i have already done this..

Anuj

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi Shobhit,

You have File Upload Control, it helps you in getting the data from the clients machine to your context attributes as an xstring or binary.

you can now need to write the code to store this file where ever you want.

for file upload control you can look at WDR_TEST_EVENTS component.

Regards

Abhimanyu L

Former Member
0 Kudos

Thanks for the answer.

Once a file has been selected via the file browser UI element, I need to store the file in the local server at a fixed path. Can you please tell me the code to implement this.

Regards,

Shobhit

former_member196517
Contributor
0 Kudos

I uploaded archive documents with the help of this function .... ARCHIV_CREATE_TABLE...

can you please check this code......

**************************************************************

            • Upload Archiv link Documents

*********

            • Returns a success or fail-message

******

******

******************************************************************

      • Declare data

DATA: iv_arc_object TYPE toaom-ar_object,

iv_object_id TYPE sapb-sapobjid,

iv_sap_object TYPE toaom-sap_object,

iv_document TYPE xstring,

iv_doc_type TYPE toadd-doc_type,

lv_uploaded TYPE boolean.

      • excpetion handling

DATA: message_log_text TYPE bal_s_msg,

lv_msg TYPE string. "#EC NEEDED

      • fill params

iv_arc_object = arc_object.

iv_object_id = object_id.

iv_sap_object = sap_object.

iv_document = document.

iv_doc_type = doc_type.

      • create table

CALL FUNCTION 'ARCHIV_CREATE_TABLE'

EXPORTING

ar_object = iv_arc_object

object_id = iv_object_id

sap_object = iv_sap_object

document = iv_document

doc_type = iv_doc_type

  • IMPORTING

  • OUTDOC =

EXCEPTIONS

error_archiv = 1

error_communicationtable = 2

error_connectiontable = 3

error_kernel = 4

error_parameter = 5

error_user_exit = 6

error_mandant = 7

OTHERS = 8.

IF sy-subrc <> 0.

"We donot need the below mentioned message.

  • MESSAGE ID 'RPLM_QIMT' TYPE 'E' NUMBER '016'

  • WITH sap_object object_id arc_object INTO lv_msg.

      • fill error message parameters

message_log_text-msgty = sy-msgty.

message_log_text-msgid = sy-msgid.

message_log_text-msgno = sy-msgno.

message_log_text-msgv1 = sy-msgv1.

message_log_text-msgv2 = sy-msgv2.

message_log_text-msgv3 = sy-msgv3.

      • log error message

CALL METHOD log_obj->addmessagetolog

EXPORTING

message_data = message_log_text

protocol_handle = log_obj->protocol_handle.

lv_uploaded = abap_false.

ELSE.

MESSAGE ID 'RPLM_QIMT' TYPE 'I' NUMBER '015'

WITH sap_object object_id arc_object INTO lv_msg.

      • fill error message parameters

message_log_text-msgty = sy-msgty.

message_log_text-msgid = sy-msgid.

message_log_text-msgno = sy-msgno.

message_log_text-msgv1 = sy-msgv1.

message_log_text-msgv2 = sy-msgv2.

message_log_text-msgv3 = sy-msgv3.

      • log error message

CALL METHOD log_obj->addmessagetolog

EXPORTING

message_data = message_log_text

protocol_handle = log_obj->protocol_handle.

lv_uploaded = abap_true.

ENDIF.

      • return

uploaded = lv_uploaded.

Anuj