Useful ABAP Functions

Function Description
POPUP_TO_SELECT_MONTHSelect month and year.
GUI_RUNRun command on the client side.
DAYS_BETWEEN_TWO_DATESTotal days between dates.
HRVE_CONVERT_TIME Convert time between 24h and 12h
SEO_CLASS_GET_METHOD_INCLUDESFind includes which are created by class
TH_POPUPSend a message to the user
RP_CALC_DATE_IN_INTERVALAdd or remove days, months, and years to date
HR_EFI_CONVERT_STRING_TO_TABLEConvert string to itab with a given row length
MCS_BIW_DROP_CREATE_TABLEDrop and re-create a database table
CONVERT_DATE_TO_INTERNALConvert string to date with check
ARCHIVFILE_CLIENT_TO_SERVERCopy a file from client to server (upload)
ARCHIVFILE_SERVER_TO_CLIENTCopy a file from server to client (download)
ALINK_CALL_TRANSACTIONCall t-code without authorization.
POPUP_GET_VALUESAsk for values to user.

SSL / TLS settings for SAP NetWeawer

A lot of SAP product such as NetWeaver using sapcrypto / commoncrypto library (sapcryptolib.dll or sapcryptolib.so) for SSL / TLS and encryption.

SSL / TLS client configuration.

ssl/client_ciphersuites = 150:PFS:HIGH::EC_P256:EC_HIGH

SSL / TLS server configuration.

ssl/ciphersuites = 135:PFS:HIGH::EC_P256:EC_HIGH

You need at least 8.4.40 sapcrpytolib for SNI (Server Name Indication) support. Before SNI protocol client request certificate with domain IP instead of domain name. SNI used for hosting multiple site on same port with encryption.

ssl/client_sni_enabled = TRUE

We need updated kernel for using this parameter, details are in this note.

Also you can set these parameters as OS environment variable.

SAPSSL_CLIENT_CIPHERSUITES = 135:PFS:HIGH::EC_P256:EC_HIGH
SAPSSL_CLIENT_SNI_ENABLED = TRUE

sapcryptolib versions for protocols

In below table you can find minumum sapcryptolib version for protocols.

ProtocolVersion
TLS 1.05.5.5 PL 28
TLS 1.28.4.31
SNI8.4.40

Split string to lines for displaying

DATA: lv_content TYPE string,
      lv_pos     TYPE i,
      lv_len     TYPE i.
lv_content = 'dummy string'.
lv_pos = 1.
WHILE lv_pos LE strlen( lv_content ).
  lv_len = 80.
  IF lv_pos + lv_len GT strlen( lv_content ).
    lv_len = strlen( lv_content ) - lv_pos.
  ENDIF.
  WRITE lv_content+lv_pos(lv_len).
  lv_pos = lv_pos + 80.
ENDWHILE.



If SOAMANAGER not exists

Some old system hasn’t got SOAMANAGER for configuring/creating logical port or service. We can use below t-codes for same operation.

LPCONFIG
WSCONFIG
WSADMIN

Linux check list

Install tools for operation.

yum install nano wget epel-release

Update

If you update some packages, your config files override with new ones. You can find old files with rpm extension in same directory.

Latest Packages

Some linux distributions update their package with delay. IUS is good option for using latest package. You can get IUS package list here and install them with below command.

Install ius rpm package first:

yum install https://centos7.iuscommunity.org/ius-release.rpm

Use u suffix for Installing package from ius repo. For example use below for installing git 2.x:

yum install git2u

Postgres

Download rpm package, check this list for other versions.
wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
Install package.
rpm -i pgdg-centos96-9.6-3.noarch.rpm
yum install postgresql96-server postgresql96-contrib
/usr/pgsql-9.6/bin/postgresql96-setup initdb

Create db and user.

su postgres
createuser --interactive
createdb -O myuser mydb

Run psql for setting password to new user.

psql
ALTER USER mydbuser WITH PASSWORD 'mynewpass';
\q

Proxy

If you need proxy you can use nginx. You need give permission to nginx for accessing http resources.

setsebool httpd_can_network_connect true -P

Check nginx.log with

tail -10f /var/log/nginx/error.log

php & php-fpm

Use IUS for latest release, php72u.

Permissions overwritten after update, check /var/lib/php/fpm permissions.

Java

JRE

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jre-8u181-linux-x64.rpm"
yum localinstall jre-8u181-linux-x64.rpm

JDK

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.rpm"

Firewall

firewalld

My hybris development environment test

I am using my company mac pro 2015 for a lot of thing. So I need different environment look like C#, hybris, ABAP, etc. These environment needs service look like db. These service using my ram always. So I am using VM for environment which are not used often. I created VM for new hybris versions for testing (docker cannot pause / resume systems yet). I try some scenarios for my best hybris development environment.

VM: OS version Centos 7, Java 8 u162, MySQL 5.7.21 and hybris version 6.6.

Enviroment Compile time (ant clean all)
Hybris files in host shared with guest vm 21 minutes 9 seconds
Hybris files in guest vm 3 minutes 8 seconds
2 minutes 29 seconds
Hybris files in guest vm and shared with host (without nfs optimization)  5 minutes 44 seconds

 

Creating history for item

If you want create history for item look like backoffice, you can use below example.

public void updateConsignmentStatus(String userUid, ConsignmentModel consignment, ConsignmentStatus status) {
  Map<string, object=""> originals = new HashMap();
  originals.put(ConsignmentModel.STATUS, consignment.getStatus());

  consignment.setStatus(status);

  Map<string, object> news = new HashMap();
  news.put(ConsignmentModel.STATUS, consignment.getStatus());

  final SavedValues savedValues = JaloConnection.getInstance().logItemModification(consignment.getPk(), news, originals, false);
  savedValues.setUser(UserManager.getInstance().getUserByLogin(userUid));
  modelService.saveAll();
}

Creating,updating or deleting other items in interceptor

public class MyCustomerPrepareInterceptor implements PrepareInterceptor {
private static final Logger LOG = Logger.getLogger(MyCustomerPrepareInterceptor.class);

@Override
public void onPrepare(CustomerModel customerModel, InterceptorContext interceptorContext) throws InterceptorException {
  . . .
  final MyItemModel myItem = 
  interceptorContext.getModelService().create(MyItemModel.class);
  interceptorContext.registerElement(myItem);
  //interceptorContext.registerElementFor(myItem, PersistenceOperation.DELETE);
  . . .
}