cancel
Showing results for 
Search instead for 
Did you mean: 

Create link button on UDO to open up SAP form

kinyanjui_kamau
Participant
0 Kudos

Hi Experts,

I have a UDO, "Generator Service Management" and I want to create a link button on one of the fields - Service Call.

I would like it such that if a user clicks on the yellow link button attached to the service call number, it opens up the SAP Service Call form with the corresponding service call number. Please see image below:

When link button is pressed in "1" above, the corresponding Service Call form is opened - "2"

How do I create a link button to achieve this? I use Coresuite add-on so if there is another way to do this with Coresuite I would be glad to know how.

Any help appreciated.

Using SAP 9.1 PL 6

Regards,

Kinyanjui.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member458725
Active Participant
0 Kudos

Hi,

To set a link button in user defined form to Service call, Go to the XML design of user defined form

and set the linked object. Check the Image Attached.

This show the link Button near to the EditText and based on the docentry you set, it will open the Service call form.

Hope this will help.

kinyanjui_kamau
Participant
0 Kudos

Thanks for the reply Vibin,

I created the form/object using: Tools -> Customization Tools -> Object Registration Wizard.

How do I open this form in XML format?

Regards,

Kinyanjui

former_member458725
Active Participant
0 Kudos

Hi,

Then you have to write code for that. Create an addon - based on form ID, on form load event set the link button to the textbox of service call.

That's the only option for this type of form.

Former Member
0 Kudos

Hello Kinyanjui,

the easiest way is to create a button next to the service call field,

Hide the button on form load if the Service Call Field is empty

then create a variable that stores the service call number

Open the form using the formLoad function quoting the object ID of the service call

Use the number stored in the service call to find the specific call.

Hope this helps.

Best,

Robinson

kinyanjui_kamau
Participant
0 Kudos

Thanks for the reply.

I have this so far using Coresuite

try

{

    StatusBar.WriteWarning("DEBUG - Rule: " + pVal.RuleInfo.RuleName + " was triggered.");

    // Your Code

   

    // (SOURCE) Store Requisition

    SAPbouiCOM.Form oForm = SwissAddonFramework.B1Connector.GetB1Connector().Application.Forms.ActiveForm;

    SAPbouiCOM.LinkedButton oLink;

    SAPbouiCOM.Item oNewItem = oForm.Items.Add("23_U_E", SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON);

   

}

catch (Exception ex)

{

    string errorMessage = string.Format("Error in {0} Rule '{1}': {2}", pVal.RuleInfo.RuleType, pVal.RuleInfo.RuleName, ex.Message);

    MessageBox.Show(errorMessage, "OK");

    StatusBar.WriteError(errorMessage);

    Debug.WriteMessage(errorMessage, Debug.DebugLevel.Exception);

}

return true;

Regards,

Kinyanjui

Former Member
0 Kudos

Hello Kinyanjui,

Use this code linked to the yellow button image to open the service call

-----------------------------------------------------------------------------------------------------------------------------------------------------

//Read the service call ID from current form

-----------------------------------------------------------------------------------------------------------------------------------------------------

Form CurrentForm = pVal.Form;

int serviceEntry = int.Parse(pVal.BusinessObjectKeyString);

    SAPbobsCOM.Documents doc = (SAPbobsCOM.Documents)

        SwissAddonFramework.B1Connector.GetB1Connector().Company.GetBusinessObject(

        SAPbobsCOM.BoObjectTypes.oQuotations);

    doc.GetByKey(serviceEntry);

-----------------------------------------------------------------------------------------------------------------------------------------------------

//Open Service Call with captured service call id

-----------------------------------------------------------------------------------------------------------------------------------------------------

Form form = Form.GetFormFromUID(SwissAddonFramework.B1Connector.GetB1Connector().Application.OpenForm(SAPbouiCOM.BoFormObjectEnum.fo_Service, "191", "serviceEntry").UniqueID);

-----------------------------------------------------------------------------------------------------------------------------------------------------


Regards,


Robinson

kinyanjui_kamau
Participant
0 Kudos

Thanks a lot for the reply Robinson,

I have 2 questions:

1. My code does not show the linked button. "23_U_E" is the Service Call item UID.

2. Second, I get an error with your code. See image.

Regards,

Kinyanjui.

Former Member
0 Kudos

Hello Kinyanjui,

Sorry I assumed you had the button already.

At this point you could just create a normal button using coresuite and link it to the code provided earlier.

Another option is to use the SAP native code to display the button. Not really sure how this will work but I guess its worth exploring.

And this..

Check it out and let me know how it goes.

Regards,

Robinson.