Skip to Content
Technical Articles
Author's profile photo Yogananda Muthaiah

SAP Commissions – Why you need to use GO ?

Dear All,

This article is intended for SAP Commissions developers can make us of Golang programming using restAPI to scale up the faster response for any development.


GO is one of the awesome programming languages nowadays. GO is the simple and fastest language, even GO is fastest from Java and Python. GO doing very well at web. GO is easy to learn. If you are familiar with any programming language then you can learn it so fast.

Why use Golang?

  1. Future of Golang is Safe and Sound
  2. Munificent Libraries
  3. General Purpose
  4. Highly Flexible
  5. Cross-platform Ready
  6. No External Dependency for Your Project
  7. Fastest Build Time
  8. Concise and Clear Codes
  9. Strong Concurrency
  10. Powerful Networking
  11. Packages and Libraries of High Standard

What’s so Great About Golang?

  • Golang is the Speediest Burgeoning Language on Github
  • Super matured package of its own
  • No classes, no inheritance
  • Golang has spiked its popularity
  • Best Go-to Cloud native programming language

Fast

Go is compiled to machine code, it will naturally outperform languages that are interpreted or have virtual runtimes. Go programs also compile extremely fast, and the resulting binary is very small.

Golang can boast speeds of close to four times quicker than its interpreted and dynamic friends. That said, very little can touch C++ (and most C languages) when it comes to speed. All of the time spent coding and compiling pays off here

you can find lot much of Golang topics and why its essential skill to learn for your future programming


Using SAP Commissions RestAPI , you can make a call to get fast response and scale up to speed to integrate with SAP BTP using Cloud foundry with Kyma serverless function.

Sample code for calling SAP Commissions Rest API using GO

package main

import (
	"encoding/base64"
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"
)

// HTTP basic authentication example in Golang using the RTC Server RESTful API
func main() {

	// Customer ID
	username := "userid"
	// Customer secret
	password := "Pssw0rd1"

	// Concatenate customer key and customer secret and use base64 to encode the concatenated string
	plainCredentials := username + ":" + password
	base64Credentials := base64.StdEncoding.EncodeToString([]byte(plainCredentials))

	url := "https://<tenantid>.callidusondemand.com/api/v2/creditTypes"
	method := "GET"

	payload := strings.NewReader(``)

	client := &http.Client{}
	req, err := http.NewRequest(method, url, payload)

	if err != nil {
		fmt.Println(err)
		return
	}
	// Add Authorization header
	req.Header.Add("Authorization", "Basic "+base64Credentials)
	req.Header.Add("Content-Type", "application/json")

	// Send HTTP request
	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}

 

References :

Go Installation Link

Assigned tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.