Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="UTF-8">
<title>Checkbox and Column Binding</title>
<script id="sap-ui-bootstrap"
type="text/javascript"
@js1972
js1972 / gist:9045719
Created February 17, 2014 06:32
Calculate a HASH on a STRING #ABAP
method calculate_hash.
" importing: string_data TYPE STRING
" returning: hash_value TYPE STRING
"
" Calculate the hash value for a given string and return as Base64.
"
data: lo_digest type ref to cl_abap_message_digest,
converter type ref to cl_abap_conv_out_ce,
data_as_xstring type xstring.
@js1972
js1972 / js_constructor_module_pattern.js
Last active August 29, 2015 13:57
JavaScript Constructor Module Pattern. This module returns a constructor function which can be called with new. This is the alternative to the standard module pattern which returns an object. #javascript
myapp.module = (function () {
// private variables and functions
var foo = "bar",
Constuctor;
// constructor
Constructor = function () {
};
// prototype
@js1972
js1972 / basic_auth_check.groovy
Created May 1, 2014 08:41
Basic Auth check in groovy for SoapUI. When using a SOAP Mock in SoapUI there is no standard way to check the authentication provided by the caller. This script can be added to your mock in the "OnRequest Script" section and allows you to check for the correct credentials. If you test this from SoapUI as well then you need to set the Authenticat…
import com.eviware.soapui.support.types.StringToStringsMap
def authSucceeded = false
// get the request headers
StringToStringsMap headers = mockRequest.getRequestHeaders()
headers.each {
if (it.key.equals("Authorization")) {
String content = it.value
String[] contentArray = content.split()
@js1972
js1972 / gpath.groovy
Created May 5, 2014 08:59
How to access the SOAP request and do some xpath processing in SoapUI with Groovy. Uses XmlSlurper and GPath.
def req = new XmlSlurper().parseText(mockRequest.requestContent)
log.info "Customer #${req.foo.data.CustomerNumber}"
@js1972
js1972 / zcl_advance_shipg_notice_maint - Class Relevant Local Types.abap
Created May 12, 2014 02:57
Example ABAP class with local classes and test cases showing the use of test doubles, etc.
*"* use this source file for any type of declarations (class
*"* definitions, interfaces or type declarations) you need for
*"* components in the private section
types:
begin of event_rec,
evt_name type string,
sort_order type i,
end of event_rec.
@js1972
js1972 / write_file.groovy
Created May 16, 2014 07:42
How to write content to a new file (overwrite if already existing) in Groovy.
//
// Write the mock request payload to a file for checking later...
// newWrite() is the important it to ensure you get a *new* file each time.
//
def filename = "C:\\MyScratchFolder\\soapUI projects\\Testing\\procon\\mock_po_activity_request.xml"
def file = new File(filename)
def w = file.newWriter()
w << mockRequest.requestContent
w.close()
@js1972
js1972 / ui5_cancel_dialog.js
Created May 21, 2014 03:42
Cancel a UI5 dialog when clicked outside. With Twitter Bootstrap dialogs you can click anywhere on the page outside of the dialog to close it (as if you had clicked the close button). This basis jQuery code enables the same with a UI5 app. The example below is with the sap.m.ResponsivePopover control but it works with any dialog that uses a bloc…
$(function() {
$('body').on('click', '#sap-ui-blocklayer-popup', function() {
var popover = sap.ui.getCore().byId('responsivePopover');
popover.close();
popover.destroy();
});
});
@js1972
js1972 / web_dynpro_launch_tcode.abap
Created May 26, 2014 04:25
Sample ABAP code to launch a SAPGUI transaction from WebDynpro. This is similar to how its done with FPM (if_fpm_navigate_to). See the example GIST on that.
ls_transaction-tcode = 'BSSP_BOR_OBJECT'.
ls_transaction-gui_type = 'WIN_GUI'.
ls_transaction-system_alias = 'SAP_LocalSystem'.
ls_lpd_tx_para-key = 'SWO_TYPEID'. "'OBJKEY'.
ls_lpd_tx_para-value = ld_string+6(70).
INSERT ls_lpd_tx_para INTO TABLE ls_transaction-parameter.
ls_lpd_tx_para-key = 'OJ_NAME'. "'OBJTYPE'.
ls_lpd_tx_para-value = ld_string+76.
INSERT ls_lpd_tx_para INTO TABLE ls_transaction-parameter.
ls_lpd_tx_para-key = 'RFCDEST'.
@js1972
js1972 / ZCCA_ENJOY_TXN_LAUNCHER.abap
Created May 26, 2014 04:28
How to launch and external SAPGUI transaction from an FPM application. Note that the SAPGUI launches within a browser, but it is the *real* sapgui rendering within it.
*&---------------------------------------------------------------------*
*& Report ZCCA_ENJOY_TXN_LAUNCHER
*&
*&---------------------------------------------------------------------*
*& This program is used to launch the sap enjoy transactions from FPM
*& apps. The enjoy transactions such as ME53N (pur. req. display) do
*& not allow proper passing of paramters within the webgui. However the
*& old sap transaction such as ME53 do (it requires a selection screen).
*& This program presents a simple selection screen which can be
*& populate with a document type and document number.