Tuesday, November 20, 2012

JDE Package Management Made Easy!


JDE Package Management Made Easy!

This article is for CNC Administrators and JDE Developers who have good understanding of Package Management and JDE Tools Set.
Have you ever had to do an UPDATE PACKAGE BUILD where there are tens of different projects with dozens of versions of UBEs? If yes, then I can understand the pain that it causes you to try to pull all the objects that are necessary for that build. You might have thought why Oracle hasn't put in a little extra effort to make this step a little easier for users where users could pull objects by status of project instead of by project name.
Well, the wait is over. After making a small modification to you package management application, you can pull all your objects with one click of a button. It not only will save you a lot of time as a CNC administrator, but also will eliminate human error in missing some objects that would otherwise be necessary to be part of an update package build.
Changes that you need to make to Component Selection (P9601/W9601D) Screen are as follows:

1.       New fields added to Component Selection Screen
a.       Project Status EDIT FIELD (for example DV = 25, PY = 35, QA = 55, PD = 65 etc)
b.      Project Versions RADIO BUTTON             

                                                         i.            If you wish to set it by default, then put following code in Post Dialogue Initialized Event of the form W9601D:
FC JDE Versions = "3"
                                                       ii.            This option (if selected) will pull all versions of a UBE in a given project in a given status.
c.       Get Object PUSH BUTTON
                                                               i.      Click this button to pull all projects with all objects in a given status.


2.       Click [Get Objects] Push Button to pull all objects that are at the status you define at Project Status field.

3.       Select all these line and then click SELECT button to select these objects in your package build.

4.       Click Close button. You will notice that all UBE versions that are in the Project status you selected have been automatically selected for you.

5.       Proceed with remaining steps of Update Package Build
The actual code behind the “Get Objects” Push Button and the “OK” Button is as follows:
Code behind “Get Objects” Button:

Button Clicked Event:[1]

APPL: P9601 - Package Assembly
Form: W9601D - Object Component Selection
FC Get objects -
Event: Button Clicked
Event GUID: ad8fd4ed-850c-406d-a1fe-75cf30412073

VA frm_PLXS_GetObjectButtonClick = "Y"
FC Modification Comment = "1"
Press Button(HC F&ind)
If FC Project Status is greater than <Blank>
     F98220.Select  [Index: Status, Type, Severity]
          FC Project Status = TK Object Management Project Status
     F98220.FetchNext  [Index: Status, Type, Severity]
          frm_PLXS_OMWPrjName_OMWPRJID [OMWPRJID] <- TK Object Management Project Name
     While SV File_IO_Status is equal to CO SUCCESS
          // Find all objects in this project
          F98222.Select  [Index: Project, Object, Rel, ObjType]
               frm_PLXS_OMWPrjName_OMWPRJID [OMWPRJID] = TK Object Management Project Name
          F98222.FetchNext  [Index: Project, Object, Rel, ObjType]
               frm_PLXS_NameObject_OBNM [OBNM] <- TK Object Management Object Name
               frm_PLXS_OMWObjectType_OMWOT [OMWOT] <- TK Object Management Object Type
          While SV File_IO_Status is equal to CO SUCCESS
               GB OMW ProjectName = " "
               GB ObjectName = " "
               GB Description = " "
               GB Description = " "
               GB Description = " "
               GB Selected = " "
               GB ObjectType = " "
               GB SystemCode = " "
               GB ReportingSystem = " "
               //  
               // Check Object Type
               If frm_PLXS_OMWObjectType_OMWOT [OMWOT] is equal to ('APPL','BL','BSFN','BSVW','DSTR','GT','TBLE','UBE','UBEVER')
                    If frm_PLXS_OMWObjectType_OMWOT [OMWOT] is equal to 'UBEVER'
                         FindCharPositionInString(B7500150.FindCharPositionInString)
                              frm_PLXS_NameObject_OBNM [OBNM] -> szString [BDS4]
                              '|' -> cCharToFind [EV01]
                              <Zero> -> mnStartingPosition [MATH80]
                              frm_PLXS_PipePosition_LNID [LNID] <- mnPositionFound [MATH80]
                         VA frm_PLXS_NameObject_OBNM = substr([VA frm_PLXS_NameObject_OBNM],0, [VA frm_PLXS_PipePosition_LNID])
                    End If
                    // Always add the object if no a UBE VER. 
                    // If UBE VER only, add the corresponding
                    // UBE name if it hasn't been added yet
                    //  
                    If frm_PLXS_OMWObjectType_OMWOT [OMWOT] is equal to 'UBEVER'
                    And frm_PLXS_NameObject_OBNM [OBNM] is not equal to frm_LastUBEAdded_OBNM [OBNM]
                    Or frm_PLXS_OMWObjectType_OMWOT [OMWOT] is not equal to 'UBEVER'
                         GB ObjectName = VA frm_PLXS_NameObject_OBNM
                         GB OMW ProjectName = VA frm_PLXS_OMWPrjName_OMWPRJID
                         //  
                         // Get data for other columns
                         F9860.FetchSingle  [Index: Object Name]
                              frm_PLXS_NameObject_OBNM [OBNM] = TK Object Name
                              GB Description <- TK Description
                              GB System  Code <- TK Product Code
                              GB Reporting  System <- TK Product Code/Reporting
                              GB Object  Type <- TK Object Type
                         VA frm_PLXS_PkgItemType_PKGITMTY = "O"
                         F9631.FetchSingle  [Index: Pckage Name, Path Code A+]
                              frm_PLXS_PkgItemType_PKGITMTY [PKGITMTY] = TK Type - Package Item Type
                              frm_PLXS_NameObject_OBNM [OBNM] = TK Object Name
                              FC Package Name = TK Pakcage Name
                              FC Path Code = TK Code - Path
                         If SV File_IO_Status is equal to CO SUCCESS
                              GB Selected = "1"
                         Else
                              GB Selected = "0"
                         End If
                         //  
                         Insert Grid Buffer Row(FC Grid,  <After Last Row>,  <Yes>,  <Yes>,  <No>,  <Yes>,  <No>)
                         // If this object has been added to the package already, then display the Check
                         // Mark
                         If GB Selected is equal to '1'
                              Get Max Grid Rows(FC Grid, VA frm_PLXS_MaxGridRows_MATH01)
                              Set Grid Row Bitmap(FC Grid, VA frm_PLXS_MaxGridRows_MATH01,  <Check Mark>)
                         End If
                    End If
               Else
                    // It's not an object that is placed in a package, ignore it
               End If
               //  
               If frm_PLXS_OMWObjectType_OMWOT [OMWOT] is equal to ('UBE','UBEVER')
                    VA frm_LastUBEAdded_OBNM = VA frm_PLXS_NameObject_OBNM
               End If
               //  
               F98222.FetchNext  [Index: Project, Object, Rel, ObjType]
                    frm_PLXS_NameObject_OBNM [OBNM] <- TK Object Management Object Name
                    frm_PLXS_OMWObjectType_OMWOT [OMWOT] <- TK Object Management Object Type
          End While
          //  
          F98220.FetchNext  [Index: Status, Type, Severity]
               frm_PLXS_OMWPrjName_OMWPRJID [OMWPRJID] <- TK Object Management Project Name
     End While
End If

Post Button Clicked Event:

APPL: P9601 - Package Assembly
Form: W9601D - Object Component Selection
FC Get objects -
Event: Post Button Clicked
Event GUID: 345b267d-2947-4a87-962d-698bf39e43ee
VA frm_PLXS_GetObjectButtonClick = "N"
Code behind OK Button:

Button Clicked Event:

APPL: P9601 - Package Assembly
Form: W9601D - Object Component Selection
HC OK/Select -
Event: Button Clicked
Repeat For Grid
Event GUID: 5b832698-ec22-11d1-9094-0000f67c789e
// 
VA frm_ItemType = "O"
// 
// Check to see if this item exists for the package yet.  If not add it.
// 
If GC Selected is equal to '1'
     F9631.Delete  [Index: Pckage Name, Path Code A+]
          frm_ItemType [PKGITMTY] = TK Type - Package Item Type
          GC Object Name = TK Object Name
          FI szPackageName = TK Pakcage Name
          FI szCodePath = TK Code - Path
     Set Grid Row Bitmap(FC Grid, <Currently Selected Row>,  <Blank/Clear>)
     GC Selected = "0"
Else
     F9631.FetchSingle  [Index: Pckage Name, Path Code A+]
          frm_ItemType [PKGITMTY] = TK Type - Package Item Type
          GC Object Name = TK Object Name
          FI szPackageName = TK Pakcage Name
          FI szCodePath = TK Code - Path
     If SV File_IO_Status is not equal to CO SUCCESS
          GetAuditInfo(B9800100.GetAuditInfo)
               frm_UserID [USER] <- szUserName [USER]
               frm_DateUpdated [UPMJ] <- jdDate [DTE]
               frm_TimeUpdated [TDAY] <- mnTime [TME0]
               frm_JOBN [JOBN] <- szWorkstation_UserId [JOBN]
          VA frm_Program = "P9601"
          F9631.Insert  [Index: Pckage Name, Path Code A+]
               frm_ItemType [PKGITMTY] -> TK Type - Package Item Type
               GC Object Name -> TK Object Name
               FI szPackageName -> TK Pakcage Name
               FI szCodePath -> TK Code - Path
               frm_Program [PID] -> TK Program ID
               frm_JOBN [JOBN] -> TK Work Station ID
               frm_DateUpdated [UPMJ] -> TK Date - Updated
               frm_TimeUpdated [TDAY] -> TK Time - Last Updated
               frm_UserID [USER] -> TK User ID
     End If
     Set Grid Row Bitmap(FC Grid,  <Currently Selected Row>,  <Check Mark>)
     GC Selected = "1"
     // 
     If GC Object  Type is equal to 'UBE'
     And FC Select Versions is equal to <Blank>
          Call App:P9601 Form:W9601T Version:<Blank>
[]
               GC Object Name -> szNameObject [OBNM]
               FI szPackageName -> szPackageName [PKGNAME]
               FI szCodePath -> szCodePath [PATHCD]
     Else
          If GC Object  Type is equal to 'UBE'
               // 
               VA frm_NoMoreRecords = " "
               // 
               If FC All Versions is equal to ('1','2')
                    // 
                    VA frm_VersionsListCategoryCode2 = "1"
                    F983051.Select  [Index: primary]
                         GC Object Name = TK Program ID
                         frm_VersionsListCategoryCode2 [VCC2] <> TK Category Code - OW Version List 2
                    // 
                    While frm_NoMoreRecords [EV01] is equal to <Blank>
                         F983051.FetchNext  [Index: primary]
                              frm_Version [VERS] <- TK Version History
                         If SV File_IO_Status is equal to CO SUCCESS
                              If FC JDE Versions is equal to '1'
                                   VA frm_FourBig = substr([VA frm_Version],0,4 )
                              End If
                              If FC All Versions is equal to ('1')
                              And frm_FourBig [VERS] is equal to ('XJDE','ZJDE')
                              Or FC All Versions is equal to '2'
                                   GetAuditInfo(B9800100.GetAuditInfo)
                                        frm_UserID [USER] <- szUserName [USER]
                                        frm_DateUpdated [UPMJ] <- jdDate [DTE]
                                        frm_TimeUpdated [TDAY] <- mnTime [TME0]
                                        frm_JOBN [JOBN] <- szWorkstation_UserId [JOBN]
                                   VA frm_Program = "P9601"
                                   F9631.Insert  [Index: Pckage Name, Path Code A+]
                                        frm_ItemType [PKGITMTY] -> TK Type - Package Item Type
                                        GC Object Name -> TK Object Name
                                        FI szPackageName -> TK Pakcage Name
                                        FI szCodePath -> TK Code - Path
                                        frm_Version [VERS] -> TK Version History
                                        frm_Program [PID] -> TK Program ID
                                        frm_JOBN [JOBN] -> TK Work Station ID
                                        frm_DateUpdated [UPMJ] -> TK Date - Updated
                                        frm_TimeUpdated [TDAY] -> TK Time - Last Updated
                                        frm_UserID [USER] -> TK User ID
                              End If
                         Else
                              VA frm_NoMoreRecords = "1"
                         End If
                    End While
                    // 
                    // ****************************************************************
                    // Begin Additional Custom Logic to pull versions of UBE by Status
                    // ****************************************************************
                    // 
               Else
                    If FC All Versions is equal to '3'
                         VA frm_VersionsListCategoryCode2 = "1"
                         F983051.Select  [Index: primary]
                              GC Object Name = TK Program ID
                              frm_VersionsListCategoryCode2 [VCC2] <> TK Category Code - OW Version List 2
                         While frm_NoMoreRecords [EV01] is equal to <Blank>
                              F983051.FetchNext  [Index: primary]
                                   frm_Version [VERS] <- TK Version History
                              If SV File_IO_Status is equal to CO SUCCESS
                                   VA frm_PLX_OMWObjectName_OMWOBJID = concat(concat([GC ObjectName],"|"),[VA frm_Version])
                                   VA frm_PLXS_OMWObjectType_OMWOT = "UBEVER"
                                   F98222.Select  [Index: Project, Object, Rel, ObjType]
                                        GC OMW Project  Name = TK Object Management Project Name
                                        frm_PLX_OMWObjectName_OMWOBJID [OMWOBJID] = TK Object Management Object Name
                                        frm_PLXS_OMWObjectType_OMWOT [OMWOT] = TK Object Management Object Type
                                   F98222.FetchNext  [Index: Project, Object, Rel, ObjType]
                                        frm_PLXS_FetchTest_USER [USER] <- TK Object Management Project Name
                                        frm_PLXS_FetchTest_USER [USER] <- TK User ID
                                   If SV File_IO_Status is equal to CO SUCCESS
                                        GetAuditInfo(B9800100.GetAuditInfo)
                                             frm_UserID [USER] <- szUserName [USER]
                                             frm_DateUpdated [UPMJ] <- jdDate [DTE]
                                             frm_TimeUpdated [TDAY] <- mnTime [TME0]
                                             frm_JOBN [JOBN] <- szWorkstation_UserId [JOBN]
                                        VA frm_Program = "P9601"
                                        F9631.Insert  [Index: Pckage Name, Path Code A+]
                                             frm_ItemType [PKGITMTY] -> TK Type - Package Item Type
                                             GC Object Name -> TK Object Name
                                             FI szPackageName -> TK Pakcage Name
                                             FI szCodePath -> TK Code - Path
                                             frm_Version [VERS] -> TK Version History
                                             frm_Program [PID] -> TK Program ID
                                             frm_JOBN [JOBN] -> TK Work Station ID
                                             frm_DateUpdated [UPMJ] -> TK Date - Updated
                                             frm_TimeUpdated [TDAY] -> TK Time - Last Updated
                                             frm_UserID [USER] -> TK User ID
                                   End If
                              Else
                                   VA frm_NoMoreRecords = "1"
                              End If
                         End While
                         // 
                    End If
                    // 
                    // ****************************************************************
                    // End Additional Custom Logic to pull versions of UBE by status
                    // ****************************************************************
                    // 
               End If
               // 
          End If
     End If
     If GC Object  Type is equal to 'APPL'
     And FC Select Versions is equal to <Blank>
          F983051.FetchSingle  [Index: primary]
               GC Object Name = TK Program ID
          If SV File_IO_Status is equal to CO SUCCESS
               Call App:P9601 Form:W9601T Version:<Blank>
[]
                    GC Object Name -> szNameObject [OBNM]
                    FI szPackageName -> szPackageName [PKGNAME]
                    FI szCodePath -> szCodePath [PATHCD]
          End If
     Else
          If GC Object  Type is equal to 'APPL'
               // 
               VA frm_NoMoreRecords = " "
               // 
               If FC All Versions is equal to ('1','2')
                    // 
                    F983051.Select  [Index: primary]
                         GC Object Name = TK Program ID
                    // 
                    While frm_NoMoreRecords [EV01] is equal to <Blank>
                         F983051.FetchNext  [Index: primary]
                              frm_Version [VERS] <- TK Version History
                         If SV File_IO_Status is equal to CO SUCCESS
                              If FC JDE Versions is equal to ('1','2')
                                   VA frm_FourBig = substr([VA frm_Version],0,4 )
                              End If
                              If FC All Versions is equal to ('1','2')
                              And frm_FourBig [VERS] is equal to ('XJDE','ZJDE')
                              Or FC All Versions is equal to '2'
                                   GetAuditInfo(B9800100.GetAuditInfo)
                                        frm_UserID [USER] <- szUserName [USER]
                                        frm_DateUpdated [UPMJ] <- jdDate [DTE]
                                        frm_TimeUpdated [TDAY] <- mnTime [TME0]
                                        frm_JOBN [JOBN] <- szWorkstation_UserId [JOBN]
                                   VA frm_Program = "P9601"
                                   F9631.Insert  [Index: Pckage Name, Path Code A+]
                                        frm_ItemType [PKGITMTY] -> TK Type - Package Item Type
                                        GC Object Name -> TK Object Name
                                        FI szPackageName -> TK Pakcage Name
                                        FI szCodePath -> TK Code - Path
                                        frm_Version [VERS] -> TK Version History
                                        frm_Program [PID] -> TK Program ID
                                        frm_JOBN [JOBN] -> TK Work Station ID
                                        frm_DateUpdated [UPMJ] -> TK Date - Updated
                                        frm_TimeUpdated [TDAY] -> TK Time - Last Updated
                                        frm_UserID [USER] -> TK User ID
                              End If
                         Else
                              VA frm_NoMoreRecords = "1"
                         End If
                    End While
                    // 
               End If
               // 
          End If
     End If
End If




[1] Source: Scott Beebe – a better way to assemble package published on Quest Q& A - 2009