cancel
Showing results for 
Search instead for 
Did you mean: 

How to get data from the GUIBB FORM on processing method PROCESS_EVENT?

former_member557553
Participant
0 Kudos

Hello Community,

one more question do I have.

I need to process some form data, that were entered by a user. One field was additional added via the method IF_FPM_GUIBB_FORM~GET_DEFINITION, so it is not in the BOL.

I listen to an FPM_EVENT in the IF_FPM_GUIBB_FORM~PROCESS_EVENT.

IF io_event->mv_event_id EQ 'FPM_SAVE_AND_BACK_TO_MAIN' OR io_event->mv_event_id = 'FPM_SAVE_1'.

  
     " Here I need to access the data from the GUINN FROM


  ENDIF.

How can I access to the data, entered in the GUIBB FORM?

Thank you and best regards, Christian

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

Can someone tell me how can I access to PROCESS_EVENT for an UIBB element?

former_member557553
Participant
0 Kudos

Hello,

I've just received a solution from my colleagues:

Here it is:

In the GET_DEFINITION Method of the Feederclass you define a field that will hold the MIME type of the uploaded file ('MIME_TYPE'). You also define a second field which will contain the uploaded file ('UPLOAD_FILE').

You than assign the 'MIME_TYPE' field to the MIME_TYPE_REF component of the field 'UPLOAD_FILE'.



      APPEND INITIAL LINE TO ET_FIELD_DESCRIPTION ASSIGNING <ls_new_field_descr>.

      <ls_new_field_descr>-NAME = 'MIME_TYPE'.
      <ls_new_field_descr>-LABEL_BY_DDIC = 'X'.
      <ls_new_field_descr>-VISIBILITY = '01'.
      <ls_new_field_descr>-DEFAULT_DISPLAY_TYPE = 'IN'.

      UNASSIGN <ls_new_field_descr>.
      APPEND INITIAL LINE TO ET_FIELD_DESCRIPTION ASSIGNING <ls_new_field_descr>.

      <ls_new_field_descr>-NAME = 'UPLOAD_FILE'.
      <ls_new_field_descr>-LABEL_BY_DDIC = 'X'.
      <ls_new_field_descr>-VISIBILITY = '02'.
      <ls_new_field_descr>-DEFAULT_DISPLAY_TYPE = 'FU'.
      <ls_new_field_descr>-MIME_TYPE_REF = 'MIME_TYPE'.

BR, Christian

Edited by: Christian Eck on Dec 13, 2011 1:08 PM

Former Member
0 Kudos

Hello

former_member557553
Participant
0 Kudos

Hello Yupeng,

I would like to help you, but I am no longer in this topic and have no access to the source code. However I will contact some colleagues of my former department. Maybe they can help you.

BR, Christian

J_R
Advisor
Advisor
0 Kudos

Hello Yupeng,

Dragos has already written above how you can access the form data. It will be provided via method IF_FPM_GUIBB_FORM->FLUSH to your feeder. The relevant method parameter is IS_DATA. Be aware of that the feeder method FLUSH (and even method PROCESS_EVENT) is not called when the form is displayed the first time in your application. In this case, the feeder method GET_DATA is called directly. However, the form data is passed to this feeder method as well; the relevant parameter has the name CS_DATA.

Best regards,

Jens

Former Member
0 Kudos

Hello Jens and Christian,

Thanks very much for your help.

Could you help me check where the problem is ? My detail step is as below:

1.      Structure     'S_TR_FILE' ,  which  include component  'MIME_TYPE' with data type 'String'  and 'UPLOAD_FILE' with data type 'String'.

2.    IF_FPM_GUIBB_FORM~GET_DEFINITION

    DATA: lo_structdescr    TYPE REF TO cl_abap_structdescr.
    FIELD-SYMBOLS: <ls_new_field_descr> TYPE fpmgb_s_formfield_descr.


    lo_structdescr  ?= cl_abap_typedescr=>describe_by_name( 'S_TR_FILE' ).
    eo_field_catalog = lo_structdescr.

    APPEND INITIAL LINE TO et_field_description ASSIGNING <ls_new_field_descr>.

    <ls_new_field_descr>-name = 'MIME_TYPE'.
    <ls_new_field_descr>-label_by_ddic = 'X'.
    <ls_new_field_descr>-visibility = '01'.
    <ls_new_field_descr>-default_display_type = 'IN'.

    UNASSIGN <ls_new_field_descr>.
    APPEND INITIAL LINE TO et_field_description ASSIGNING <ls_new_field_descr>.

    <ls_new_field_descr>-name = 'UPLOAD_FILE'.
    <ls_new_field_descr>-label_by_ddic = 'X'.
    <ls_new_field_descr>-visibility = '02'.
    <ls_new_field_descr>-default_display_type = 'FU'.
    <ls_new_field_descr>-mime_type_ref = 'MIME_TYPE'.

3.  After the OVP page is displayed, I select a xlsx file in 'UPLOAD_FILE', and click "upload" button(toolbar on the top  page) , I can't get any data from IS_DATA in flush method or CS_DATA in Get_DATA.

Thanks& Best Regards,

Yupeng

J_R
Advisor
Advisor
0 Kudos

Hello Yupeng,

for a file upload you need three fields in the field catalog and in the field description. Let's have a look at the following example:

1) Field DATA, Type: RAWSTRING

2) Field FILENAME, Type: STRING

3) Field MIMETYPE, Type: STRING

The field description of field DATA must reference field FILENAME via component FILE_NAME_REF and MIMETYPE via component MIME_TYPE_REF of the field description.

In the form configuration you have to configure the feeder field DATA with display type 'File Upload'.

If you run your application and select a file for upload via the 'Browse' button of the File Upload UI element the file name and the mime type (and of course the file data as well) will be passed from the GUIBB Form to the FLUSH or GET_DATA method in parameter IS_DATA and CS_DATA, respectively.

Best regards,

Jens

Former Member
0 Kudos

Hello,

After enhancing the method GET_DEFINITION, there is a short dump in GET_DATA method because of different data structures. Does the method GET_DATA need to be enhanced as well?

Thank you,

Javier

J_R
Advisor
Advisor
0 Kudos

Hi Javier,

without further information about your feeder class coding and the dump it's really difficult to help. The data structure passed in method parameter CS_DATA of method GET_DATA corresponds to the field catalog that you have provided in method GET_DEFINITION. If you have extended the field catalog in and enhancement of GET_DEFINITION the original coding in GET_DATA must either be robust enough to deal with the extended structure or you have to enhance method GET_DATA as well.

Best regards,

Jens

Former Member
0 Kudos

Hi Jens and thank you for your quick response.

I have enhanced GET_DEFINITION method of the standard class as described by Christian above.

Floor Plan Manager configuration is updated by adding these file fields. No problem so far.

But when I run the application and the method GET_DATA is triggered, one of the deeper methods that are spawned is /PLMU/CL_FRW_G_CONTEXT_SINGLE-GET_DATA:

Here cs_data holds my new custom fields but mr_data_buffer does not have them, hence when moving data from <ls_data> to cs_data it dumps as they have different structures.

FIELD-SYMBOLS:

     <ls_data>                TYPE           any.

   IF ct_data IS SUPPLIED.

     ASSERT 1 = 0. "Not supported!

   ENDIF.

   ASSIGN mr_data_buffer->* TO <ls_data>.

   cs_data = <ls_data>.

   ev_data_changed = mv_data_changed.


Do I need to enhance method GET_DATA ?


Thank you very much for your help.

Javier

J_R
Advisor
Advisor
0 Kudos

Hi Javier,

the best way would be to extend the data structure of MR_DATA_BUFFER as well in a way that it contains the same fields as your field catalog. The, the statement cs_data = <ls_data> should not dump anymore.

Best regards,
Jens

Dragoș
Employee
Employee
0 Kudos

Is it really necessary (for the purpose above) to evaluate change log? FLUSH gives also IS_DATA - which can be copied as a member attribute in the feeder class. Almost all feeders do it.

The evaluation of change log is useful especially if one wants to react to some chages (e.g. to delta-update the backend).

Former Member
0 Kudos

`There are example applications available in apb_fpm packages. Browse them and see its being done there. Good for learning.

hendrik_brandes
Contributor

Hi Christian,

the Interface IF_IF_FPM_GUIBB_FORM provides the FLUSH-Method. When you have changes on your form, this method takes the changelog ( a table with the real changed data ) and the complete data structure.

For example:

method IF_FPM_GUIBB_FORM~FLUSH.

field-symbols:

<changelog> type FPMGB_S_CHANGELOG.

read table it_change_log assigning <changelog> with key name = 'YOURNEWFIELD'.

if sy-subrc = 0.

  • Your field has beend changed. Perform you own coding.

endif.

endmethod.

{/code}

Kind regards,

Hendrik