cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Update CardCode SDK - DI API

Former Member
0 Likes
862

Hello!

Is there any way or you may modify the CardCode a Business Partner from the SDK,

so far I only update fields as cardCode, CardType, etc, but when I update the CardCode throws me the error -2035, which as I saw in the documentation is that "Data Source - Duplicate Keys" the cardCode is duplicated.

Here is the code (this in php):

<?php

try {

    if(!$sap->Connected)

        $sap->Connect();

    if($sap->Connected) {

        $oBO = $sap->GetBusinessObject(2);

        if ($oBO->GetByKey('CL-7777776') == true) {

            $oBo->CardCode='CL-7777777';

            $VALOR = $oBo->Add();

            if($VALOR != 0)

                echo 'ERROR : ' . $ERR. '<br>';

        }

        $sap->Disconnect();

    }

    else {

        echo 'No Conectado';

    }

}

catch (Exception $e) {

    echo 'ERROR: <br />' . $e  . '<br />';

    echo $sap->GetLastErrorDescription() . '<br />';

}

?>

View Entire Topic
Former Member
0 Likes

Hi,

I guess you are trying to add new bp

   $oBo->CardCode='CL-7777777';

            $VALOR = $oBo->Add();

if seems that card code is already exists. If  you want to update any existing transaction / master files, you need to use GetByKey function to get existing record and then fire update method.

Hope this will clear your confusion.