In this document, let’s demonstrate three points:
- How to find out the exact CSS class and property which controls the attribute of an element? For example, which property under which CSS class is controlling the alignment of a label?
- What is the CSS file which contains the CSS class definition?
- What is the exact CSS file if the CSS file shows styles.css?
Prerequisite: If F12 tool crashes, or breakpoint in thtmlb_styles/styles.css doesn’t stop, please implement SAP Note 2395408. Steps are:
- Implement both manual and correction parts in SAP Note 2395408 – Developer Tools crashes on Internet Explorer 11 on Windows 10
- Execute T-code SU3 to set user parameter ‘WCF_IE11_DBG’ to X
— How to find out the exact CSS class and property?
sample: Who is controlling the alignment of these label texts?
What we can do are:
- Click F12 to open ‘Developer Tools’.
- Click ‘Select element (Control+B)’ button on ‘DOM Explorer’ tab.
- Once ‘Select element’ button is clicked, the WebUI page will be navigated back. Some lines around cursor will appear. Move your cursor to a label field, like ‘Description’ and click.
- Once clicked, the ‘Developer Tools’ will be navigated again. From left side, the related source codes for the label are highlighted. From right side, we can see all the relevant styles.
- Since we want to find out which property controls the alignment, we can make a change on a suspected property to see if the change affects the alignment on WebUI. For example, we change the value on ‘text-align’ to value ‘left’ under CSS class ‘th-lb-txtlblrgh’:
- A. Click on value ‘right’.
- B. Once clicked, the field becomes editable.
- C. Input a space. Then we will see all values which can be used for ‘text-align’
- D. Input a value, for example ‘left’, and click Enter.
- Once the ‘text-align’ is changed to ‘left’, on WebUI, the labels who are using this property are left-aligned.
- In this way, we can identify the CSS class ‘th-lb-txtlblrgh’, the property is ‘text-align’.
— What is the CSS file which contains the CSS class definition?
- Right click the hyperlink on ‘styles.css’ left to the CSS class ‘th-lb-txtlblrgh’
- The styles.css file will be opened under ‘Debugger’. Right click on the tab and select ‘Copy URL’.
- Paste into a notepad, the link will look like this:
- From this URL link, we can see the CSS file is styles.css, thtmlb_styles is BSP Application name. Sometimes, the BSP Application might be your own custom BSP Application.
- Go to SAPGUI, execute T-code SE80, display ‘BSP Application’ thtmlb_styles.
- Expand ‘Pages with Flow Logic’, double click on ‘styles.css’ to display the content.
— How to find out the exact CSS file if it is shown that the CSS class is in styles.css?
Usually, CSS files contain the CSS classes definitions. But if it is styles.css, it is some kind of special. For performance reasons, several CSS files are aggregated into a single minimized chunk. This is good for performance, but on the other hand, it makes it difficult to tell in which real CSS file the CSS class is.
Now we introduce two ways to find out the exact CSS file if it is styles.css.
For both of the ways, prerequisite is authorization on S_DEVELOP/DEBUG.
Way 1(by setting a user parameter, no need to debug):
- In T-code SU3, set user parameter WCF_THTMLB_CSS_DEBUG to X.
- Restart WebUI page, login, access the expected page.
- Click F12 to open the Developer tool.
- Find out the property following the steps as previously introduced.
- Click the hyperlink ‘styles.css’. File ‘styles.css’ will be opened.
- Select the menu ‘Copy URL’ again.
- Paste it into notepad. The link will look like this: …/SAP(====)/BC/BSP/SAP/thtmlb_styles/styles.css?sap-thtmlb-skin=DEFAULT&sap-thtmlb-theme=&sap-thtmlb-css-filename=thtmlb_core_stand.css&sap-thtmlb-rtl=&….
- Notice that in this url, parameter sap-thtmlb-css-filename has a value thtmlb_core_stand.css. This thtmlb_core_stand.css is the real place where the CSS class is defined.
Way 2(by debugging, no need to set user parameter):
- Set breakpoint in line of ‘lv_css_code = cl_thtmlb_css_util=>prepare_minimized_css( ‘.
- Restart the WebUI page from the beginning and logon again.
- When breakpoint stops here, check the lt_css_fiels:
- Click F8 to finish the debugging.
- You can go to these CSS files to search the CSS class and property. For example:
- a). Execute SE80, display the BSP Application thtmlb_styles.
- b). Open a css file, for example, thtmlb_core_stand.css.
- c). Click Ctrl+F, search the name ‘th-lb-txtlblrgh’.
- d). If ‘th-lb-txtlblrgh’ is in this file, congratulation, you get it. But if it is not in thtmlb_core_stand.css.css, then repeat steps b) and c) on other css files.