cancel
Showing results for 
Search instead for 
Did you mean: 

Web Dynpro ABAP: Assigning of Conversion Exits in ALV

0 Kudos

Hi,

We are currently developing a generic data display application using ALV technology in Web Dynpro ABAP. "Generic" means that the structure of the data is created dynamically during runtime (using RTTS) and that even the contained data elements are created dynamically without any relation to DDIC. The generation is based on metadata like field name, data type, length, decimals, conversion exit.

Our problem is that we were not able to find a way to assign the conversion exit of a data element ("column") in Web Dynpro ALV. Without this feature, no output conversions will take place since the data elements have no relation to DDIC. In the "classical" ALV, this could be easily done using method SET_EDIT_MASK of class CL_SALV_COLUMN.

Is there a similar method in WebDynpro ALV or at least an alternative approach to assign a conversion exit to a column or cell?

Thanks for your help in advance.

Best Regards,

Sven

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Sven Hader,

As you said you are generatiing the metadata like field name, data type, length, decimals, conversion exit dynamically.

Can you please let me know how you are diong this?

Meanwhile, you can try this approach to assign a Conversion exit to ALV Table column attribute dynamically.

DATA: lv_data TYPE dd04v,

lv_mode_ext2int type ESEBOOLE. "Conversion mode that you are in

  • read the data from the database

CALL FUNCTION 'DDIF_DTEL_GET'

EXPORTING

name = lv_ddobjname

state = iv_object_state

langu = iv_langu

IMPORTING

dd04v_wa = lv_data

EXCEPTIONS

illegal_input = 1

OTHERS = 2.

CHECK NOT lv_data-convexit IS INITIAL.

CONCATENATE 'CONVERSION_EXIT_' lv_data-convexit '_INPUT'

INTO cl_im_imp_ehs_material_erp=>mv_conversion_exit_input.

CONCATENATE 'CONVERSION_EXIT_' lv_data-convexit '_OUTPUT'

INTO cl_im_imp_ehs_material_erp=>mv_conversion_exit_output.

IF lv_mode_ext2int = 'X'.

ASSIGN cl_im_imp_ehs_material_erp=>mv_conversion_exit_input

TO <lv_funcname>.

ELSE.

ASSIGN cl_im_imp_ehs_material_erp=>mv_conversion_exit_output

TO <lv_funcname>.

ENDIF.

  • (3) call the conversion exit

CHECK <lv_funcname> IS ASSIGNED.

TRY.

CALL FUNCTION <lv_funcname>

EXPORTING

input = iv_value

IMPORTING

output = ev_value.

IF sy-subrc <> 0.

ENDIF.

CATCH cx_sy_dyn_call_illegal_func

cx_sy_dyn_call_illegal_type

cx_sy_dyn_call_param_missing

cx_sy_dyn_call_param_not_found. "#EC NO_HANDLER

ENDTRY.

Endif.

I hope it should work.

Thanks,

Bharath.K

Edited by: Bharath Komarapalem on Dec 16, 2008 2:47 PM

0 Kudos

Hi Bharath,

Thanks a lot for your reply.

Actually, I said that we generate the data elements and structures based on metadata, not that the metadata itself is generated. The metadata is known at runtime, that is, we know that the structure should consist, for example, of three fields X, Y, and Z where X is INT4, Y is CHAR(40), and Z is DATS. Based on this metadata, we use methods of the RTTS classes to generate a table of the described structure. This looks something like this:


  ...
  ls_str_comp-name = 'Y'.
  ls_str_comp-type ?= cl_abap_elemdescr=>get_c( p_length = 40 ).
  APPEND ls_str_comp TO lt_str_comp.
  ...
  lo_res_str_type = cl_abap_structdescr=>create( lt_str_comp ).
  lo_res_tab_type = cl_abap_tabledescr=>create(
                              p_line_type  = lo_res_str_type
                              p_table_kind = cl_abap_tabledescr=>tablekind_std ).
  CREATE DATA lr_result_tab TYPE HANDLE lo_res_tab_type.

I know the approach you described to determine the function module name from the conversion exit name and to run the function module dynamically. We already have a class that encapsulates all this functionality. Nevertheless, the main problem is that we don't want to do the conversion ourselves before the ALV is called. This would be a lot of work (since it has to work generically) and would require an additional table for the conversion results (since the converted value will not fit in the original data element if output length > length). Therefore, we think that the UI element (in this case, Web Dynpro ALV) should do the conversion internally but have not find a way to tell the ALV to do this.

Best Regards,

Sven