Skip to Content

What is QCI  – Introduction:

 

     

      1. The API/ASTM standards and the implementation rules are issued by the American Petroleum Institute (API), the American Society for Testing and Materials (ASTM) and the Institute of Petroleum (IP).

     

    Initially Tables were introduced that contained the conversion factors based on Density , Pressure & Temperature ranges. With the advent of IT, we now have C Routines / ABAP Implementations which now compute the Volume Conversion Factor   

       

        1. On behalf of the SAP ERP System, we have a Quantity Conversion Interface which talks to the external routines and gets back a Volume Conversion Factor which is used to determine the standardized quantity within SAP.

       

      Currently SAP IS-Oil customers could choose to interface with C Routines provided by FlowCal [ API initially sold these routines directly, but later on they decided to partner with FlowCal to sell & support these routines – Visit http://www.flowcal.com/products/api.html  for more information ] or ABAP Implementation from QuantityWare [ [www.quantityware.com | http://www.quantityware.com/] ] or their own ABAP implementations based on the global standards  .

         

         This Blog is specifically written for all customer who have decided to go ahead implementing their QCI with API provided C Routines from FlowCal.

        h3. How to get Started:                  

        Pre-Requisites for Windows Compilation of ASTM 2004 C Routines provided by FlowCal


        Procure the ASTM 2004 Routines from API [ Contact FlowCal  @ http://www.flowcal.com/products/api.html  ]

           

          Download & Install Microsoft Visual Studio Professional Edition 2008 on the Server. . You could download this from the link mentioned here, http://www.microsoft.com/downloads/details.aspx?FamilyID=83c3a1ec-ed72-4a79-8961-25635db0192b&displaylang=en  The Trial version works for 90 days free .

             

              1. Download the ASTM_2004.c file from the SAP Note 970603 and extract the file as shown here, 

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/ASTM_2004-Note970603.jpg|height=330|alt=image|align=absMiddle|width=588|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/ASTM_2004-Note970603.jpg|border=0!

             

            h4.   

            <u>Detailed Steps for Compiling the C Routines using Microsoft Visual Studio 2008:</u>


             

            Step 1: Please perform the following steps to compile. Open the FlowCal CD and you would see the contents as shown below in the screenshot.

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step1.jpg|height=348|alt=image|width=699|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step1.jpg|border=0!

             

             

            Step 2 : Select the Unix Folder  !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step2.jpg|height=21|alt=image|width=55|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step2.jpg|border=0!and open the contents.

             

             

            Step 3 : Copy the APIVCFBA file.

             

              !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step3.jpg|height=88|alt=image|width=589|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step3.jpg|border=0!

             

            Step 4 : Unzip file APIVCFBA.TGZ to any folder. In this example, ASTM_2004_COMPILE

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step4.1.jpg|height=99|alt=image|width=671|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step4.1.jpg|border=0!

             

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step4.2.jpg|height=381|alt=image|width=550|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step4.2.jpg|border=0!

             

            Step 5 : All the source files will be available

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step5.jpg|height=73|alt=image|width=609|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step5.jpg|border=0!

             

            Step 6 : Create new project using MS Visual Studio of type “Win32 Console Application”

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step6.1.jpg|height=405|alt=image|width=640|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step6.1.jpg|border=0!

             

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step6.2.jpg|height=465|alt=image|width=681|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step6.2.jpg|border=0!

             

             

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step6.3.jpg|height=466|alt=image|width=691|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step6.3.jpg|border=0!

             

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step6.4.jpg|height=155|alt=image|width=678|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step6.4.jpg|border=0!

             

            Step 7: Provide name of the project and the path. Click Next

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step7.1.jpg|height=498|alt=image|width=594|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step7.1.jpg|border=0!

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step7.2.jpg|height=499|alt=image|width=615|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step7.2.jpg|border=0!

             

            Step 8 : After clicking on finish you would see the following in your Solution Explorer

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step8.1.jpg|height=227|alt=image|width=205|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step8.1.jpg|border=0!

             

            Also the following Project Folders are now created:

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step8.2.jpg|height=143|alt=image|width=679|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step8.2.jpg|border=0!

             

            Step 9 : Copy Folders include, SRC and RES from Step 5 to the newly created folder for the project.

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step9.1.jpg|height=335|alt=image|width=675|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step9.1.jpg|border=0!

             

            Your project folder would now have the following contents

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step9.2.jpg|height=348|alt=image|width=284|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step9.2.jpg|border=0!

             

            Step 10 : And also copy file ApiVCFBase.rc from root folder of unzipped folder to Res folder of the project.

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step10.jpg|height=62|alt=image|width=448|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step10.jpg|border=0!

             

            Step 11 : Copy WindowsExportTable.h file to the root of the newly created folder.

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step11.jpg|height=315|alt=image|width=448|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step11.jpg|border=0!

             

            Step 12 : Include header files, source files and resource files in the project.

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step12.jpg|height=336|alt=image|width=366|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step12.jpg|border=0!

             

            *Step 13 : After adding all the files your solution explorer should look as shown below,</p><p style=”margin: 0in 0in 10pt” class=”MsoNormal”>!https://weblogs.sdn.sap.com/weblogs/images/252075015/Step13.jpg|height=448|alt=image|width=154|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step13.jpg|border=0!</p><p style=”margin: 0in 0in 10pt” class=”MsoNormal”> </p><p style=”margin: 0in 0in 10pt” class=”MsoNormal”>You could choose to remove the ExampleProgram.c and TestCases.c from the compilation list as they are redundant.</p><p style=”margin: 0in 0in 10pt” class=”MsoNormal”> </p><p style=”margin: 0in 0in 10pt” class=”MsoNormal”>Step 14 :* Now open the newly created project file Step 15 : Paste the coding of astm_2004.c to the above mentioned file keeping all include files intact.

             

            Changes that are needed to be made in the ASTM_2004.cpp file would be the following:

             

            *Change 1: Alter the Buffer size from Len to 5000 by default.</p><p style=”margin: 0in 0in 10pt; text-indent: 0.5in” class=”MsoNormal”> </p><p style=”margin: 0in 0in 10pt; text-indent: 0.5in” class=”MsoNormal”>!https://weblogs.sdn.sap.com/weblogs/images/252075015/Step15.1.jpg|height=393|alt=image|width=661|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step15.1.jpg|border=0!</p><p style=”margin: 0in 0in 10pt 0.5in” class=”MsoNormal”> </p><p style=”margin: 0in 0in 10pt 0.5in” class=”MsoNormal”>Change 2:* Alter the Output Parameters by initializing this to zero for r_altVol & r_baseVol. 

            image

             

            *Change 3: Open the ApiVCFBase.rc file and delete the Statement highlighted  below,</p><p style=”margin: 0in 0in 10pt; text-indent: 0.5in” class=”MsoNormal”> </p><p style=”margin: 0in 0in 10pt; text-indent: 0.5in” class=”MsoNormal”>!https://weblogs.sdn.sap.com/weblogs/images/252075015/Step15.3.jpg|height=238|alt=image|width=648|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step15.3.jpg|border=0!</p><p style=”margin: 0in 0in 10pt; text-indent: 0.5in” class=”MsoNormal”> </p>  <p style=”margin: 0in 0in 10pt” class=”MsoNormal”> </p><p style=”margin: 0in 0in 10pt” class=”MsoNormal”>Step 16:* For compilation the Microsoft Visual Studio settings that are needed are the following:

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step16.1.jpg|height=491|alt=image|width=224|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step16.1.jpg|border=0!

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step16.2.jpg|height=301|alt=image|width=698|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step16.2.jpg|border=0!

             

            Add the Include Folder to the list of the Include Files mentioned below,

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step16.3.jpg|height=270|alt=image|width=646|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step16.3.jpg|border=0!

             

            Change the Pre-Compiled Header settings to the one mentioned below;

             

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/Step16.4.jpg|height=323|alt=image|width=671|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step16.4.jpg|border=0!

             

             

            *Step 17: Final Compilation – Select the ASTM_2004_WIN.CPP file and select compile </p><p style=”margin: 0in 0in 10pt” class=”MsoNormal”> </p><p style=”margin: 0in 0in 10pt” class=”MsoNormal”>!https://weblogs.sdn.sap.com/weblogs/images/252075015/Step17.1.jpg|height=448|alt=image|width=156|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step17.1.jpg|border=0!</p><p style=”margin: 0in 0in 10pt” class=”MsoNormal”> </p><p> <strong>Expected Output:</strong></p><p>!https://weblogs.sdn.sap.com/weblogs/images/252075015/Step17.2.jpg|height=242|alt=image|width=633|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step17.2.jpg|border=0!<strong> </strong> *

             

            *Step 18: Building the Solution</p><p style=”margin: 0in 0in 10pt” class=”MsoNormal”> </p><p>!https://weblogs.sdn.sap.com/weblogs/images/252075015/Step18.1.jpg|height=291|alt=image|width=692|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step18.1.jpg|border=0!</p><p> Expected Output:</strong></p><p> </p><p>!https://weblogs.sdn.sap.com/weblogs/images/252075015/Step18.2.jpg|height=272|alt=image|width=364|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step18.2.jpg|border=0!*

             

            *Step 19: Testing of the Executable</p><p style=”margin: 0in 0in 10pt” class=”MsoNormal”> </p><p style=”margin: 0in 0in 10pt” class=”MsoNormal”>Based on the Output Files Directory mentioned the Executable is created in the Debug Folder</p><p style=”margin: 0in 0in 10pt” class=”MsoNormal”> </p><p>!https://weblogs.sdn.sap.com/weblogs/images/252075015/Step19.1.jpg|height=209|alt=image|width=650|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/Step19.1.jpg|border=0!*

             

            The Executable is listed below,

             

            image * *

             

            Open Command Prompt and go to the Destination of the Compiled Executable and do the following,

             

            image

            *Type <strong>in the following:</strong></p><p>C:\Documents and Settings\i054570\Desktop\QCI Compilation – Documentation\ASTM_2004_COMPILE\ASTM_2004_WIN\Debug>astm_2004_win F_111_71 1.500000000000000E01 1.400000000000000E-03 0.000000000000000E00 0.000000000000000E00 0.000000000000000E00 1.555555533333336E01 0.000000000000000E00 0.000000000000000E00 0.000000000000000E00 0.000000000000000E00 9.990000000000000E02 -1 TEMPERATURE_C ? THERMAL_EXP_REV_C ? ? ? TEMPERATURE_C PRESSURE_PSI ? ? ? ? DENSITY_KGM3 </p><p style=”margin: 0in 0in 10pt” class=”MsoNormal”>The above set of parameters are the one that is passed as test parameters to the QCI Executable</p><p style=”margin: 0in 0in 10pt” class=”MsoNormal”>Expected Output From the Executable is Shown Below:* 

            image</p>h4.   

            <u>After Compilation Process:</u>


            Set Up Customizing in SPRO for QCI Conversion Groups

            !https://weblogs.sdn.sap.com/weblogs/images/252075015/SPRO-SettingofCG.jpg|height=304|alt=image|width=668|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/SPRO-SettingofCG.jpg|border=0!

             

            * O3QCITEST Sample Run</p><p>!https://weblogs.sdn.sap.com/weblogs/images/252075015/o3qcitest-TestCalculation.jpg|height=487|alt=image|width=619|src=https://weblogs.sdn.sap.com/weblogs/images/252075015/o3qcitest-TestCalculation.jpg|border=0!</p><p> </p><p> </p><p>Hope you find the above information helpful for you to go ahead with compiling ASTM 2004 Routines on your Windows Machine. Please drop in your comments / feedback / Suggestions / Issues on the above process in the Comments Section of this Blog or write in directly to me at navneet.kumar.mishra@sap.com .</p><p>Also, if you have compiled these routines on other Operating Systems & Servers [SUN , HP , IBM ], please upload the steps for the benefit of all Oil and Gas Customers.</p><p>Note: After completing the above steps, please apply the SAP Note: 1510931 – ” QCI for Windows : Handling of Float Truncation Issue “. Without applying this Note, all Results from the Executable are skewed owing to a Float Truncation Issue.*

             

             

            To report this post you need to login first.

            16 Comments

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

            1. This was fairly easy to follow.<br/><br/>I did have to add the following include to ASTM_2004_WIN.cpp:  #include <string.h><br/><br/>This was because of compiler errors that where ‘strcmp’ was not found.<br/><br/>And … the change to add the entry with the include directory is actually not under “Properties”, but Tools ==> Options.  (This is was not a big deal as it was fairly easy to figure out, but just thought I would mention it.)<br/><br/>I will let you know how the testing goes tomorrow, but the command line test really makes me smile.  I ran it and now I am going to server testing with a lot more confidence.<br/><br/><br/><br/>

              (0) 
            2. I can follow this entire set of instructions with the exception of what I noted in my previous comment to this blog.

              However, when I attempt to run the O3QCITEST transaction as shown in the last step, I receive the following error: “QCI: RFC-Error: 17-Observed Density out of Range”.

              Any info related to this error would be of interest to me as well.

              (0) 
              1. Navneet.Kumar Mishra Post author
                The Error that you have mentioned is more of an Issue with the Density Input to the Compiled Routines. As known each Conversion Group might have a Density Range that it could standardize. You might consider checking the range of Densities allowed for the Conversion Group.
                (0) 
                1. Well, it looks to me … when I compare the “15DA API_4  15 °C CRUDE OIL IN DENSITY” conversion group to the “534A 53&54A 15 °C CRUDE OIL IN DENSITY” that they are identical.  However when I go to run the test, the Base Relative Density parameter for the 2004 version 15DA is being set to 0.0 while in the old 1980 astm 534A is being set to 821.0.  Perhaps this is the problem, but I cannot find where to set the Base Relative Density for conversion groups. 15DA and 534A look to be configured identically with the exception of the external function call type.

                  Any elaboration on this situation may prove helpful.

                  (0) 
                  1. Navneet.Kumar Mishra Post author
                    The Base Relative Density is defaulted from the Test Relative Density for the 15DA Conversion Group. What are the parameters that you are entering in the O3QCITEST ?
                    An Example that is in range is listed below,

                    Material temperature     20,00     CEL
                    Test temperature     15,00     CEL
                    Test relative density     900,0
                    Air buoyancy indicator                     
                    Air buoyancy factor     0,000000
                    Hydrometer correction indic.     X
                    BSW fraction     0,500000
                    Meter correction factor     1,000000
                    Base relative density     900,0 – This is Read Only in the Calculator as this is derived directly from the Test Relative Density

                    (0) 
                    1. Thanks for your reply on this.

                      I am following your examples exactly as you have indicated.

                      For example when I use the Example you provide above, the Base relative density does not derive. It remains zero.

                      Base relative density 0,0

                      Yet for the old 1980 conversion group 534A it derives correctly to a Base relative density of 900,0 as you indicate.

                      This leads me to believe my issue is in the build of the new ASTM_2004_WIN.exe

                      As I am looking back over your build instructions, I realize that there was one other difference in the code that I actually had to make.  You instructed to add the output parameter r_ctplBaseToAlt.

                      That parameter r_ctplBaseToAlt was actually already in my output list, but the parameter below it r_ctplB was missing in my astm_2004.c file.  So, to make my output list match yours, I added r_ctplB instead.

                      Perhaps I should not have added r_ctplB to the output parameter list?

                      Would you recommend removing the r_ctplB output parameter?

                      (0) 
                      1. Navneet.Kumar Mishra Post author
                        I had a detailed look into this. I agree on removing the r_ctplB Output. This is not needed and was put in for Test Purposes. Thanks so much for testing this out in detail. I would update the Blog with the Updated Screenshot. Please let me know if you face any further issues on this.
                        (0) 
                      2. Navneet.Kumar Mishra Post author
                        r_ctplB was put in for testing purposes. We could safely remove this. I have updated the Blog with this change. Thanks so much for pointing this out to me. Please let me know if you have any other Suggestions on the same.
                        (0) 
            3. Kiichiro Okajima

              Hi,

              Its very useful.

              Unfortunately, I cannot jump to your blogs…

              Can you advise me where I can see those contents or send me a mail.

              Best Regards,

              Kiichiro Okajima

              (0) 
            4. Naresh Jangam

              Dear Navneet,

              The links that are provided are no longer working. Could you please help in updating the right paths for the pictures.

              Thanks,

              Naresh.

              (0) 

            Leave a Reply