Skip to Content
0
Apr 28, 2005 at 05:49 AM

GetByKey for Documents :(

35 Views

Hi, friends!

Could you say me, if this snippet is the only solution to open needed document manually?

In other words, i need to open via UI a Purchase Order form for order #xx on dd.mm.yyyy date.

I havn't find any way to done it as in MasterData.GetByKey().

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

// simulate menu-click //
SBOApp.ActivateMenuItem("2305");

// look for count of opened forms with type 142 (PurhOrder)
for (int k=0; k<SBOApp.Forms.Count; k++)
if (SBOApp.Forms.Item(k).Type == 142)
frmPOCount++;

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

// change its mode from add to find
frmPurchOrd.Mode = SAPbouiCOM.BoFormMode.fm_FIND_MODE;
oOrdNum                 = (SAPbouiCOM.EditText)

// fill the items
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");

// simulate find-button click
oOrdOkButton.Click(SAPbouiCOM.BoCellClickType.ct_Regular);
frmPurchOrd.Freeze(false);

thanx.

sorry for my En.

I reply to forumadmins to fix the comment-trouble, plz 😊

Message was edited by: Alexey Grebennikov