Skip to Content

Hiding the Fields Dynamically

Hi All,

I saw so many threads about how to hide fields dynamically,how to change titles dynamcially on SAP community Network.

I decided to have a document on this so it will help us .

How Views get displayed?

Normally Views will get displayed with the help of .HTM page and the Configuration done via UI config tab.

How conifguration data can be read?

When we do configuration and in .HTM page two lines of code will be generated to read your configuration field lable’s postions etc ,See below two lines of code which read configuration

<%

data: lv_xml    type string.

lv_xml    = controller->CONFIGURATION_DESCR->GET_CONFIG_DATA( ).

%>

<chtmlb:config xml     = “<%= lv_xml %>”

                mode    = “RUNTIME”  />

If you observe above two lines It will read the data in XML format ad pas it to frame work in run time which will display accordingly.

How XML file looks like in Runtime?

Capture.PNG

If you observe ,It clearly have Row number,column number and the lable for,Input field details.

How to hide  the field in tun time?

So just put your condition and then write a statement like below:

For example i want to hide a filed mc_name2 then i write like

” replace all occurances of “//MEMBERBASICSEARCH//STRUCT>MC_NAME2 ” with ‘ ‘ in lv_xml.

and then pass our modifed XML to Config tab as show below

<chtmlb:config xml     = “<%= lv_xml %>”

                mode    = “RUNTIME”  />

so the field mc_name will be hidden with this logic

Final code would be like below:

<%

data: lv_xml    type string.

lv_xml    = controller->CONFIGURATION_DESCR->GET_CONFIG_DATA( ).

%>

” replace all occurances of “//MEMBERBASICSEARCH//STRUCT>MC_NAME2 ” with ‘ ‘ in lv_xml.

<chtmlb:config xml     = “<%= lv_xml %>”

                mode    = “RUNTIME”  />

.

Thanks for reading it and please let me know if i need to improve anything as it is my first document on SDN.



/
Capture.PNG
1 Comment
You must be Logged on to comment or reply to a post.
  • Hi Sivaram Pushpala

    i want to know how to find the XML FILE in run time u have mentioned screen short in that they are taking field information from xml format..

    so i want to view that xml format for a particular fields..

    how can i get this screen short in my system.. could u plz help me..

    is there any document plz send my mail id: srinivas.karri14@gmail.com

    How XML file looks like in Runtime?

    Capture.PNG

    Thanks & Regards

    Srinivas

    /
    Capture.PNG