Skip to main content

Notifications

Microsoft Dynamics SL (Archived)

Transaction Import -Press the Button

(0) ShareShare
ReportReport
Posted on by 555

In Transaction import process i  want to press the button.I am doing transaction import in Project Timesheet Entry screen(TMPTE00),In tran import i want to press Create Timecard(s) button? 

Have attached My control Macro file code below.

'$include: "bsl.dh"
'TMPTE Control Macro
Sub ProcessImportLine( LevelNumber%, Retval% )
  select Case LevelNumber
    case TI_Start

      call AliasConstant( "Level0", "Header" )

      call AliasConstant( "Level1", "Detailtime" )

      call AliasConstant( "Level2", "Detailuop" )

    case 0 ' 0 of 3

    'Level 0 if of Type N
      ' cDocNbr is a key field for level 0
      ' Field mask is 9999999999
      serr = SetObjectValue( "cDocNbr", ImportField(1) )

      ' Field mask is UUUUUUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cPreparer", ImportField(2) )

      ' cMultiemp is an Check Box
      ' Values are Y for ON and 0 for OFF
      ' Values are CHECKED for ON and UNCHECKED for OFF
      serr = SetObjectValue( "cMultiemp", ImportField(3) )

      ' cboCrew is an Combo Box
      ' Values are  ;<None>
      serr = SetObjectValue( "cboCrew", ImportField(4) )

      ' Field mask is UUUUUUU
      serr = SetObjectValue( "cShift", ImportField(5) )

      ' Field mask is XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      serr = SetObjectValue( "cComment", ImportField(6) )

      ' Field mask is WWW-WW-WW-999
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cprojecthdr", ImportField(7) )

      ' Field mask is UUUU
      serr = SetObjectValue( "ctaskhdr", ImportField(8) )

      ' cdatehdr is a Date Field Type
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cdatehdr", ImportField(9) )

      ' Field mask is 99:99
      serr = SetObjectValue( "cstart_time", ImportField(10) )

      ' Field mask is 99:99
      serr = SetObjectValue( "cend_time", ImportField(11) )

      ' cStatus is an Combo Box
      ' Values are I;In Process, C;Completed
      serr = SetObjectValue( "cStatus", ImportField(12) )

      ' Field mask is XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      serr = SetObjectValue( "cth_id00(1)", ImportField(13) )

      ' Field mask is XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      serr = SetObjectValue( "cth_id00(2)", ImportField(14) )

      ' Field mask is XXXXXXXXXXXXXXXXXXXX
      serr = SetObjectValue( "cth_id00(3)", ImportField(15) )

      ' Field mask is XXXXXXXXXXXXXXXXXXXX
      serr = SetObjectValue( "cth_id00(4)", ImportField(16) )

      ' Field mask is XXXXXXXXXX
      serr = SetObjectValue( "cth_id00(5)", ImportField(17) )

      ' Field mask is XXXXXXXXXX
      serr = SetObjectValue( "cth_id06", ImportField(18) )

      ' Field mask is XXXX
      serr = SetObjectValue( "cth_id07", ImportField(19) )

      ' cth_id09 is a Date Field Type
      serr = SetObjectValue( "cth_id09", ImportField(20) )

      serr = SetObjectValue( "cth_id10", ImportField(21) )

      serr = SetObjectValue( "cth_id08", ImportField(22) )


    case 1 ' 1 of 3

    'Level 1 if of Type D
      ' cDocNbrDet is a key field for level 1
      ' IntText1 is a key field for level 1
      ' cLineDate is a Date Field Type
      serr = SetObjectValue( "cLineDate", ImportField(1) )

      ' Field mask is WWW-WW-WW-999
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cProject", ImportField(2) )

      ' Field mask is UUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cTask", ImportField(3) )

      ' Field mask is UUUUUUUUUU
      serr = SetObjectValue( "cemployee", ImportField(4) )

      ' Field mask is UUUU
      serr = SetObjectValue( "clabor_class_cd", ImportField(5) )

      ' Field mask is UUUUUUUUUU
      serr = SetObjectValue( "cgl_acct", ImportField(6) )

'Currently Disabled ccpnyid

      ' Field mask is WWW-WW
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cgl_subacct", ImportField(7) )

      ' Field mask is UUUUUUU
      serr = SetObjectValue( "cshift_detail", ImportField(8) )

      ' cbillable_labor is an Combo Box
      ' Values are ;Yes,N;No
      serr = SetObjectValue( "cbillable_labor", ImportField(9) )

      ' Field mask is 99:99
      serr = SetObjectValue( "cstart_timedet", ImportField(10) )

      ' Field mask is 99:99
      serr = SetObjectValue( "cend_timedet", ImportField(11) )

'Currently Disabled celapsed_time

      serr = SetObjectValue( "cRegHours", ImportField(12) )

      serr = SetObjectValue( "cOT1Hours", ImportField(13) )

      serr = SetObjectValue( "cOT2Hours", ImportField(14) )

      ' Field mask is UUUUUUUUUU
      serr = SetObjectValue( "cunion", ImportField(15) )

      ' Field mask is UU
      serr = SetObjectValue( "cwork_type", ImportField(16) )

      ' cbocert_pay_sw is an Combo Box
      ' Values are N;No,Y;Yes
      serr = SetObjectValue( "cbocert_pay_sw", ImportField(17) )

      ' Field mask is UU
      serr = SetObjectValue( "cgroup_code", ImportField(18) )

      ' Field mask is UUUUUU
      serr = SetObjectValue( "cwork_comp_cd", ImportField(19) )

      ' Field mask is UUUUUUUUUU
      serr = SetObjectValue( "cequip_id", ImportField(20) )

'Currently Disabled cbounit_of_measure

      ' cbousage is an Combo Box
      ' Values are  ;<None>,RATE1;Time in Use Rate,RATE2;Standby Rate,RATE3;Delay Rate
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cbousage", ImportField(21) )

      serr = SetObjectValue( "cequip_units", ImportField(22) )

      ' cbillable_eq is an Combo Box
      ' Values are 1;No,0;Yes
      serr = SetObjectValue( "cbillable_eq", ImportField(23) )


    case 2 ' 2 of 3

    'Level 2 if of Type D
      ' cDocNbrUop is a key field for level 2
      ' Field mask is 9999999999
      serr = SetObjectValue( "cDocNbrUop", ImportField(1) )

      ' IntText2 is a key field for level 2
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "IntText2", ImportField(2) )

      ' cUopDate is a Date Field Type
      serr = SetObjectValue( "cUopDate", ImportField(3) )

      ' Field mask is WWW-WW-WW-999
      serr = SetObjectValue( "cprojectprod", ImportField(4) )

      ' Field mask is UUUU
      serr = SetObjectValue( "ctaskprod", ImportField(5) )

'Currently Disabled cbouomprod

      serr = SetObjectValue( "cprod_units", ImportField(6) )

      ' Field mask is XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      serr = SetObjectValue( "cup_id00(1)", ImportField(7) )

      ' Field mask is XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      serr = SetObjectValue( "cup_id00(2)", ImportField(8) )

      ' Field mask is XXXXXXXXXXXXXXXXXXXX
      serr = SetObjectValue( "cup_id00(3)", ImportField(9) )

      ' Field mask is XXXXXXXXXXXXXXXXXXXX
      serr = SetObjectValue( "cup_id00(4)", ImportField(10) )

      ' Field mask is XXXXXXXXXX
      serr = SetObjectValue( "cup_id00(5)", ImportField(11) )

      ' Field mask is XXXXXXXXXX
      serr = SetObjectValue( "cup_id06", ImportField(12) )

      ' Field mask is XXXX
      serr = SetObjectValue( "cup_id07", ImportField(13) )

      serr = SetObjectValue( "cup_id08", ImportField(14) )

      ' cup_id09 is a Date Field Type
      serr = SetObjectValue( "cup_id09", ImportField(15) )

      serr = SetObjectValue( "cup_id10", ImportField(16) )


    case TI_Finish


serr = SetObjectValue( "cmdPostTimesheet", "PRESS" )

 End Select

End Sub	


Here this control file i have only one button

cmdPostTimesheet-Create Timecars(s) button.
In Data.csv file i want to add anything?

*This post is locked for comments

  • Verified answer
    ThillaiRaja Profile Picture
    ThillaiRaja 555 on at
    RE: Transaction Import -Press the Button

    Finally I found the answer

     'Button object name ApplyAmount, Caption Apply Am&ount

         serr = SetObjectValue( "ApplyAmount", "PRESS" )

    The above two lines want to paste in the Case 1 end....

    Thanks SV

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Transaction Import -Press the Button

    I don't know how to do what you are asking - but I can tell you what I have done.

    Instead of using TI, I added a Import button to the Project Timesheet Entry screen.  The import button launches a userForm to select the excel file to import, when it is done the user clicks on the create timecards button.  This works well for us as there is no saving as csv and selecting control macros and checking the logs.  We import about 300 timecards in one excel file this way every week.

    Hope this helps - Ayrin

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans