开发者

How to write code varying according to current client/mandant?

开发者 https://www.devze.com 2023-01-24 12:37 出处:网络
We currently have a SAP System with two different clients 002 and 004 in use. My task is to write a program in ABAP to create a report about user assignments. The report will do mainly the same on bot

We currently have a SAP System with two different clients 002 and 004 in use. My task is to write a program in ABAP to create a report about user assignments. The report will do mainly the same on both clients, but I have to select different tables on both clients.

Is there a way to distinguish an ABAP开发者_如何学JAVA code between different clients like:

IF client = 002.
* dothis.
ELSE.
* dothatdifferentthing.
ENDIF.

Thanks in advance.


The current client is available in field sy-mandt.

For example:

IF sy-mandt = '002'.
*dothis.
ELSE.
*dothatdifferentthing.
ENDIF.


An additional suggestion - try to do this the object-oriented way, stuffing all the common code into an abstract superclass and create two subclasses which carry only the client-dependent code. Then, based on SY-MANDT, instantiate either of the subclasses. This might help reducing duplicate code...

0

精彩评论

暂无评论...
验证码 换一张
取 消