cancel
Showing results for 
Search instead for 
Did you mean: 

MAS questions

Former Member
0 Kudos

Hello,

Im pretty new to MAS so i still got many questions, here are some urgent ones

I need to create a new "Save" button that does the same as the standard floppy disk button in the menu bar. Is it possible to see the code behind this standard button? or how do i accomplish this.

I also need to create a button "Create prospect" in Business Partners/Search wich should jump to the Business Partners/Details (this i did with hyperlinks and the code hZ_hyperlinkBPDetail.Execute) but on top of this you should go to "creation mode" automatically, like when you press the standard "New" button in the menu bar.(again, is it possible to see the code behind this standard button? or how do i accomplish this)

Also, the checkbox "prospect" should be automatically checked, and the other checkboxes hidden. I think this has something todo with the properties of these checkboxes in the business object BOCAPGEN? there you can put them on normal, UIReadOnly etc.. or do i have to create a new BO because the standard "New" button also uses BOCAPGEN and doesnt need to check and hide any checkboxes.

the more i learn about mas the more interesting it gets so plz try to answer

Cheers,

Maarten

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Maarten,

1. The <b>best and easy</b> way to know what code is getting executed on every action ( "New" or "Save" ), is to debug both UI and BO projects.

However, you can find if there is any code exist behind standard "Save" button in UI Events:

For the anchor:

- anchor_beforeSave

- anchor_afterSave

- mcore_beforeSafe

- mcore_afterSafe

In BOL events:

- BeforeSave

- Saved

2 AND 3. This is little tricky. You can see the code behind a standard "New" button ( acapoverview4DSOCap_afterNewContent, but that nesseseraly won't help you to achive your task.

Before you create a new object on BP Details, you need to know that you actually jumped from BP search. Create a global varialbe, and set it to "True" after you click on the Jump button.

In the tile capoverview4On, on the <b>mcore_onLoad</b> event, check if your varialbe is true.

If myVar = True Then

acapoverview4DSOCap.NewBO ( then will create a new Oject )

myVar = False (have to set it to False after. It is True <b>ONLY</b> on the jump)

ctrlctrlBPISPROS.value = True ("prospect" is checked)

ctrlctrlBPISCONS.editMode = cemHidden

ctrlctrlBPISCOMP.editMode = cemHidden

ctrlctrlBPISCUST.editMode = cemHidden

End If

Regards,

Vadim.

Former Member
0 Kudos

Thx for the nice info again Vadim,

Where do i define a global variable? because im getting the Compile error "variable not defined".

i guess its just the code: Public myVar As Boolean, but where to put this? or is there another way to define vars in MAS, never done it

Cheers,

Maarten

Former Member
0 Kudos

Maarten,

Store a value in the variable by using data dictionary:

On click of the button "Create prospect", store "TRUE" in the "myVar":

gApplication.core.BOL.UserDataDictionary.PutData "myVar", "TRUE"

In the tile capoverview4, on the <b>mcore_onLoad</b> event, check if this variable true. If it is, set it to "FALSE" right after.:

If gApplication.core.BOL.UserDataDictionary.GetData("myVar") = "TRUE" Then

acapoverview4DSOCap.NewBO

gApplication.core.BOL.UserDataDictionary.PutData "myVar", "FALSE" (have to set it to False after. It is True ONLY on the jump)

ctrlctrlBPISPROS.value = True ("prospect" is checked)

ctrlctrlBPISCONS.editMode = cemHidden

ctrlctrlBPISCOMP.editMode = cemHidden

ctrlctrlBPISCUST.editMode = cemHidden

End If

Regards,

Vadim.

Former Member
0 Kudos

Thx Vadim,

Its working now, but i stumbled upon some other stuff i would like to know a bit more about.

In the capoverview4 tile(business partners/details), when you press the standard "new" button the customer checkbox is always automatically checked, i've been trying to find where this is done, so i can add some code there to make Prospect also auto-checked, but havent found it so far.

Also, when you do "new", some fields are set as mandatory, ctrlName1T and ctrlCountryT, i thought it has something todo with the EnableDisableAllControls method in capoverview4. But this method doesnt get executed anywhere, its in comments in the capoverview4DSOCaponUpdate1 event handler, and i havent found it anywhere else in the VB code. So now i wonder how they made those fields mandatory.

Cheers,

Maarten

Former Member
0 Kudos

Hi Maarten,

1. Customer check box. Please check the property BPISCUST in the BOCAPGEN object. Is there a default value "TRUE" ?

2. Mandatory fields. In the design time, look on the tile, in the properties window for both controls. It could be "Mandatory". If not, look in the BOCAPGEN object in properties for the same.

Regards,

Vadim.

Former Member
0 Kudos

Hi,

It works! Changing the properties in BOCAPGEN was all i needed todo.

My custom "Save" button is working also now, code : aactdeta2DSOAct.saveBO

Got a question about it though: When you press the standard "floppy save-button" you get the messages "Saving..." followed by "Data has been saved" below in the statusbar. Can this also be accomplished for my custom "Save" button?

the only message-related code i discovered is stuff like this:

gServices.ShowMsgBox gServices.langServer.getString("???", ???)

the ??? you find in the message editor i suppose, but how in gods name does one find the right one

or am i following a wrong lead here?

Cheers,

Maarten

Former Member
0 Kudos

Maarten,

I'm glad to hear that it is working.

You can accomplish your message by creating your own one.

You can reference existing message ( Go to Tools->Find in Repository. Type - "Message". Lookup ID : "PRNB_VisitChecking" ). Search.

Create your own message, by going to File->New->Message.

Populate your Lookup ID, Error Code ( i.e. "<b>Z_BPSave</b>", <b>1</b> ) and Description.

Put in the Source location the place where you raising this message ( BP Details ). Add more languages if you neeed to. Save.

Your code should look like this:

gServices.showMsgBox gServices.LangServer.GetString("Z_BPSave", 1)

Generate message and the tile.

Regards,

Vadim.

Former Member
0 Kudos

Thx alot,

I used the simple code:

gServices.save

this also uses the messages "Saving..." and "Data has been saved" by default

Cheers,

Maarten

Answers (0)