Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Unsetting SetCurrentLine in DI API for B1

I am writing a method in which users input data into a PHP form and the data gets sent into SAP. The one hangup I have is working with SetCurrentLine, specifically when a user attempts to update a BP Address and also add a new BP Address. First I have to check to see if the Address already exists, so I do a For loop as such:

for ($i=0; $i<$oBP->Addresses->Count; $i++) {

$oBP->Addresses->SetCurrentLine($i);

     if ($oBP->Addresses->AddressName == $billname && $oBP->Addresses->AddressType == 1) {

     //code here

     }

}

However, if I then wish to add a new address as such:

$oBP->Addresses->AddressType = 0;

  $oBP->Addresses->AddressName = 'test';

  $oBP->Addresses->add();

it still has SetCurrentLine set from the for loop and thus just overwrites the address at the last LineNum. Is there a way to UnsetCurrentLine i.e. tell the DI API that I want to input a new address as opposed to working on the current LineNum? I'm not sure how to work around this issue.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question