主页 > CDN > > 正文

分布式数据库_华为云总裁_新注册优惠

浏览:

分布式数据库_华为云总裁_新注册优惠

Recently I had a requirement of using a file upload UI element within a FPM driven application. So I searched for blogs/discussions on this topic to understand it’s basic behavior but could not find any, which focusses mainly on this. So I thought of jotting the simple steps for using this element herein and evetually provide a demo for file upload  " Upload an excel file and populate the data in SFLIGHT table " . Hope this will definitely bring some help to the beginners in FPM like me.

Moreover, I will try to compare the File Upload UI element usage in simple Webdynpro and using it in FPM. This will help understanding the working behaviour of it in FPM.

System details: ECC 6.0 EHP6

Let us take a look back into the simple Webdynpro file upload UI element.

The main 3 attributes supplied by Web Dynpro:

a. DATA : This will populate the file content in datatype XSTRING

b. FILENAME: Will populate the filename of the file in datatype STRING

c. MIMETYPE: Will populate the extension of the file in datatype STRING

This 3 attributes or feature is used in WebDynpro to provide the functionality of file uplaod in application.

Let us now take a look how this functionality has been handled in FPM framework.

Step 1: We need to decide which type of FPM application based on our requirements. For this example, I will create a config for FPM_OVP_COMPONENT

Step 2: I will be using a generic UIBB to design the File Upload element. Below is the config ID for FPM_FORM_UIBB_GL2

Step 3: Let us look at the Feeder class for this config. The Feeder must implement interface IF_FPM_UIBB and IF_FPM_UIBB_FORM

Step 4: Define the structure which must be available for FLUID editor in the config.

Step 5: Let us do a bit of coding and implement the GET_DEFINITION method supplied by interface IF_FPM_FORM_UIBB

METHOD if_fpm_guibb_form~get_definition.

DATA: ls_action_definition TYPE fpmgb_s_actiondef,        ls_field_description TYPE fpmgb_s_formfield_descr.

** gs_form_fields type t_form_fields

eo_field_catalog ?= cl_abap_structdescr=>describe_by_data(                                              gs_form_fields ).

* File Name field description  ls_field_description–name = ‘FILE_NAME’.  ls_field_description–read_only = abap_true.

APPEND ls_field_description TO et_field_description.

* File Upload field description  ls_field_description–mandatory = abap_true.

CLEAR: ls_field_description–mandatory_ref.

ls_field_description–name = ‘FILE_UPLOAD’.  ls_field_description–mime_type_ref = ‘MIME_TYPE’.  ls_field_description–file_name_ref = ‘FILE_NAME’.

ls_field_description-default_display_type = ‘FU’.    "FU : File Upload"

APPEND ls_field_description TO et_field_description.

** Action Button definition  ls_action_definition–id = ‘UPLOAD’.  ls_action_definition–enabled = abap_true.

APPEND ls_action_definition TO et_action_definition.

ENDMETHOD.

Step 6: Let us design the config ID and use FLUID editor (simply nice in EHP6 )

Step 7: An action is assigned to the UPLOAD button. We will handle this action in the Feeder Class

Step 8: Let us handle the action UPLOAD in the GET_DATA menthod.

METHOD if_fpm_guibb_form~get_data.

CHECK io_event->mv_event_id = ‘UPLOAD’.

FIELD-SYMBOLS: TYPE t_form_fields,                 TYPE STANDARD TABLE,                 TYPE any,                 TYPE any.

DATA: lref_excel             TYPE REF TO cl_fdt_xl_spreadsheet,        lref_excel_core        TYPE REF TO cx_fdt_excel_core,        lref_data              TYPE REF TO data,        lt_worksheets          TYPE STANDARD TABLE OF string,        lv_ws_name             TYPE string,        lv_xstring             TYPE xstring,        ls_sflight             TYPE sflight,        lt_sflight             TYPE STANDARD TABLE OF sflight.

ASSIGN cs_data TO .

IF IS ASSIGNED.    lv_xstring = –file_upload.

TRY.

CREATE OBJECT lref_excel          EXPORTING            document_name = –file_name            xdocument     = lv_xstring.      CATCH cx_fdt_excel_core INTO lref_excel_core.        RETURN.    ENDTRY.

* Call method to get list of worksheets in the .xlsx file    IF lref_excel IS BOUND.      lref_excel->if_fdt_doc_spreadsheet~get_worksheet_names(           IMPORTING             worksheet_names = lt_worksheets ).

* Condition to check whether .xlsx file has any active worksheets

IF lt_worksheets IS NOT INITIAL.

*   Read active worksheet

READ TABLE lt_worksheets INDEX 1 INTO lv_ws_name.* Get reference of .xlsx file contents in the active worksheet        lref_data =        lref_excel->if_fdt_doc_spreadsheet~get_itab_from_worksheet(                                                   lv_ws_name ).

* Check if any blank excel file is uploaded by user        IF lref_data IS BOUND.          ASSIGN lref_data->* TO .

IF IS ASSIGNED.

LOOP AT ASSIGNING .              IF IS ASSIGNED.                IF sy–tabix = 1.                  CONTINUE.                ENDIF.

ASSIGN COMPONENT 1 OF STRUCTURE TO                  .                IF IS ASSIGNED.

ls_sflight–carrid = .                  UNASSIGN .

ENDIF.                ASSIGN COMPONENT 1 OF STRUCTURE TO                  .                IF IS ASSIGNED.

ls_sflight–carrid = .                  UNASSIGN .

ENDIF.                ASSIGN COMPONENT 2 OF STRUCTURE TO                  .                IF IS ASSIGNED.

ls_sflight–connid = .                  UNASSIGN .

ENDIF.                ASSIGN COMPONENT 3 OF STRUCTURE TO                  .                IF IS ASSIGNED.

ls_sflight–fldate = .                  UNASSIGN .

ENDIF.                ASSIGN COMPONENT 4 OF STRUCTURE TO                  .                IF IS ASSIGNED.

ls_sflight–price = .                  UNASSIGN .

ENDIF.                ASSIGN COMPONENT 5 OF STRUCTURE TO                  .                IF IS ASSIGNED.

ls_sflight–currency = .                  UNASSIGN .

ENDIF.                ASSIGN COMPONENT 6 OF STRUCTURE TO                  .                IF IS ASSIGNED.

ls_sflight–planetype = .                  UNASSIGN .

ENDIF.                ASSIGN COMPONENT 7 OF STRUCTURE TO                  .                IF IS ASSIGNED.

ls_sflight–seatsmax = .                  UNASSIGN .

ENDIF.                ASSIGN COMPONENT 8 OF STRUCTURE TO                  .                IF IS ASSIGNED.

ls_sflight–seatsocc = .                  UNASSIGN .

ENDIF.                ASSIGN COMPONENT 9 OF STRUCTURE TO                  .                IF IS ASSIGNED.

ls_sflight–paymentsum = .                  UNASSIGN .

ENDIF.                ASSIGN COMPONENT 10 OF STRUCTURE TO                  .                IF IS ASSIGNED.

ls_sflight–seatsmax_b = .                  UNASSIGN .

ENDIF.                ASSIGN COMPONENT 11 OF STRUCTURE TO                  .                IF IS ASSIGNED.

ls_sflight–seatsocc_b = .                  UNASSIGN .

ENDIF.                ASSIGN COMPONENT 12 OF STRUCTURE TO                  .                IF IS ASSIGNED.

ls_sflight–seatsmax_f = .                  UNASSIGN .

ENDIF.                ASSIGN COMPONENT 13 OF STRUCTURE TO                  .                IF IS ASSIGNED.

ls_sflight–seatsocc_f = .                  UNASSIGN .

ENDIF.

ls_sflight–mandt = sy–mandt.

APPEND ls_sflight TO lt_sflight.                CLEAR: ls_sflight.

ENDIF.

ENDLOOP.

IF lt_sflight IS NOT INITIAL.

MODIFY sflight FROM TABLE lt_sflight.              IF sy–subrc = 0.                ev_data_changed = abap_true.              ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDIF.    ENDIF.

ENDIF.

ENDMETHOD.

Step 9: Thats all!!!  Let us give it a dry run.

a. Run the FPM application. Browse and select an excel (.XLSX) file.

b.

c. Check the data in SFLIGHT

I hope that people new to FPM will find it useful.

Thanks to Debasis and Sumit for their support on my journey in FPM

Please share your suggestions if any.

That was really helpful Sounak ...

Excellent blog Sounak.

This is really informative and bought us up to date with the latest framework with respect to File upload control.

Regards

Raja Sekhar

I have a question.

I did it similarly but not getting any data in GET_DATA method(no data). In the config we should have "FILE_NAME" as input field (step 6), am I right?

Thanks,

Chandra Indukuri

Hi Chandra,

I guess your question will be answered by step 4 & 5 only

Regards

Sounak

Hello Sounak,

After doing this, the method GET_DATA dumps because of different data types.

Did not you come across this situation?

,购物返利app,个人用云服务器,全国大数据中心,中国云,云服务器
发表评论
验证码: 点击我更换图片

注:网友评论仅供其表达个人看法,并不代表本站立场。

热门文章

  • 谷歌云_mysql中间件_免费领
    谷歌云_mysql中间件_免费领

    谷歌云_mysql中间件_免费领

    现在工作场所正在发生重大变化。我们协作、计划项目和管理工作量的方式正在改变,如果企业没有做好准备,它们将很快被抛在后面。准确地理解是什么...

  • 域名交易_阿里云翼_企业级
    域名交易_阿里云翼_企业级

    域名交易_阿里云翼_企业级

    通常认为搅动器是一个漏水的桶。你有多少顾客?你损失了多少?你留了多少钱,漏了多少钱?让我们把顾客流失看作是导致医生就诊的原因,比如偏头痛...

  • 金山云_华为云台_怎么申请
    <strong>金山云_华为云台_怎么申请</strong>

    金山云_华为云台_怎么申请

    在我们发布通知(以前是Engage)后的四个月里,我们在后端做了大量的改进。大多数更新在UI中不可见。相反,我们的客户可能已经注意到他们发送的电子...

  • 云主机_深圳企业网站设计_评分榜
    <strong>云主机_深圳企业网站设计_评分榜</strong>

    云主机_深圳企业网站设计_评分榜

    更新:有本文的更新版本。阅读"RPA如何转换数据迁移"(2019年出版)。 在本文中,数据迁移被定义为将数据从旧的遗留系统移动到新的替换系统。通常,...

  • 域名备案_已备案未注册的域名_最新活动
    <strong>域名备案_已备案未注册的域名_最新活动</strong>

    域名备案_已备案未注册的域名_最新活动

    今天是Skype推出十年来的日子,Skype是一款免费的互联网通话应用,用户已超过3亿。Skype是一家来自爱沙尼亚的初创公司,来自点对点文件共享应用Kazaa的开...

云储存

更多 >
  • <strong>文件存储_腾讯云全面降价_评分榜</strong>
    文件存储_腾讯云全面降价_评分榜

    由于我不断寻找图标,我可以在我的UI5应用程序中使用,我创建了一个小网站作为图标作弊表。 你可以在这里找到它:UI5图标作弊表 这是一个简单和小的...

  • <strong>全站加速_access数据库后缀_新注册优惠</strong>
    全站加速_access数据库后缀_新注册优惠

    当然有。毕竟,Charles Seafoods Supply是菲律宾一些顶级餐厅的新鲜海鲜供应商。 但这家家族企业的经营方式绝对没有可疑之处。 Charles Seafoods Supply相信久经考...

云储存分布式数据库_动态网站建设_怎么样
云储存负载均衡_架设游戏服务器多少钱_最新活
云储存网站建设_阿里云错误代码_企业0元试用
云储存负载均衡_僵尸之地百度云_9元
云储存消息队列_珠海企业网站制作_优惠券