cancel
Showing results for 
Search instead for 
Did you mean: 

UI: Opening Sales Order screen and loading with data

Former Member
0 Kudos
181

Hi,

I'm currently using the SDK to develop a new screenin SBO. From my new screen I need to display the sales order screen with an order loaded into it.

I currently open the screen using the ActivateMenuItem methid, then use the sendKeys method to try and change to find mode, pass in the sales order number and press enter to start the search.

The code is this:

moSBOApp.ActivateMenuItem("2050");
moSBOApp.SendKeys("(^f)");
moSBOApp.SendKeys("123");
moSBOApp.SendKeys("{ENTER}");

But the form doesn't seem to change modes, it just stays in "Add" mode. Is there a better way of doing it?

I've also tried putting code in the FORM_LOAD event for the sales order screen and try and change mode then, but I just get an "Invalid Form Mode" error

Help!

Accepted Solutions (1)

Accepted Solutions (1)

AlexGrebennikov
Active Contributor
0 Kudos

Ho Jon!

The following snippet works fine for PO searching by number and date:

SAPbouiCOM.Form		frmPurchOrd = null;
int frmPOCount = 0;
SAPbouiCOM.EditText	oOrdNum;
SAPbouiCOM.EditText	oOrdDate;
SAPbouiCOM.Item		oOrdOkButton;

SBOApp.ActivateMenuItem("2305");

// PO even opened
for (int k=0; k<SBOApp.Forms.Count; k++)
	if (SBOApp.Forms.Item(k).Type == 142)
		frmPOCount++;

frmPurchOrd	= SBOApp.Forms.GetFormByTypeAndCount(142, frmPOCount++);
frmPurchOrd.Freeze(true);

frmPurchOrd.Mode = SAPbouiCOM.BoFormMode.fm_FIND_MODE;
oOrdNum		= (SAPbouiCOM.EditText)frmPurchOrd.Items.Item("8").Specific;
oOrdNum.String	= OrdNum;
oOrdDate	= (SAPbouiCOM.EditText)frmPurchOrd.Items.Item("10").Specific;
oOrdDate.String	= OrdDate.ToShortDateString();
oOrdOkButton	= (SAPbouiCOM.Item)frmPurchOrd.Items.Item("1");
oOrdOkButton.Click(SAPbouiCOM.BoCellClickType.ct_Regular);

frmPurchOrd.Freeze(false);

it's too easy to implement it for Sales Order

Former Member
0 Kudos

I tried your code on the Sales Order screen but It didn't make much difference. I ended up redesigning the screen to make use of the link arrows instead.

Thanks anyway

AlexGrebennikov
Active Contributor
0 Kudos

it's a stubid question, excuse me, but...

... did you replace needed MenuUID and FormType in my snippet?

Answers (1)

Answers (1)

Former Member
0 Kudos

set oForm = <So Form>

oForm.mode = fm_Find_Mode

set oItem = <DocNum field on the SO Form>

oItem.specific.Value = < your DocNum >

Set oButton <Find button on the SO form>

oButton.Click

Natalya