How to overcome 64kb chars Script definition limitation in SAP Sourcing
SAP sourcing wave 7 has IDE which can support 32kb chars and wave 7 with SP6 and above supports 64kb chars.
We have faced in few instances where our code has breached 64 kb limitation.
The approach to reduce the size of variable names( char length of variable names), method name used in our development.
This will have cost impact as far as maintainability of the code is concerned.
SAP has provided a means overcome this limitation by following approach. This requires Admin access to the system and file system access to the server.
1. Create a java file
2. Put all /part of the code into a java file.
3. Compile and create a jar file.
4. Using Sourcing config tool , create .sca file
5. Deploy the .sca file into Sourcing thru JSPM.
Once done ,
1. In the sourcing ENV , import the java class which is deployed in the previous step
2. Instantiate the java class and call/use the method .
I have created a java project and a method which has two parameter one RFX doc and session as below.
The method it is printing a message to the document description in the RFX doc.
The method signature is as follows.
Create a jar file for this java project. I have used Apache Maven build to create a jar file ( you can use any other build utility like ANT which you are familiar with)
The jar file name is MyFirstSourcingCode-0.1.jar
Now I need to create a .SCA file before deploying this jar file .
The steps to create .SCA file
1. Go to the Server file system and open a command prompt ( or put this in .BAT file and run the bat file)
This will open the configure tool
Click on Next method
Check the following check boxes as shown in the below picture and click on install
( Click only Custom Jar Files and Update WAR, EAR and SCA files)
Select the J00 folder – (/usr/sap/<SID>/J00 folder) and click on Next
Select the Jar file which you wish to deploy , in this case “MyFirstSourcingCode-0.1.jar” and click on Next .
Click on Install.
Click on Done to complete the .sca file creation.
Now .sca file is created with the name <Application Context>Server.sca file which is present the following folder \esourcing70\fsapp
Second part is deploying this .sca file into the Sorucing ENV.
1. Copy the <Application Context>Server.sca to the following folder \usr\sap\trans\EPS\in
2. Run the JSPM( Java Support package manager ) tool using command prompt
3. Login as Administrator
1. Select “Single support packages and Patches( Advanced users only) and click on Next
Cliclick on Next
This is the Java file information which we deployed into Sourcing ENV using JSPM
Package Name : com.temp
Java Class Name : MyFirstSourcingCode
Method Name : myFirstSourcingMethod( IapiSessionContextIfc session, RfxDocIBeanIfc doc)
Go to the Sourcing system open the Script on the target business object as RFX.
For simplicity sake , I am creating a tool bar script .
Login to Sourcing system
Go to Setup >> Script Definition >> select toolbar in the wizard step 1 as shown in the below picture. Click on continue.
Enter the values as appropriate in your case
Enter the code in the script section
// Instantiate the class object
MyFirstSourcingCode customJarObj = new MyFirstSourcingCode();
//call the method to print the value “Printing from the MyFirstSourcingCode jar file” into document description
customJarObj.myFirstSourcingMethod( session, doc) ;
Save the script and open an RFX doc and run the tool bar script to verify whether it is printing value from the java method.
Conclusion : By creating a custom jar and adding all the additional code into the java file we can over come the Sourcing script defintion limitation of 64kb.
The advantage :
· Code secured and not visible to all as it is a compiled code.
· Consuming third party Web service caqn be done using this approach
The challenging issues is
· Every time you want to modify any code in the java side , you need to follow this tedious task. So before moving any code onto the java side, test it thoroughly and move it only it really required.