How to pass multiple single values from a table view to BEx query variable in Visual Composer
Introduction
I have been designing models in Visual composer using BEx queries to read and write data from/to a table view for a few years. Multiple Single values could not be passed from a table or value help to a BEx variable which accepts multiple single values or selection option. Passing multiple single values from a table view in Visual composer to a multiple single value input variable or a selection option in BEx query can be achieved through introducing a simple function module between the table view and BEx query.
Design View Fig: 1
Layout View Fig: 2 of the model seen above in the Design View Fig:1
Fig: 3 Multiple Material Numbers can be selected on the left side of the Value Help Panel and the selected Material Numbers are displayed on the right side of the Value Help Panel (Refer to Design View Fig:1 Value Help Pop Up Window for detail design) . The Value Help Pop-Up Window “Selected Material Numbers” outport in Fig:1 is then connected to ‘Z_Multi_Variable_Values’ RFC function module inport (In this case IV_VALUE1).
Fig: 4 Shows the results from the BEx query for the Materials that where selected in Fig:3 and the bottom table frame shows the way Material Numbers were passed into the BEx query from the RFC Function Module.
ABAP Development for the RFC Function Module ‘Z_Multi_Variable_Values’
Fig: 5 Create a Structure ‘ZVAR’ using T-Code ‘SE11’ under ‘Data Type->Structure’
Fig: 6 Create a Table Type ‘Z_VARIABLE’ using T-Code ‘SE11’ under ‘Data Type-> Table Type’. Use the above created Line Type ‘ZVAR’ from Fig:5
Fig: 7 Create a Function Module Remote Enabled ‘Z_MULTI_VARIABLE_VALUES’ using T-Code SE37
Fig: 8 Maintain the same Import settings as shown below under the ‘Import’ tab
Fig: 9 Maintain the same Export settings as shown below under the ‘Export’ tab
ABAP Code that needs to be maintained under the ‘Source Code’ tab. Also find attachment for ABAP Code
FUNCTION z_multi_variable_values.
*”———————————————————————-
*”*”Local Interface:
*” IMPORTING
*” VALUE(IV_VALUE1) TYPE Z_VARIABLE OPTIONAL
*” VALUE(IV_VALUE2) TYPE Z_VARIABLE OPTIONAL
*” VALUE(IV_VALUE3) TYPE Z_VARIABLE OPTIONAL
*” VALUE(IV_VALUE4) TYPE Z_VARIABLE OPTIONAL
*” VALUE(IV_VALUE5) TYPE Z_VARIABLE OPTIONAL
*” EXPORTING
*” VALUE(RV_STRING1) TYPE STRING
*” VALUE(RV_STRING2) TYPE STRING
*” VALUE(RV_STRING3) TYPE STRING
*” VALUE(RV_STRING4) TYPE STRING
*” VALUE(RV_STRING5) TYPE STRING
*”———————————————————————-
FIELD-SYMBOLS: <iv_value> TYPE any.
DATA: ls_rv_value TYPE string.
IF NOT iv_value1 IS INITIAL.
LOOP AT iv_value1 ASSIGNING <iv_value>.
CONCATENATE <iv_value> ‘;’ INTO ls_rv_value.
CONCATENATE rv_string1 ls_rv_value INTO rv_string1.
ENDLOOP.
ENDIF.
IF NOT iv_value2 IS INITIAL.
LOOP AT iv_value2 ASSIGNING <iv_value>.
CONCATENATE <iv_value> ‘;’ INTO ls_rv_value.
CONCATENATE rv_string2 ls_rv_value INTO rv_string2.
ENDLOOP.
ENDIF.
IF NOT iv_value3 IS INITIAL.
LOOP AT iv_value3 ASSIGNING <iv_value>.
CONCATENATE <iv_value> ‘;’ INTO ls_rv_value.
CONCATENATE rv_string3 ls_rv_value INTO rv_string3.
ENDLOOP.
ENDIF.
IF NOT iv_value4 IS INITIAL.
LOOP AT iv_value4 ASSIGNING <iv_value>.
CONCATENATE <iv_value> ‘;’ INTO ls_rv_value.
CONCATENATE rv_string4 ls_rv_value INTO rv_string4.
ENDLOOP.
ENDIF.
IF NOT iv_value5 IS INITIAL.
LOOP AT iv_value5 ASSIGNING <iv_value>.
CONCATENATE <iv_value> ‘;’ INTO ls_rv_value.
CONCATENATE rv_string5 ls_rv_value INTO rv_string5.
ENDLOOP.
ENDIF.
ENDFUNCTION.
About the Author
Viswadeep Sunkara
SAP BW/IP/BOBJ/PBF Developer