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...
精彩评论