Professional Documents
Culture Documents
CRM WebUI
SAP CRM Technical Consultants sometimes comes across a requirement from the clients on business
scenarios where they are asked to upload a File from the Presentation Server ( e.g Desktop, PC,
Laptop, etc. ) into Application Server i.e SAP CRM System. This may be due a wide range of business
requirements ranging from Mass Operations like bulk upload of Business Partners in the system and
mass upload of data from external sources for Lead Generation. Based on the business case either a
plain and simple flat file is used or a CSV File can also be fed into. Text File has the flexibility of
platform independence and can be used and downloaded across multiple environments.
In the sample code below, either a CSV File can be used or a text file can also be used. I have created
my own Z Component and have used the SAP Standard Component - GS_FILE_UPLOAD as a
component usage in my component. Here the only intention is to upload a table of Business Partners
into the system.
Assumptions
I have made the following assumptions regarding the technical skill which I feel is a prerequisite in
order to execute the sample example provided in this document.
Add or create a New Node with the structure already defined as shown below and then complete the
subsequent steps to complete the view creation. Then add the view into the Runtime Repository.
Then complete the configuration by adding the fields in the result list.
Add two buttons for upload and clearing the uploaded data as shown below:
If you have an already existing Web UI Component, then in order to upload Text/CSV Excel Files in SAP
CRM Web Client UI the following steps needed to be performed. We will be using an already existing
Web UI Component as component usage and there is no further requirement of JavaScript Coding. The
excel files that need to be uploaded must be of type CSV comma separated values excel. In
additional plain text files can also be used. The uploaded data is stored as content in a string.
Use an already existing SAP CRM Web UI component
Define the following Popup Access Interface in the Implementation Class of the View
In the other Method EH_ONUPLOAD_POPUP_CLOSED put the following piece of code. Here based on
the content we need to classify the data into appropriate structure.
METHOD eh_onupload_popup_closed.
TYPES: BEGIN OF l_ty_attr_struct,
businesspartner TYPE bu_partner,
partnerdescription TYPE bu_descrip_long,
END OF l_ty_attr_struct.
DATA:l_v_file_content
TYPE string,
l_i_file_content
TYPE stringtab,
l_v_file_type
TYPE string,
l_v_file_name
TYPE string,
l_o_outputnode
TYPE REF TO cl_bsp_wd_context_node,
l_o_collection_wrapper TYPE REF TO cl_bsp_wd_collection_wrapper,
l_if_property
TYPE REF TO if_bol_bo_property_access,
l_o_msg_service
TYPE REF TO cl_bsp_wd_message_service,
l_i_bp
TYPE zbupa_desc,
l_wa_bp
TYPE zbupa_desc,
l_v_status
TYPE zmember_status,
l_o_entity
TYPE REF TO cl_crm_bol_entity,
l_i_return
TYPE bapiret2_t,
l_wa_return
TYPE bapiret2,
l_v_struct_ref
TYPE REF TO zaccount_upload1,
l_o_value_node
TYPE REF TO cl_bsp_wd_value_node,
l_if_bo_coll
TYPE REF TO if_bol_bo_col,
l_v_fired_plug
TYPE
seocmpname.
*
*
l_if_bo_coll->add( l_o_value_node ).
l_if_bo_coll->if_bol_bo_col_multi_sel~mark( EXPORTING iv_bo = l_o_value_node ).
UNASSIGN <l_fs_wa_data>.
ENDLOOP.
ENDIF.
ENDIF.
me->typed_context->exupd2->collection_wrapper->set_collection( l_if_bo_coll ).
me->typed_context->exupd2->collection_wrapper->publish_current( ).
*
*
ELSE.
We assume an incorrect file type: it's neither a plain text file nor a .csv file
Therefore -> raise an error message
l_o_msg_service ?= me->view_manager->get_message_service( ).
l_o_msg_service->add_message( iv_msg_type
= 'E'
iv_msg_id
= 'CRM_UI'
iv_msg_number
= '018' ). "#EC NOTEXT
ENDIF.
WHEN OTHERS.
ENDCASE.
ENDMETHOD.
Add the following lines of code in the HTML file of the view
Click on Upload