Skip to content

Instantly share code, notes, and snippets.

View svict4's full-sized avatar
🏦
shilling crypto

Simon Victory svict4

🏦
shilling crypto
View GitHub Profile
@svict4
svict4 / valueFromContextNode.abap
Created January 17, 2018 08:53
ABAP SAP CRM - Get value from Context Node
DATA: lr_entity TYPE REF TO if_bol_bo_property_access.
lr_entity ?= me->typed_context->btadminh->collection_wrapper->get_current( ).
CHECK lr_entity IS BOUND.
IF lr_entity->get_property_as_string( iv_attr_name = 'PROCESS_TYPE' ) = 'process type here'. "added process type check, can never be too careful
ENDIF.
@svict4
svict4 / readingFromSharedMemory.abap
Created January 17, 2018 08:50
ABAP SAP CRM - Saving and Reading Shared Memory
DATA: lv_attr_str TYPE string,
lo_root TYPE REF TO zXXXXXX_shared_mem,
lo_area TYPE REF TO zXXXXXX_shared_mem_area.
TRY.
lo_area = zXXXXXX_shared_mem_area=>attach_for_read( ).
lv_attr_str = lo_area->root->get_ttt_mem( ).
lo_area->detach( ).
CATCH cx_root.
ENDTRY.
@svict4
svict4 / typeReferenceData.abap
Created January 17, 2018 08:47
ABAP SAP CRM - Type from Reference DATA
DATA: lr_data TYPE REF TO data,
lo_type TYPE REF TO cl_abap_typedescr,
lo_struct TYPE REF TO cl_abap_structdescr,
lr_entity TYPE REF TO if_bol_bo_property_access.
FIELD-SYMBOLS: <fs_any> TYPE any,
<fs_actions> LIKE LINE OF lt_actions.
TRY.
CHECK lr_entity IS BOUND.
@svict4
svict4 / customerInContext.abap
Created January 17, 2018 08:13
ABAP SAP CRM - Get customer in context
DATA: lr_entity TYPE REF TO if_bol_bo_property_access,
lr_context TYPE REF TO if_crm_ui_data_context.
lr_context = cl_crm_ui_data_context_srv=>get_instance( ).
IF lr_context IS BOUND.
lr_entity ?=
lr_context->get_entity( name = cl_crm_ic_bp_constants=>gc_gdc_currentcustomer ).
ENDIF.
@svict4
svict4 / consumeWS.abap
Created January 17, 2018 08:08
ABAP SAP CRM - Consume WS
*-- This code is calling the exposed Function Module in the snippet of 'BT Creation'.
*-- Found here: https://gist.github.com/svict4/d64fa12613415ab94afd1ee98a82c881
DATA: lo_proxy TYPE REF TO zsapco_zsrv_XXXXXX,
ls_service_output TYPE zsapzfm_XXXXXX_servresponse,
ls_service_input TYPE zsapzfm_XXXXXX_serv.
TRY.
*-- Create an instance of the ABAP Proxy class
CREATE OBJECT lo_proxy.
@svict4
svict4 / BTCreation.abap
Last active January 17, 2018 08:09
ABAP SAP CRM - BT Creation
*-- Please note that this is the function module that is called remotely in '(C) Consume WS through ABAP'
*-- Found here https://gist.github.com/svict4/f09e13b02e71c4f81a4e6e5c5c73adfe
FUNCTION XXXXXXXXXX.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IV_DESCRIPTION) TYPE STRING
*" VALUE(IV_PROCESS_TYPE) TYPE CHAR4
*" EXPORTING
@svict4
svict4 / BOLEntityQuery.abap
Created January 17, 2018 01:03
ABAP SAP CRM - BOL Entity Query
DATA: lv_bol_core TYPE REF TO cl_crm_bol_core,
lv_query TYPE REF TO cl_crm_bol_query_service,
lv_collection TYPE REF TO if_bol_entity_col,
lr_entity TYPE REF TO cl_crm_bol_entity,
lt_table TYPE TABLE OF bu_partner.
*-- Get an instance of the core and fire it up.
lv_bol_core = cl_crm_bol_core=>get_instance( ).
lv_bol_core->start_up( 'BP_APPL' ). "Component Set
@svict4
svict4 / dropdownCRMUI.abap
Created January 17, 2018 01:01
ABAP Dropdown in SAP CRM UI
*-- This code is placed within the GET_V of the attribute within the context node
*-- (please note that the GET_P must also specify that it is type picklist in the appropriate WHEN clause).
DATA: lo_ddlb TYPE REF TO cl_crm_uiu_ddlb,
lt_dropdown TYPE bsp_wd_dropdown_table.
*-- Create an instance of the class specifying that the source type is a table.
CREATE OBJECT lo_ddlb
EXPORTING
iv_source_type = gr_owner->gc_source_type_table. "This value is 'T' for Table.
@svict4
svict4 / ShortenAllMSWordURLs.bas
Last active January 19, 2018 06:06
Replaces all hyperlinks in a Word doc with shortened Bitly links
'Replaces all Hyperlinks in a Word doc with bitly links from your registered account
'Simply add in your Bitly Access Code
'or modify for whatever URL Shortner service you use
'and stir
Public BitlyAccessCode As String
Public BitlyURL As String
Public Salt As String

Keybase proof

I hereby claim:

  • I am svict4 on github.
  • I am svict4 (https://keybase.io/svict4) on keybase.
  • I have a public key ASBrm7VPVt__BrF2BKBX7llnnRc-vKmr2ogODlTR1S0H5wo

To claim this, I am signing this object: