Share this page

# sapgui_htmlviewer_dom_get_property

General Object Functions

Evaluates a DOM query on the web page contained inside the SAP application.

    int sapgui_htmlviewer_dom_get_property( const char *htmlViewerID, const char *DOMPath, const char* paramName, LAST );

htmlViewerID | The SAP GUI object ID string.
DOMPath | The DOM expression.
paramName | The parameter to which to save the value of the DOM expression.

sapgui_htmlviewer_dom_get_property evaluates a DOM expression on the page in the embedded browser and saves the results to a parameter.

SAP has a browser control, or HTML container, that allows the user to work on a web page that appears to be embedded in the SAP application. SAP is aware of much of the activity in the embedded browser, but you may need to get information that cannot be retrieved by the SAP functions. You may, for example, need a session ID or some other dynamic value from the HTML response for use in correlating a sapgui_htmlviewer_send_event call. sapgui_htmlviewer_dom_get_property enables you to get information from the DOM of the page in the browser control using standard DOM syntax.

To get the htmlViewerID, right click on the HTML container in a SAP GUI snapshot and select `Copy Control ID`. Delete the first characters (corresponding to the current session ID) and the current window id ("ses[0]/wnd[0]/").

To create your expression for the DOMPath, use any DHTML viewer to explore the DOM of the page displayed in the HTML container. If the path to the property you want contains a period that is not part of the DOM expression, escape the period with a backslash (\.).

When working with the WEB protocol together with the SAPGUI protocol, it is important to avoid duplicate HTML requests. The SAP application sends HTML events that are recorded, and the WEB protocol recorder may catch the same calls coming from the embedded browser. It is recommended that during recording, when you change focus from the SAP application to the embedded browser, you enter a comment using the recording toolbar. After the script is generated, delete WEB protocol requests before that comment. Make another comment when you resume working with the containing SAP application, and delete WEB requests after the comment, leaving the SAP HTML requests.

## Return Values

This function returns LR_PASS (0) on success or LR_FAIL (1) on failure.

## Parameterization

You can parameterize all string (char type) arguments.

## Example

In this example, sapgui_htmlviewer_dom_get_property gets the DOM object, document.frames.0.document.location.href, from the specified object and saves it to parameter Session_URL.

    sapgui_htmlviewer_dom_get_property(
    "usr/subAREA06:SAPLCCM21:0101/tabsTABSTRIP/tabpAA_TAB2/ssubSUB_TAB:SAPLCCM21:0104/ssubCCM21_CUST_SUB:SAPLCRM_1O_UI:1100/subSCR_1O_MAINTAIN:ISU_SALES_UI:0200/subSCRAREA1:SAPLCRM_TSRV_UI:1205/subSCRAREA1:SAPLCRM_TSRV_UI:2100/tabsTABSTRIP_TSRV_HD/tabpT\\TSRV_HD02/ssubHEADER_DETAIL:SAPLCRM_TSALES_UI:1330/subIPC:SAPLIPC_UI_CONFIG:0102/cntlSCE_HTML_CONTAINER/shellcont/shell",
    "document.frames.0.document.location.href",
    "Session_URL",
    LAST );

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: