Scrolling Window, VBA & DUOS


I started with DUOS and related concepts in Modifier/VBA. I have been interested in VBA more nowadays, and I am fairly new to DUOS concepts. I wanted to learn more about DUOS and how to use it for realtime requirements.

While all examples I looked into for DUOS concepts were dealing with adding fields to a Header side of GP Forms (Customer Maintenance, for instance), I was curious about knowing how to implement DUOS on a Scrolling window of a GP form. I worked on a very simple yet good sample Modifier/VBA/DUOS Customization which involved GL Transaction Entry form.

I wanted to add one more Description field to the GL Journal Entry Account Lines. So, in addition to Distribution Reference and Account Description, one more Description called Account Line Comments needed to be added.

Below is the complete approach:

1. GL Transaction Entry was modified to add the new field called “Line Comment” and a label “Acct. Line Comment” on the Header part.
2. I decided to use both “Journal Entry” and “Sequence Line” as the combination for the DUOS ObjectID.
3. To add the “Sequence Line” to the VBA Editor, it has to be made available on the UI. Once it is added to VBA editor, it can be pulled out of the UI as it was, originally.
4. Coding was done once the fields “Journal Entry”, “Sequence Line” and the newly added “Line Comment” were added to the VBA Editor.


For more detailed explanation on this sample, you can download this Document, Sample Modifier VBA DUOS Customization – GL Trx Entry.pdf.

Any development without small gaps is not quite possible. I did trap certain simple issues in my unit testing.

1. Always, for any scrolling window, there should be a value (such as Sequence Line, Line Sequence Number, etc.) that is setup as the unique value to identify one specific line record. In my sample customization, I had to consider the Journal Entry from Header and Sequence Line from Scrolling Window as a combination to uniquely identify my Line Record.

2. Whenever a user enters a Account Line, a DUOS record will be created on SY90000 with an ObjectID @^ (in my sample). For instance, my first Account Line for a Journal Entry #3255 will be 3255@^100.

3. We have a function in VBA DUOS called DUOSObjects.Remove(), for which the parameter will be the ObejctID. So whenever a User deletes an Account Line, the corresponding DUOS record should be deleted. We do not have any automatic handler which will delete the DUOS record when an Account Line is deleted.

4. There is no event in VBA, something line LineDelete, which will handle a Scrolling Window Line Delete event.

I thought I was in a fix. I then asked this to David (Thanks David, for pointing this out to me). He instructed me to write the code on the Line Delete message “Are you sure you want to delete?”. This message is shown whenever we delete any Scrolling Window Line. That’s what I did and with some more code additions.

You can get this Sample Customization package from this link: GLJournalDUOSSample.package.

Do go thru’ this sample code and send in your feedbacks on any changes / additions / any other methods. I hope sincerely that this helps someone out there, who has started with DUOS, just like me.

Vaidy

Advertisements

4 thoughts on “Scrolling Window, VBA & DUOS

  1. Hi VaidyIs there a reason that you have not used the DUOSObjectCombineID() and DUOSObjectExtractID methods?These are designed to allow you to combine the header ID and Sequence number together into a single ID which and be used in the DUOS.Davidhttp://blogs.msdn.com/DevelopingForDynamicsGP/

    Like

  2. Hi David,I do have used the function DUOSObjectCombineID(). I am combining the Journal Entry and Sequence Line as one ObjectID, using the DUOSObjectCombineID() function. But I was not aware of what DUOSObjectExtract() function would do. I will check that out.Vaidy

    Like

  3. Here is some code to delete all the lines if you select the button to delete the entire transaction:If PromptString = "Are you sure you want to delete this transaction?" Then If Answer = dcButton1 Then Set JournalCollection = DUOSObjectsGet("JrnEntryLineComments") For Each Journals In JournalCollection If InStr(1, Journals.ID, Replace(JournalEntry.Value, ",", "")) Then JournalCollection.Remove (Journals.ID) End If Next End If End If

    Like

  4. Hi Vaidy, This is vikas gupta.i hope you remember. we have already talked on fb. actally i need some help regarding VBA and VSTOOLS for gp.if u have any study links pls share with me on FB…

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s