Skip to content

Instantly share code, notes, and snippets.

View weiserman's full-sized avatar

Warren weiserman

  • Agile Business Technology
  • Cape Town
View GitHub Profile
@weiserman
weiserman / ZPO_TEXTS
Created December 11, 2013 14:20
SAP Report to display long texts contained in a Purchase Order
REPORT zpo_texts.
TABLES: ekko.
TYPE-POOLS : abap, slis, rsanm, icon.
DATA: lt_ekko TYPE STANDARD TABLE OF ekko.
DATA: l_rec(5) TYPE n.
@weiserman
weiserman / frappe.md
Last active March 20, 2023 19:24
Frappe Bench on Digital Ocean droplet

Guide-to-Install-Frappe-on-Digital-Ocean-Droplet

A guide to Install Frappe Bench v14 on Ubuntu 22.04 LTS and start building the Library Tutorial I hope this makes your Frappe development and exploration more simpler. Frappe Cloud provides great capabilities too. This is for a development server and not for a production build (obviously)

Pre-requisites before your start

  Digital Ocean account and a droplet created
  Ubuntu 22.04 LTS
@weiserman
weiserman / SAP Vendor
Created January 14, 2014 07:46
Create a vendor in SAP using the Vendor API
*&---------------------------------------------------------------------*
*& Report Creating a vendor, sample API coding
*&
*&---------------------------------------------------------------------*
*& Test for creation of vendor
*&
*&---------------------------------------------------------------------*
REPORT ydemo.
@weiserman
weiserman / filtering.js
Last active November 27, 2022 12:48
Frappe Client Script
// This script was created so that we can select web users for gym membership
// only allow active plans to be selected
// Once a plan is selected we default the values for price
frappe.ui.form.on('Gym Membership', {
plan: function(frm) {
frm.set_value('length', 99);
frm.set_value('price', 101.11);
frm.set_value('status', "Awaiting Payment");
},
refresh: function(frm) {
@weiserman
weiserman / api.py
Last active October 10, 2022 08:28
Frappe Python API example with SQL
import frappe
// This code is called from a front end script and returns a SQL query with a dictionary list.
@frappe.whitelist()
def get_rental_articles(first_name):
rentals = frappe.db.sql(f""" SELECT * from `tabLibrary Transaction` WHERE library_member = '{first_name}' """, as_dict=True)
return rentals
@weiserman
weiserman / Library_member.js
Created October 10, 2022 08:24
Frappe Client Script
frappe.ui.form.on('Library Member', {
refresh(frm) {
// Get the library memmbers first name from form JavaScript object
let first_name = frm.doc.first_name;
console.log(frm.doc);
// Check we have a name value and call the backend using an AJAX like call
// On completion call an Arrow function with results
// Backend function is written in python in the api.py file
if (first_name){
@weiserman
weiserman / HTML Email in ABAP with Image
Created February 18, 2014 06:54
This is an example ABAP program which sends an HTML email from SAP system. It includes an image which is uploaded via transaction SMW0
*&---------------------------------------------------------------------*
*& Report YMAIL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ymail.
@weiserman
weiserman / consumer.robot
Created February 2, 2022 18:08
Consumer Robot syntax
*** Settings ***
Library RPA.Robocorp.WorkItems
Library RPA.Tables
Library RPA.JSON
Library Collections
*** Tasks ***
Consume Items
[Documentation] Cycle through the quote items
@weiserman
weiserman / gist:85e67532ded325ba3e08d5813bb67030
Last active February 1, 2022 19:19
Upload file to process in robocorp
*** Settings ***
Documentation This robot will be run in robocloud, ask user for input file and then load work items
Library Collections
Library RPA.Tables
Library RPA.Dialogs
Library RPA.Robocorp.Process
Library RPA.Robocorp.Vault
*** Variables ***
${CSV_FILE} devdata${/}price_increase.csv
@weiserman
weiserman / BADI ME_PROCESS_PO_CUST
Last active January 4, 2021 20:56
Check Purchase Order Long Text in SAP ERP BADI. Example of implementation of BADI ME_PROCESS_PO_CUST sample code for checking long text and issuing errors.
METHOD if_ex_me_process_po_cust~check.
* Check the purchase order type and save the text
DATA: lv_tdid TYPE tdid,
lv_texttype TYPE mmpur_texttypes,
lt_text_lines TYPE mmpur_t_textlines,
lt_text_format TYPE mmpur_bool,
lv_header TYPE mepoheader,
lv_lines TYPE i.