Hi,

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 .

Elaboration :

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.

IDelimit.png

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)

Set  APPSERVER=NETWEAVER

set JAVA_HOME=D:\usr\sap\<SID>\SYS\exe\jvm\NTAMD64\sapjvm_5.1.024\sapjvm_5\jre

set PATH=%PATH%;%JAVA_HOME%\bin

\esourcing70\bin\configure.exe

IDelimit2.png

This will open the configure tool

IDelimit3.png

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)

IDelimit4.png

Select the J00 folder  – (/usr/sap/<SID>/J00 folder) and click on Next

IDelimit5.png

Select the Jar file which you wish to deploy , in this case “MyFirstSourcingCode-0.1.jar” and click on Next .

IDelimit6.png

Click on Install.

IDelimit7.png

IDelimit8.png

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

  \usr\sap\<SID>\J10\j2ee\JSPM\go.bat

3.       Login as Administrator

IDelimit9.png

1.       Select  “Single support packages and Patches( Advanced users only)  and click on Next

IDelimit10.png

IDelimit11.png

Cliclick on Next

IDelimit12.png

IDelimit14.png

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.

IDelimit15.png

Enter the values as appropriate in your case

IDelimit16.png

Enter the code in the script section

IDelimit17.png

import com.temp.*;

// 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.

IDelimit18.png

IDelimit19.png

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.

I

I a

To report this post you need to login first.

12 Comments

You must be Logged on to comment or reply to a post.

  1. Isaac Ariza Cruz

    Hello Prashanth,

    First of all, thanks a lot for this great post. It has been really helpful.

    But I would need support by the following situation:

    I’ve followed the actions described by you and I’ve tried to call this class through the toolbar script but following error is raised:

    “Source file: inline evaluation of: “import com.temp.*; // Instantiate the class object MyFirstSourcingCode  customJarObj =…\’\’: Typed variable declaration: Class: MyFirstSourcingCode not found in namespace”

    Therefore, I guess that I’ve done something wrong or there are some steps pending to be done.

    Could you please answer to the following questions:

    – Before to start these actions, should I stop the E-Sourcing server through NWA?

    – Before to deploy the SCA file, should I undeploy existing SCA file by following statement?

    UNDEPLOY name=E-Sourcing-Server vendor=sap.com on_undeploy_error=stop

    Thanks in advance and best regards,

    Isaac

    (0) 
    1. Prashanth Kiran Post author

      Thanks Isaac,

      Going by the error , it seems like jar is not deployed into the server.

      As it is not able to identify the MyFirstSourcingCode class.

      After the deployment .sca file , server needs to be restarted. My server is configured in such way that it restarts automatically once the .sca file is deployed. If your server is not restarted after the deployment, please restart the server.

      Hope this may resolved the issue.

      I have gone thru once again on the blog if I have missed any key steps. did not find anything missing

      – Before to start these actions, should I stop the E-Sourcing server through NWA?

      No

      – Before to deploy the SCA file, should I undeploy existing SCA file by following statement?

      It will overwrite the existing SCA file.

      regards

      pkiran

      (0) 
      1. Isaac Ariza Cruz

        Hello Prashanth,

        Thanks a lot for your quick answer. Just to clarify it: when you say server needs to be restarted: do you mean restart the server (machine) where E-Sourcing is installed instead of START & STOP the E-Sourcing Java application, isn’t it?

        Because I’ve already done a START & STOP E-Sourcing Java application after .SCA deployment and it is still no working. So I guess that what I need to do next is to restart the machine (server) where E-Soucing is installed, isn’t it?

        Thanks again for your support.

        Best regards,

        Isaac

        (0) 
        1. Prashanth Kiran Post author

          Hi ,

          As said earlier , it seems like the runtime is unable to recognize the class in the system.

          In this case I would look at the very instance of jar deployment part.

          I have done this many times during the development phase, not even once it failed and the behavior is very consistent. so please look keenly on the deployment part steps.

          regards

          pkiran

          (0) 
          1. Isaac Ariza Cruz

            Hi Prashanth,

            Thanks again for your answers.

            I’ve deeply analyze deployment steps and I’ve followed them according to your comments but same results.

            I’ve seen that your steps are executed to include custom JAR files on eSourcing 7. I’m executing these steps on eSourcing 9. Could it be the reason? Maybe the steps to be executed for eSourcing 9 are a little bit different?

            Thanks again and best regards,

            (0) 
            1. Prashanth Kiran Post author

              Hi Isaac,

              This works on wave 7 but not sure whether it works on wave 9.

              But there is one more blog on this on wave 9. can you please check with that blog.

              Sorry I do not have the link , otherwise would have pasted the link.

              regards

              pkiran

              (0) 
              1. Isaac Ariza Cruz

                Hi again Prashanth,

                Thanks again for your quick response.

                I’m working in parallel with following blog: http://scn.sap.com/community/sourcing/blog/2013/08/10/adding-custom-jar-files-to-e-sourcing

                Are you referring to that one?

                Anyway and according to that blog, I’ve modified .EAR file and i will execute following steps:

                1. Telnet command: UNDEPLOY name=E-Sourcing-Server vendor=sap.com on_undeploy_error=stop

                2. Telnet command: DEPLOY <esoserver.ear file path> version_rule=all

                Hopefully, it will deploy it into the SAP NW.

                Please, don’t hesitate to let me know your thoughts.

                Thanks and best regards,

                Isaac


                (0) 
              2. Isaac Ariza Cruz

                Hi Prashanth,

                Tested also with TELNET command and it is not working.

                It leads me to the question: the JAR file… needs to be created in a special way? Currently I’m creating it using ECLIPSE IDE.

                Should it be created by a special way?

                Thanks again and best regards,

                Isaac

                (0) 
                1. Prashanth Kiran Post author

                  Sorry was busy with regular work , did not get a chance to look into it.

                  I have created the Jar file using NDWS using Maven build utility. I do not think it will have any difference on this . May be I will write a blog on this topic to help others who are struggling on this type of issues.

                  in your case , that should not be a problem whether you create a jar file using eclipse or NWDS.

                  regards

                  pkiran

                  (0) 
                  1. Gary Boutin

                    I’m not sure where this process is going wrong. But there is no need to use command line tools to deploy the SCA file. (NOT EAR file).  Also ther is no need to manually manipulate the archive. You can simply build a new custom jar and add it to the deployment using the supplied configure utility in the sourcing root /bin directory.  It will build the new SCA file for deployment using the standard Neytweaver deployment tool. 

                    (0) 

Leave a Reply