Tuesday, February 7, 2023

Prevent error activating calculated view in new schemas: user is not authorized (2950)

 

Scenario: you want to create a Calculation View and once you execute receive error .


Repository: Encountered an error in repository runtime extension;Model inconsistency. Create Scenario failed: The following errors occurred: user is not Authorize (2950)



Solution :


Run the below command for each Schema.


GRANT SELECT ON SCHEMA "SBOCONENERGY_TEST" TO _SYS_REPO WITH GRANT OPTION;

Tuesday, December 27, 2022

Extract Chart of Account COA Query

 

Select  AccountCode,AccountName,Title  from (

   Select OACT.AcctCode as AccountCode, OACT.AcctName as AccountName,OACT.GroupMask,OACT.GrpLine,OACT.Postable as Title

   from OACT

   Where OACT.Postable='Y'


   UNION ALL


   Select OACT.AcctCode as AccountCode, OACT.AcctName as AccountName,OACT.GroupMask,OACT.GrpLine,OACT.Postable as Title

   from OACT

   Where OACT.Postable='N'

   ) as T


   ORDER BY T.GroupMask,T.GrpLine


Sunday, December 4, 2022

[Part 1-3] Single Sign on Connection

Properties current SAP Connection command line argument: 0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056 


using System;

using System.Collections.Generic;

using System.Linq;

using System.Threading.Tasks;

using System.Windows.Forms;

using SAPbobsCOM;


namespace MySAPB1WinFormApp

{


  



    static class Program

    {

        /// <summary>

        /// The main entry point for the application.

        /// </summary>

        /// 


        public static SAPbouiCOM.Application oApplication = null;

        public static SAPbobsCOM.Company oCompany = null;

        [STAThread]

        static void Main()

        {

            if(IsSAPConnected()==true)

            {


            }

        }



        public static bool IsSAPConnected()

        {

            try

            {

                int oErrorValue = -1;

                string oErrorMessage = string.Empty;



                //***Step:1

                //***** in this step we getting the Application 

                SAPbouiCOM.SboGuiApi oSboGuiApi = new SAPbouiCOM.SboGuiApi();

                string[] strCon = Environment.GetCommandLineArgs();

                oSboGuiApi.Connect(strCon[1]);

                oApplication = oSboGuiApi.GetApplication(-1);

                //**************************************************



                oApplication.StatusBar.SetText("SampleFormAddon is Connection", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);



                //*** Step 2

                // in this step company object generates the cookie for the current session  with the help of  method  GetContextcookie()


                oCompany = new SAPbobsCOM.Company();

                string oCookies =(string) oCompany.GetContextCookie();


                //**********************************************************


                //*** Step 3

                //****** in this step  GetConnectionContext(oCookies) method of the application object encrypt the connection string with the help of Cookies provided by the DI API


                string constr = oApplication.Company.GetConnectionContext(oCookies);


                //*************************************


                if (oCompany.Connected == true)

                    oCompany.Disconnect();


                //***Step4

                //*** in this step  setsbologincontext(constr) method of company object deciphers the encrypted  connection information and sets the connection parameter to the company object


                oCompany.SetSboLoginContext(constr);

                //**************************************************



                ///**Step 5

                ///*** in this step with the help of connect() method we establish connection with the company


                oErrorValue = oCompany.Connect();


                if (oErrorValue == 0)

                {

                    oApplication.MessageBox("Single Sign on  connection established", 1, "Alert", "", "");

                    return true;

                }


                else

                    oCompany.GetLastError(out oErrorValue, out oErrorMessage);

                    oApplication.MessageBox("ErrorCode" + oErrorValue + "ErroMessage" + oErrorMessage.ToString(), 1, "Error", "", "");

                    return false;


            }

            catch (Exception ex)

            {


                throw new Exception(ex.ToString());

            }

        }

    }

}

Crystal Report Formula Convert Amount into Words

 numbervar x := {OINV.DocTotal};


numbervar ipart;


numberVar decpart;


ipart := int(x);


decpart := x - ipart;


Propercase(Replace(towords(ipart)," and xx / 100",""))& " Ringgit" &


if decpart = 0 then "" else " and "&Propercase(Replace(towords(decpart*100)," and xx / 100","")) &" sen";

Tuesday, June 21, 2022

save and Run SQL Queries in SAP Business one

 

Step 1: Go to Tools > Query generator >



Step 2:  Query Generator window show> Click Execute



Step 3: click on edit button and paste the query and execute


Step4: Save the Query for future.


















                                                                                                                                                         





Tuesday, April 5, 2022

SAP HANA IMPORT AND EXPORT DB

 IMPORT "MTU_LIVE_V2"."*" AS BINARY FROM '/hana/shared/backup_service/backups/V2/'

WITH IGNORE EXISTING THREADS 10 

RENAME SCHEMA  MTU_LIVE_V2 TO MTU_TESTING_V2;





Thursday, March 31, 2022

https://blogs.sap.com/2015/05/29/updating-exchange-rates-automatically-in-sap-business-one/

 Using DI API:

 https://blogs.sap.com/2015/05/29/updating-exchange-rates-automatically-in-sap-business-one/



Using B1IF:

https://blogs.sap.com/2015/06/23/how-to-import-exchange-rates-using-b1if/



Using Service Layer and HANAXS:


https://blogs.sap.com/2018/08/27/update-sap-b1-rates-using-hana-xs-and-servicelayer/

2315907 - Starting HANA automatically after Host has been started

  Symptom By default the SAP HANA database is configured so that it is not started automatically when the SAP HANA host is rebooted. Environ...