Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
Introduction : 

            
Visual Composer is a easy to use GUI based Tool for designing impressive GUIs. At our end we are using it extensively for BI query dashboards.
 I have been exploring it recently and enjoying the learning curve with help of multiple Weblogs & Forum inputs at SDN. Here I am discussing one of the value help option for query parameters based on infoObject master data. It provides for a drop down list with values extracted from master  data of info object .

   Its inspired from one of the option discussed in Thomas Jung's weblog for value help options in VC - Visual Composer: Value Help Data Service .

h5. Solution Components :

          This solution is based on RFC enabled Function module in  SAP BW instance which is later called at the time of dynamic determination of values for a Dropdown element in Visual Composer  .
 I am presenting here the RFC FM first and then  configuration steps required in VC to call it during Drop down list creation.
 

h5.  Master Data Extraction FM in ABAP :  
                                             

   Major components of this FM are following three BIW infoObject meta data and  master data related function modules  .
 Purpose of calling  respective FM is also mentioned in remarks.
                    
    

 No

 FM- Name

 Remarks

 1

 RSD_IOBJ_GET

 Verifying the existence of info object and its properties ,Viz. whether texts are maintained for it.

 2

  RSD_CHKTAB_GET_FOR_CHA_BAS

 To get the master data and text data table name.

 3

 RSAU_READ_MASTER_DATA

 To extract the master data for the infoobject.

                                  

Function module parameters with their usage requirement are given below :

 No.

Parameter 

 Type

 Remarks

 1

 I_INFOOBJECT

 Import

 Name of the infoobject whose master data values need to be shown as drop down list

 2

 I_SHOWTEXT

 Import

 Flag to show the master data text values in drop down list . If kept initial the master data values will  be shown in drop down list.

 3

 E_VALUE_HELP

 Export

 Table  with master data list values . This is mapped to Key field and Value field of the drop down list elements in the VC story board.

 4

 E_RETURN

 Export

 This is used to process the error .The error is also shown in the drop down list in VC.



Code extract of RFC enabled function module - ‘Z_VC_GET_DROPDOWN_LIST’

FUNCTION Z_VC_GET_DROPDOWN_LIST.

"----


<br />""Local Interface:<br />" IMPORTING
" VALUE(I_INFOOBJECT) TYPE RSDCHABAS-CHABASNM<br />" VALUE(I_SHOWTEXT) TYPE CHAR1 OPTIONAL
" EXPORTING<br />" VALUE(E_VALUE_HELP) TYPE SHSVALTAB
" VALUE(E_RETURN) TYPE BAPIRET2<br />"--
<br />* RSSB_AUTHORITY_CHARACTERISTIC<br />data : v_tab TYPE RSDCHKVIEW,<br />v_text type RSTXTTAB,<br />v_objname type rsdiobjv-FIELDNM,<br />v_msgno type T100-MSGNR.<br />tables : rsdchabas.<br />data: i_tab type ref to data,<br />i_vhelp type SHSVALTAB,<br />wa_vhelp type SHSVALSTR,<br />wa_tab type ref to data,<br />wa_texttab type ref to data,<br />wa_viobj type rsd_s_viobj,<br />wa_vcha type rsdvcha,<br />wa_cond type string.<br />DATA: BEGIN OF i_cond OCCURS 0 ,<br />line(60) TYPE c ,<br />END OF i_cond .<br /> <br />field-symbols: <i_tab> type standard table,<br /><wa_texttab> type any.<br />field-symbols : <wa_tab> type any,<br /><v_attr> type any,<br /><v_key> type any.<br />*
validate info object existence and properties
CALL FUNCTION 'RSD_IOBJ_GET'
EXPORTING
i_iobjnm = I_INFOOBJECT
IMPORTING
e_s_viobj = wa_viobj
E_S_VCHA = wa_vcha
EXCEPTIONS
iobj_not_found = 1
illegal_input = 2
OTHERS = 3.
IF sy-subrc <> 0.
E_RETURN-id = SY-MSGID.
E_RETURN-type = SY-MSGTY.
E_RETURN-number = SY-MSGNO.
E_RETURN-MESSAGE_V1 = SY-MSGV1.
E_RETURN-MESSAGE_V2 = SY-MSGV2.
E_RETURN-MESSAGE_V3 = SY-MSGV3.
E_RETURN-MESSAGE_V4 = SY-MSGV4.
else.
--- get the name of text and master data tables for the infoobject<br />CALL FUNCTION 'RSD_CHKTAB_GET_FOR_CHA_BAS'<br />EXPORTING<br />I_CHABASNM = I_INFOOBJECT<br />IMPORTING<br />E_CHKTAB = v_tab<br />E_TXTTAB = v_text<br />EXCEPTIONS<br />NAME_ERROR = 1<br />OTHERS = 2.<br />IF SY-SUBRC <> 0.<br />E_RETURN-id = SY-MSGID.<br />E_RETURN-type = SY-MSGTY.<br />E_RETURN-number = SY-MSGNO.<br />E_RETURN-MESSAGE_V1 = SY-MSGV1.<br />E_RETURN-MESSAGE_V2 = SY-MSGV2.<br />E_RETURN-MESSAGE_V3 = SY-MSGV3.<br />E_RETURN-MESSAGE_V4 = SY-MSGV4.<br />else.<br />-- create dynamic table and work area for the master data table--- get the master data attribute field name for the infoobject<br />v_objname = wa_viobj-FIELDNM.<br />-- building dynamic where clause.-- create the text table for the text values dynamically<br />CREATE DATA wa_texttab TYPE (v_text).<br />assign wa_texttab-> to Step 1 :  Create a demo model in VC with BI query as data component and display results in a  chart or List .
In this case I am using Sales organisation as  input parameter and showing  Division wise sales in the Pie Chart using a custom BIW query. In  Input form I am selecting  sales organisation as the only input field .

!https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_002.JPG|height=277|alt=Figure 1|align=left|width=599|src=https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_002.JPG|border=1!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Note that I am not using submit button either as I will be using dropdown selection event  itself to trigger ‘SUBMIT FORM’ action. 

Step 2 : Double click on Sales_Organization element to configure it . Change  control type to 'Drop-down List' in general tab.  

!https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_004.JPG|height=283|alt=Figure 2|align=left|width=402|src=https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_004.JPG|border=1!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Step 3 : In  entry list tab select radio button  'Dynamic' and in the pop up for data service select your BW system configured for accessing RFC services.

!https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_006.JPG|height=227|alt=Figure 3|width=577|src=https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_006.JPG|border=1!

Choose the developed RFC FM service from  search list .

!https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_004.JPG|height=1|alt=Figure 4|align=left|width=1|src=https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_004.JPG|border=0!!https://weblogs.sdn.sap... 4|align=left|width=519|src=https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_008.JPG|border=1!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Step 4 : Fill input port fields I_INFOOBJECT with name of the infoObject whose master data values we want in drop down .
Map KEY and VALUE field of Value help table to VALUE and TEXT fields as shown below.
If you want  texts maintained for the master data key is to be displayed in dropdown enter ‘X’ to parameter ‘I_SHOWTEXT’.

!https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_010.jpg|height=1|alt=Figure 5|align=left|width=1|src=https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_010.jpg|border=0!



 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Step 5 :Since we are not using  submit button in our form , go to  ‘ACTION’ tab select radio button as 'System Action' and choose 'SUBMIT FORM' as the action .
This will execute query whenever you select a value from drop down list.

!https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_012.JPG|height=227|alt=Figure 6|width=377|src=https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_012.JPG|border=1!

Step 6 :  Now compile and deploy your model to see master data values in drop down.

!https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_014.JPG|height=283|alt=Figure|align=left|...!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Step 7 : You can also observe that  results change whenever you  select a new value from dropdown.
Since we have opted to execute system event ‘SUBMIT FORM’ at every selection in drop down.

!https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_016.JPG|height=283|alt=Figure 8|align=left|width=378|src=https://weblogs.sdn.sap.com/weblogs/images/64545/DLW082007_016.JPG|border=0!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

WindingUp :
 
We can further look into possibilities of restricting the dropdown values as per user authorisations for a authorisation relevant Info Object . I am exploring on it will update if anything happens on that front .