Thursday, March 16, 2017

Get Items Count from Library/List from SiteCollection



############################################################
#Script to get all Library item count from the sitecollection and subsites
# Required Parameters:
#  -> $sUserName: User Name .
#  -> $sPassword: Password for the user.
#  -> $sDomain: AD Domain for the user.
#  -> $sSiteColUrl: Site Collection Url.
##########################################################

$host.Runspace.ThreadOptions = "ReuseThread"

#To get all Library item count from the sitecollection and subsites
function Get-SPAllDocCountInSiteCol
{



    param ($sSiteColUrl,$sUserName,$sDomain,$sPassword)
    try
    {  Clear-Host ""
        Write-Host "------------------------------------------------------------"  -foregroundcolor Gray
        Write-Host "Getting all Library/List Item count in a SharePoint Site" -foregroundcolor Gray
        Write-Host "-----------------------------------------------------------"  -foregroundcolor Gray
   
     $OpFilePath="Result.csv"
        #Adding the Client Object Model Assemblies  
        Add-Type -Path "Microsoft.SharePoint.Client.dll"
        Add-Type -Path "Microsoft.SharePoint.Client.Runtime.dll"

        #SPO Client Object Model Context
        $spContext = New-Object Microsoft.SharePoint.Client.ClientContext($sSiteColUrl)
        $spCredentials = New-Object System.Net.NetworkCredential($sUserName,$sPassword,$sDomain)
        $spContext.Credentials = $spCredentials

        #Root Web Site
        $spRootWebSite = $spContext.Web
        #Collecction of Sites under the Root Web Site
        $spSites = $spRootWebSite.Webs

        #Loading Operations
     
        $spContext.Load($spRootWebSite)
        $spContext.Load($spSites)

        #Get All Library and List from Root Site
        $spRootWebLists=$spRootWebSite.Lists
        #Loading Operations
        $spContext.Load($spRootWebLists)
        #QueryExecution
        $spContext.ExecuteQuery()

        #Delete File if Exists
        If(Test-Path $OpFilePath){
        Remove-Item $OpFilePath
        }

        $text =    "Site Title,Site URL ,Library/List Name ,Type,Items Count ,OverAll Count "
        #Create New File
        $text | Set-Content $OpFilePath
       

        $fCount=0

        #Print Statement
        Write-Host $spRootWebSite.Title " - " $spRootWebSite.Url -ForegroundColor Cyan
        Write-Host "------------------------------------------"  -ForegroundColor Magenta

        #Append the content into File
        $text =    $spRootWebSite.Title +","+ $spRootWebSite.Url+", , , , "
        $text | Add-Content $OpFilePath

        #We need to iterate through the $spRootWebLists Object in order to get individual Library/List information
        foreach($spRootWeblist in $spRootWebLists)
        {
            #Item Count for each Library
            Write-Host $spRootWeblist.Title " - " $spRootWeblist.ItemCount  -ForegroundColor Green
            #Sum of each Library Item Count
            $fCount=$fCount+$spRootWeblist.ItemCount
            #Append the content into File
            $text =   " , , "+ $spRootWeblist.Title +","+$spRootWeblist.BaseType+" ,"+ $spRootWeblist.ItemCount+", "
            $text | Add-Content $OpFilePath
        }
        #Overall Item Count from the Site
        Write-Host "OverAll Count : " $fCount -ForegroundColor White
        #Append the content into File
        $text =   " , , , , , "+$fCount
        $text | Add-Content $OpFilePath
           
        Write-Host "============================================="  -ForegroundColor Yellow


       #We need to iterate through the $spSites Object in order to get individual sites information
        foreach($spSite in $spSites){
            Write-Host $spSite.Title " - " $spSite.Url -ForegroundColor Cyan
            Write-Host "------------------------------------------"  -ForegroundColor Magenta
            #Append the content into File
            $text =    $spSite.Title +","+ $spSite.Url+", , , , "
            $text | Add-Content $OpFilePath

            #Get All Library and List from the Site
            $spLists=$spSite.Lists
       
            #Loading Operations
            $spContext.Load($spLists)
            #QueryExecution
            $spContext.ExecuteQuery()
            $fCount=0

            #We need to iterate through the $spRootWebLists Object in order to get individual Library/List information
            foreach($splist in $spLists)
            {
                #Item Count for each Library
                Write-Host $splist.Title " - " $splist.ItemCount  -ForegroundColor Green
                #Sum of each Library Item Count
                $fCount=$fCount+$splist.ItemCount
                #Append the content into File
                $text =   " , , "+ $splist.Title +","+$spRootWeblist.BaseType+" ,"+ $splist.ItemCount+", "
                $text | Add-Content $OpFilePath
            }
            Write-Host "OverAll Count : " $fCount -ForegroundColor White
            Write-Host "============================================="  -ForegroundColor Yellow
            #Append the content into File
            $text =   " , , , , , "+$fCount
            $text | Add-Content $OpFilePath
        }
        $spContext.Dispose()

   
    }
    catch [System.Exception]
    {
        write-host -f red $_.Exception.ToString()
    }  
}

#Required Parameters
$sSiteColUrl = "https://www.sample.com"
$sUserName = "username"
$sDomain="domainName"
$sPassword ="Password"


Get-SPAllDocCountInSiteCol -sSiteColUrl $sSiteColUrl -sUserName $sUsername -sDomain $sDomain -sPassword $sPassword

Monday, February 6, 2017

Covert DateTime format from UTC to Local time by JavaScript

1. Upload the JavaScript file in Style Library and Published.
2. Register this uploaded JavaScript in the Master Page.
3. Call the DateTime format function like below:


 dateFormat(new Date(item.ArticleStartDate), 'mm/dd/yyyy')

4. Please find the JavaScript as below: (Copy and Past the Note pad and save as "date.format.js")



var dateFormat = function () {
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
timezoneClip = /[^-+\dA-Z]/g,
pad = function (val, len) {
val = String(val);
len = len || 2;
while (val.length < len) val = "0" + val;
return val;
};

// Regexes and supporting functions are cached through closure
return function (date, mask, utc) {
var dF = dateFormat;

// You can't provide utc if you skip other args (use the "UTC:" mask prefix)
if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) {
mask = date;
date = undefined;
}

// Passing date through Date applies Date.parse, if necessary
date = date ? new Date(date) : new Date;
if (isNaN(date)) throw SyntaxError("invalid date");

mask = String(dF.masks[mask] || mask || dF.masks["default"]);

// Allow setting the utc argument via the mask
if (mask.slice(0, 4) == "UTC:") {
mask = mask.slice(4);
utc = true;
}

var _ = utc ? "getUTC" : "get",
d = date[_ + "Date"](),
D = date[_ + "Day"](),
m = date[_ + "Month"](),
y = date[_ + "FullYear"](),
H = date[_ + "Hours"](),
M = date[_ + "Minutes"](),
s = date[_ + "Seconds"](),
L = date[_ + "Milliseconds"](),
o = utc ? 0 : date.getTimezoneOffset(),
flags = {
d:    d,
dd:   pad(d),
ddd:  dF.i18n.dayNames[D],
dddd: dF.i18n.dayNames[D + 7],
m:    m + 1,
mm:   pad(m + 1),
mmm:  dF.i18n.monthNames[m],
mmmm: dF.i18n.monthNames[m + 12],
yy:   String(y).slice(2),
yyyy: y,
h:    H % 12 || 12,
hh:   pad(H % 12 || 12),
H:    H,
HH:   pad(H),
M:    M,
MM:   pad(M),
s:    s,
ss:   pad(s),
l:    pad(L, 3),
L:    pad(L > 99 ? Math.round(L / 10) : L),
t:    H < 12 ? "a"  : "p",
tt:   H < 12 ? "am" : "pm",
T:    H < 12 ? "A"  : "P",
TT:   H < 12 ? "AM" : "PM",
Z:    utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
o:    (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
S:    ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
};

return mask.replace(token, function ($0) {
return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1); 
});
};
}();

// Some common format strings
dateFormat.masks = {
"default":      "ddd mmm dd yyyy HH:MM:ss",
shortDate:      "m/d/yy",
mediumDate:     "mmm d, yyyy",
longDate:       "mmmm d, yyyy",
fullDate:       "dddd, mmmm d, yyyy",
shortTime:      "h:MM TT",
mediumTime:     "h:MM:ss TT",
longTime:       "h:MM:ss TT Z",
isoDate:        "yyyy-mm-dd",
isoTime:        "HH:MM:ss",
isoDateTime:    "yyyy-mm-dd'T'HH:MM:ss",
isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
};

// Internationalization strings
dateFormat.i18n = {
dayNames: [
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
],
monthNames: [
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
]
};

// For convenience...
Date.prototype.format = function (mask, utc) {
return dateFormat(this, mask, utc);
};

Wednesday, July 20, 2016

Windows PowerShell - "running scripts is disabled on this system."

When I try to execute my .ps1 script in Windows PowerShell ISE window, it is throwing exception like below:

"cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
    + CategoryInfo          : SecurityError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnauthorizedAccess  "

I found the solution one the article from the Internet.

This error happens due to a security measure which won't let scripts be executed on your system without you having approved of it. 

You can do it by set the execution policy in powershell command window.

Open the Windows PowerShell with "Run as administrator" and enter the below command:

set-executionpolicy remotesigned

Thursday, April 28, 2016

How to get Image from Picture Library using REST API

I used REST API to get the Image form Picture Library and display my Banner Dynamically.

I used normal RESTful HTTP url like asusual Path and Query string param in the sequence of SELECT, FILTER and ORDER BY accordingly  but I am not able to get "EncodedAbsUrl"  in the result.

After I googled I got some idea, form some forums.

Like I used SELECT statement as a last querystring param, like below:

http://sharePointchild.com/_api/Web/Lists/GetByTitle('HomeBanner')/Items?filter=IsActive%20eq%201&$top=1&$orderby=IsActive%20desc&$select=EncodedAbsUrl

Code:

$(document).ready(function(){

var siteColUrl=_spPageContextInfo.siteAbsoluteUrl;

$.ajax({
method:"GET",
headers:{"Accept":"application/json; odata=verbose"},
url:siteColUrl+"/_api/Web/Lists/GetByTitle('HomeBanner')/Items?filter=IsActive%20eq%201&$top=1&$orderby=IsActive%20desc&$select=EncodedAbsUrl",
success: function (data) {

        completeBannerdata(data);
   }
   ,
    error: function (error) {

              failiureBannerdata(error);
         
        }

});

})

function completeBannerdata(data)
{

var items = data.d.results;
if(items.length>0)
{
       $('#imgBanner').attr('src', items[0]["EncodedAbsUrl"]);
       }
}

 function failiureBannerdata(error)
 {

 }

SharePoint 2013 Error When Trying to Create New Publishing Page

I have Own content type which is base by Article pages, and associated with my Pages Library.
The library contains "articles" folder, we are placing all article relavant pages under this folder.
When user create a new page via "Add a page" link, we are moving that page from root folder to article folder via content organizer rule.

For testing, when I try to create a new Publishing page via "Add a Page" option, it got the error as below:

Invalid field name. {50631c24-1371-4ecf-a5ae-ed41b03f4499}   

I googled and got some reference,
we needs to add some of the fields to our content type.

Solution:

1. Go to the Content type page
2. Add the below columns to your content type:
    a. Hide from Internet Search Engines 
    b. Hide physical URLs from Search
    c. Meta Description
    d. Meta Keywords

set yes, for update all content types inheriting from this type. If required.

Click Ok.

Thursday, April 21, 2016

How to View PDF & HTML Files in Browsers in SharePoint 2013

The more secure way is to display PDF and HTML file in the browse are ShaerPoint portal. Add the MIME type of PDF and HTML file into your WebApplication's AllowedInlineDownloadedMimeTypes. Instead of enable the Permissive Option at Browser Handling section in WebApplication's General Settings.

Execute the below script in SharePoint PowerShell cmdlets:

$webApp = Get-SPWebApplication("http://www.samples.com")
$webApp.AllowedInlineDownloadedMimeTypes.Add("application/pdf")
$webApp.AllowedInlineDownloadedMimeTypes.Add("text/html")
$webApp.Update()

Friday, April 24, 2015

DotNet-SAP Connector - How to Read/Write data to SAP from DotNet



Read and Write data into SAP by DotNet console application.
1. Create VS console application.
2. To connect to SAP need 3 ddl as below:

  •  SAPConnectionManager
  • sapnco
  • sapnco_utils
download the above dlls and add into your application as a reference.

3. Enter SAP configuration settings entries in the app.config app settings.


<appSettings>
    <add key="SAP_ApplicationServerHost" value="ServerName/IP"/>
    <add key="SAP_SystemID" value="DEV"/>
    <add key="SAP_SystemNumber" value="00"/>
    <add key="SAP_User" value="userid"/>
    <add key="SAP_Password" value="password"/>
    <add key="SAP_Client" value="040"/>
    <add key="SAP_Language" value="EN"/>
</appSettings>

4. Add one new class for SAP configuration.
add "SAP.Middleware.Connector" namespace.
inherit the IDestinationCofiguration interface, and right click the call on it to implement the interface

using SAP.Middleware.Connector;

namespace SAPConenctCnsl
{
    public class SAPDstinConfig : IDestinationConfiguration
    {
        public bool ChangeEventsSupported()
        {
            return false;
        }

        public event RfcDestinationManager.ConfigurationChangeHandler ConfigurationChanged;


        public RfcConfigParameters GetParameters(string destinationName)

        {
            RfcConfigParameters parms = new RfcConfigParameters();
            parms.Add(RfcConfigParameters.Name, "DEV");
            parms.Add(RfcConfigParameters.AppServerHost, ConfigurationManager.AppSettings["SAP_ApplicationServerHost"]);
            parms.Add(RfcConfigParameters.SystemNumber, ConfigurationManager.AppSettings["SAP_SystemNumber"]);
            parms.Add(RfcConfigParameters.SystemID, ConfigurationManager.AppSettings["SAP_SystemID"]);
            parms.Add(RfcConfigParameters.User, ConfigurationManager.AppSettings["SAP_User"]);
            parms.Add(RfcConfigParameters.Password, ConfigurationManager.AppSettings["SAP_Password"]);
            parms.Add(RfcConfigParameters.Client, ConfigurationManager.AppSettings["SAP_Client"]);
            parms.Add(RfcConfigParameters.Language, ConfigurationManager.AppSettings["SAP_Language"]);
            parms.Add(RfcConfigParameters.PoolSize, "10");

            return parms;


        }

    }
}

5. add one more new class for Interface , to write your logics


using SAP.Middleware.Connector;
namespace SAPConenctCnsl
{
    public class SAPConntInterface
    {
        private RfcDestination rfcDestination;

// To test the connection

        public bool TestConnection(string destinationName)
        {
            bool result = false;

            try

            {
                rfcDestination = RfcDestinationManager.GetDestination(destinationName);
                if (rfcDestination != null)
                {
                    rfcDestination.Ping();
                    result = true;
                }

            }

            catch (Exception ex)
            {

                result = false;

                throw new Exception("Connection Failed :" + ex.Message);
            }
            return result;
        }
// Getting data with out RFC parameters
 public DataTable GET_VENDOR_CODE(string destinationName)
        {
            RfcRepository rfcRepository = GetRepository(destinationName);
            IRfcFunction rfcFunction = rfcRepository.CreateFunction("Z__GET_VENDOR_CODE");
            rfcFunction.Invoke(rfcDestination);
            IRfcTable tableVendorDetails = rfcFunction.GetTable("GT_VENDORCODE_TAB");
            DataTable dt = new DataTable();
            ConvertToDotNetTable(tableVendorDetails, dt);
            return dt;
        }

// Getting Data from RFC passing string params, and invoke from Table ==> Structure, but return as Table

        public DataTable Get__BANKCODE_Data(string destinationName,string strBankCode)
        {
            RfcRepository rfcRespository = GetRepository(destinationName);
            IRfcFunction rfcFunction = rfcRespository.CreateFunction("Z__GET_BANKCODE_RET");
            IRfcTable t_items = rfcFunction.GetTable("BANK_COUNTRY_KEY");
            RfcStructureMetadata am = rfcRespository.GetStructureMetadata("ZBNKA_BANKS");
            IRfcStructure articol = am.CreateStructure();
            articol.SetValue("ZBANKS",strBankCode);
            t_items.Append(articol);
            rfcFunction.Invoke(rfcDestination);
            IRfcTable tableBankCode = rfcFunction.GetTable("GT_BNKA");
            DataTable dt = new DataTable();
            ConvertToDotNetTable(tableBankCode, dt);
            return dt;
        }


       //Insert data into One table

public void test(string destinationName)
        {
            try
            {
         RfcRepository rfcRepository = GetRepository(destinationName);
        IRfcFunction bapiTEST = rfcRepository.CreateFunction("Z__SET_PAYMENT_PLAN");
             IRfcTable tblInput = bapiTEST.GetTable("GT_CPP");

             RfcStructureMetadata metaData = rfcRepository.GetStructureMetadata("Z_CPP_TAB");

             IRfcStructure tblInputSt = metaData.CreateStructure();

             tblInputSt.SetValue("SCHONO", "10000001");

             tblInputSt.SetValue("COUTY", "MSY");
             tblInputSt.SetValue("BANKL", "BR");
             tblInputSt.SetValue("ENDDT", "2015-01-01");
    tblInput.Append(tblInputSt);

 IRfcStructure tblInputSt1 = metaData.CreateStructure();


tblInputSt1.SetValue("SCHONO", "11200000");

tblInputSt1.SetValue("COUTY", "MSY");
tblInputSt1.SetValue("BANKL", "BR");
tblInputSt1.SetValue("ENDDT", "2015-01-01");
tblInput.Append(tblInputSt1);
   
RfcSessionManager.BeginContext(rfcDestination);
bapiTEST.Invoke(rfcDestination);
IRfcTable t_items = bapiTEST.GetTable("LOG");
        List<string> lstReturn = new List<string>();
if (t_items.RowCount > 0)
{
   for (int i = 0; i < t_items.RowCount; i++)
   {
       lstReturn.Add(t_items[i].GetString(0));
   }
      }

RfcSessionManager.EndContext(rfcDestination)

   
            }
            catch (RfcCommunicationException ex)
            {
            }
            catch (RfcLogonException ex)
            {
                // user could not logon...
            }
            catch (RfcAbapRuntimeException ex)
            {
                // serious problem on ABAP system side...
            }
            catch (RfcAbapBaseException ex)
            {
                // The function module returned an ABAP exception, an ABAP message
                // or an ABAP class-based exception...
            }
        }

              //Insert data into mutiple table using Changing RFC Param

        public void SET__SCHOLAR_MASTER(string destinationName, DataSet ds)
        {
            try
            {

            

            object obj = null;
            RfcRepository rfcRepository = GetRepository(destinationName);
            IRfcFunction rfcFunction = rfcRepository.CreateFunction("Z__SET_SCHOLAR_MASTER");
            foreach (DataTable dt in ds.Tables)
            {
            IRfcTable tblGTCPP = rfcFunction.GetTable(dt.TableName);
            string strTblStName = string.Empty;
            if (dt.TableName.Contains("GT_ZT"))
            {
                strTblStName = dt.TableName.Replace("GT_Z", "");
            }
            //GT_ZB011
            if (dt.TableName.Contains("GT_ZB"))
            { 
                strTblStName = dt.TableName.Replace("GT_", "");
            }
            RfcStructureMetadata metaData = rfcRepository.GetStructureMetadata(strTblStName);
            IRfcStructure tblInputStructM = metaData.CreateStructure();

            

                foreach (DataRow dr in dt.Rows)
                {
                    IRfcStructure tblInputStruct = metaData.CreateStructure();
                    foreach (DataColumn column in dt.Columns)
                    {
                        obj = dr[column];
                        tblInputStruct.SetValue(column.ToString(), obj);

                    }

                    
                    tblGTCPP.Append(tblInputStruct);
                }
            }

            RfcSessionManager.BeginContext(rfcDestination);

            rfcFunction.Invoke(rfcDestination);
            IRfcTable tblLog = rfcFunction.GetTable("LOG");

            List<string> lstReturn = new List<string>();

            if (tblLog.RowCount > 0)
            {
                for (int i = 0; i < tblLog.RowCount; i++)
                {
                    lstReturn.Add(tblLog[i].GetString(0));

                }


            }

            RfcSessionManager.EndContext(rfcDestination);
            }
            catch (RfcCommunicationException ex)
            {
            }
            catch (RfcLogonException ex)
            {
                // user could not logon...
            }
            catch (RfcAbapRuntimeException ex)
            {
                // serious problem on ABAP system side...
            }
            catch (RfcAbapBaseException ex)
            {
                // The function module returned an ABAP exception, an ABAP message
                // or an ABAP class-based exception...
            }
        }
      
// Build Repository        
        private RfcRepository GetRepository(string destinationName)
        {
            rfcDestination = null;
            rfcDestination = RfcDestinationManager.GetDestination(destinationName);
            RfcRepository rfcRepository = rfcDestination.Repository;
            return rfcRepository;
        }

// Convert to DotNet DataTable

        private static void ConvertToDotNetTable(IRfcTable tableVendorDetails, DataTable dt)
        {
            for (int i = 0; i < tableVendorDetails.ElementCount; i++)
            {
                RfcElementMetadata metadata = tableVendorDetails.GetElementMetadata(i);
                dt.Columns.Add(metadata.Name);
            }
            foreach (IRfcStructure row in tableVendorDetails)
            {
                DataRow dr = dt.NewRow();
                for (int elem = 0; elem < tableVendorDetails.ElementCount; elem++)
                {
                    RfcElementMetadata metadata = tableVendorDetails.GetElementMetadata(elem);
                    
                }
                dt.Rows.Add(dr);
            }
        }

        


        public DataSet buildTestChangeDataSet()

        {
            DataSet ds = new DataSet();

            // Table GT_ZT9B01

            DataTable dtGT_ZT9B01 = new DataTable("GT_ZT9B01");
             
                     
            dtGT_ZT9B01.Columns.Add("MANDT", typeof(string));
            dtGT_ZT9B01.Columns.Add("DISPCD", typeof(int));
            dtGT_ZT9B01.Columns.Add("DISPNAME", typeof(string));
            dtGT_ZT9B01.Columns.Add("COURSE", typeof(int));
            dtGT_ZT9B01.Columns.Add("CATEG", typeof(int));

            DataRow drGT_ZT9B01 = dtGT_ZT9B01.NewRow();

            
            drGT_ZT9B01["MANDT"] = "2014-01-01";
            drGT_ZT9B01["DISPCD"] = 2;
            drGT_ZT9B01["DISPNAME"] = "BR";
            drGT_ZT9B01["COURSE"] = 2;
            drGT_ZT9B01["CATEG"] = 3;

            dtGT_ZT9B01.Rows.Add(drGT_ZT9B01);


            drGT_ZT9B01 = dtGT_ZT9B01.NewRow();


            drGT_ZT9B01["MANDT"] = "2014-02-02";

            drGT_ZT9B01["DISPCD"] = 21;
            drGT_ZT9B01["DISPNAME"] = "BR";
            drGT_ZT9B01["COURSE"] = 2;
            drGT_ZT9B01["CATEG"] = 3;

            dtGT_ZT9B01.Rows.Add(drGT_ZT9B01);



            // Table GT_ZT9B08

            DataTable dtGT_ZT9B08 = new DataTable("GT_ZT9B08");
           // dtGT_ZT9B08.DisplayExpression = "T9B08";

            dtGT_ZT9B08.Columns.Add("CLIENT", typeof(string));

            dtGT_ZT9B08.Columns.Add("LEVSD", typeof(int));
            dtGT_ZT9B08.Columns.Add("DESCRIP", typeof(string));
           
            DataRow drGT_ZT9B08 = dtGT_ZT9B08.NewRow();

            drGT_ZT9B08["CLIENT"] = "111";

            drGT_ZT9B08["LEVSD"] = 2;
            drGT_ZT9B08["DESCRIP"] = "BR1";
            
            dtGT_ZT9B08.Rows.Add(drGT_ZT9B08);

            drGT_ZT9B08 = dtGT_ZT9B08.NewRow();


            drGT_ZT9B08["CLIENT"] = "112";

            drGT_ZT9B08["LEVSD"] = 21;
            drGT_ZT9B08["DESCRIP"] = "BR2";

            dtGT_ZT9B08.Rows.Add(drGT_ZT9B08);


            // adding tables into dataset


            ds.Tables.Add(dtGT_ZT9B08);

            ds.Tables.Add(dtGT_ZT9B01);
             
            return ds;
        
        }
    }

}

6. At Program file


            string destinationConfigName = "DEV";
            IDestinationConfiguration destinationConfig = null;
            

             SAPConntInterface objSAPConntInterface = new  SAPConntInterface();

            objSAPConntInterface.TestConnection(destinationConfigName);
           objSAPConntInterface.GET__VENDOR_CODE(destinationConfigName);         
           objSAPConntInterface.Get__BANKCODE_Data(destinationConfigName, "MYS");
           objSAPConntInterface.test(destinationConfigName);
           
          DataSet ds=  objSAPConntInterface.buildTestChangeDataSet();

          objSAPConntInterface.SET__SCHOLAR_MASTER(destinationConfigName, ds);