Get SAP format date

User’s SAP date format might a problem while using Excel VBA application connected to SAP . If SAP date format is different then Excel default format we will not able to make mathematics operation with dates.

Correct Excel date format is YYYY-MM-DD, but other world regions could have different approach. If Excel format date is YYYY-MM-DD when we downloading SAP data with different date format this is DD.MM.YYYY then Excel will see date as text. In order to check what format is using in SAP, SU3 has to be use.

To use code that has been created by me it is important to turn on SAP id controls in SAP settings. Thanks to this we could use this code or eventually customize it for our needs.
In order to get format date Excel has to be connected to SAP. Please see this post: Connection to SAP HANA via Excel VBA.

Private Sub GetSAP_DateFormat()
' Getting user's SAP date format
' There is need to turn on SAP id controls in SAP settings (manual will be add when get access to SAP)

Dim IdDatySAP, TempDateFormat, FormatDatySAP 
Dim LicznikWierszyLX02 as Long

On Error GoTo ErrorHapenned
LicznikWierszyLX02  = 1

' ---------------------------------------------------------------------------
' GETTING  DATE FORMAT FROM SU3
  
Session.FindById("wnd[0]").Maximize
Session.FindById("wnd[0]/tbar[0]/okcd").Text = "su3"
Session.FindById("wnd[0]").SendVKey 0
Session.FindById("wnd[0]/usr/tabsTABSTRIP1/tabpDEFA").Select
TempDateFormat = Session.FindById("wnd[0]/usr/tabsTABSTRIP1/tabpDEFA/ssubMAINAREA:SAPLSUID_MAINTENANCE:1105/cmbSUID_ST_NODE_DEFAULTS-DATFM").Text

' ---------------------------------------------------------------------------
' BACK TO SESSION MANAGER

Session.FindById("wnd[0]/tbar[0]/okcd").Text = "/n"
Session.FindById("wnd[0]").SendVKey 0

' ---------------------------------------------------------------------------
' DATE FORMAT (don't have access to SAP now - possible changes required)

' Ustalanie formatu daty
FormatDatySAP = Left(TempDateFormat, InStr(1, TempDateFormat, " ") - 1)
IdDatySAP = FormatDatySAP 

' Get format date - control id elimination
'If FormatDatySAP > 10 Then
'    FormatDatySAP = Mid(TempDateFormat, 3, InStr(3, TempDateFormat, " ") - 3)
'End If

' ---------------------------------------------------------------------------
' SAP DATA PROCESSING IN EXCEL

' Here should be pasted code to import and paste SAP data

' ---------------------------------------------------------------------------
' DATE FORMAT EXCHANGE

' Don't have access to SAP, but I think code to change date to proper one should like as follow
' Code is using SAP controls id.
' Instead to use control ID, date format can be used
' Date has been pasted to cell earlier

Select Case IdDatySAP
    Case 1
    .Sheets(SheetName).Cells(LicznikWierszyLX02, 13) = Right(.Sheets(SheetName).Cells(LicznikWierszyLX02, 13), 4) & "-" & _
    Mid(.Sheets(SheetName).Cells(LicznikWierszyLX02, 13), 4, 2) & "-" & _
    Left(.Sheets(SheetName).Cells(LicznikWierszyLX02, 13), 2)
    
    Case 2
    .Sheets(SheetName).Cells(LicznikWierszyLX02, 13) = Right(.Sheets(SheetName).Cells(LicznikWierszyLX02, 13), 4) & "-" & _
    Left(.Sheets(SheetName).Cells(LicznikWierszyLX02, 13), 2) & "-" & _
    Mid(.Sheets(SheetName).Cells(LicznikWierszyLX02, 13), 4, 2)
    
    Case 3
    .Sheets(SheetName).Cells(LicznikWierszyLX02, 13) = Right(.Sheets(SheetName).Cells(LicznikWierszyLX02, 13), 4) & "-" & _
    Left(.Sheets(SheetName).Cells(LicznikWierszyLX02, 13), 2) & "-" & _
    Mid(.Sheets(SheetName).Cells(LicznikWierszyLX02, 13), 4, 2)
    
    Case 4
    .Sheets(SheetName).Cells(LicznikWierszyLX02, 13) = Replace(.Sheets(SheetName).Cells(LicznikWierszyLX02, 13), ".", "-", 1)

    Case 5
    .Sheets(SheetName).Cells(LicznikWierszyLX02, 13) = Replace(.Sheets(SheetName).Cells(LicznikWierszyLX02, 13), "/", "-", 1)
     
    Case 6
    ' correct format
End Select

Exit Sub

' ----------------------------------------------------------
' POSSIBLE ERRORS HANDLING

ErrorHapenned:
ErrOpis = Err.Description
ErrStatus = True
ErlLine = Erl

End Sub

139 thoughts on “Get SAP format date

  1. Pingback: keto meals

  2. Positive site, where did u come up with the information on this posting? I’m pleased I discovered it though, ill be checking back soon to find out what additional posts you include.

  3. Pingback: gay fantasy dating sims

  4. Pingback: aralen cheap

  5. Pingback: latisse buy

  6. Pingback: canadian pharmacies

  7. Pingback: canadian prescription drugstore

  8. Pingback: weruybsd.fireblogz.com39575666four-issues-to-do-immediately-about-online-pharmacies

  9. Pingback: telegra.phHow-Has-The-COVID-19-Pandemic-Changed-Our-Lives-Globally-02-24

  10. Pingback: gerweds.over-blog.com202203modeling-covid-19-mortality-risk-in-toronto-canada-sciencedirect.html

  11. Pingback: canada pharmacies online

  12. Pingback: gwertvb.mystrikingly.com

  13. Pingback: telegra.phIs-It-Safe-To-Lift-COVID-19-Travel-Bans-04-06

  14. Pingback: canadian pharmacies that ship to us

  15. Pingback: https://chubo3.wixsite.com/canadian-pharmacy/post/what-parents-must-find-out-about-kids-and-covid-19

  16. Pingback: canadian-pharmacies0.yolasite.com

  17. Pingback: canada drug pharmacy

  18. Pingback: https://kevasw.webgarden.com/

  19. Pingback: https://62553dced4718.site123.me/

  20. Pingback: seketu.gonevis.comhigh-10-tips-with-order-medicine-online-1

  21. Pingback: site128620615.fo.team

  22. Pingback: canadian pharmacy world

  23. Pingback: hernswe.gonevis.comscientists-model-true-prevalence-of-covid-19-throughout-pandemic

  24. Pingback: selomns.gonevis.coma-modified-age-structured-sir-model-for-covid-19-type-viruses

  25. Pingback: fwervs.gumroad.com

  26. Pingback: buy cialis cheap

  27. Pingback: buy tadalafil no prescription

  28. Pingback: 626106aa4da69.site123.meblognew-step-by-step-roadmap-for-tadalafil-5mg

  29. Pingback: buy generic cialis pills

  30. Pingback: https://hsoybn.estranky.sk/clanky/tadalafil-from-india-vs-brand-cialis---sexual-health.html

  31. Pingback: skuvsbs.gonevis.comwhen-tadalafil-5mg-competitors-is-good

  32. Pingback: hemuyrt.livejournal.com325.html

  33. Pingback: site373681070.fo.team

  34. Pingback: buy cialis usa

  35. Pingback: https://ghswed.wordpress.com/2022/04/27/he-final-word-information-to-online-pharmacies/

  36. Pingback: kerbgsw.mystrikingly.com

  37. Pingback: https://kuebser.estranky.sk/clanky/supereasy-methods-to-study-every-part-about-online-medicine-order-discount.html

  38. Pingback: https://kewertyn.wordpress.com/2022/04/27/expect-more-virtual-house-calls-out-of-your-doctor-thanks-to-telehealth-revolution/

  39. Pingback: kerbiss.wordpress.com2022042714

  40. Pingback: canada pharmacies

  41. Pingback: https://sernert.estranky.sk/clanky/confidential-information-on-online-pharmacies.html

  42. Pingback: https://kertubs.mystrikingly.com/

  43. Pingback: https://626f977eb31c9.site123.me/blog/how-google-is-changing-how-we-approach-online-order-medicine-1

  44. Pingback: https://canadian-pharmaceuticals-online.yolasite.com/

  45. Pingback: https://online-pharmacies0.yolasite.com/

  46. Pingback: https://6270e49a4db60.site123.me/blog/the-untold-secret-to-mastering-aspirin-in-just-7-days-1

  47. Pingback: deiun.flazio.com

  48. Pingback: kertyun.flazio.com

  49. Pingback: https://kerntyas.gonevis.com/the-mafia-guide-to-online-pharmacies/

  50. Pingback: canadian mail order pharmacies

  51. Pingback: nanos.jpjmp?url=cialisonlinei.com

  52. Pingback: ime.nucialisonlinei.com

  53. Pingback: https://womed7.wixsite.com/pharmacy-online/post/new-ideas-into-canada-pharmacies-never-before-revealed

  54. Pingback: canadian pharmacy viagra brand

  55. Pingback: https://sekyuna.gonevis.com/three-step-guidelines-for-online-pharmacies/

  56. Pingback: https://gewrt.usluga.me/

  57. Pingback: canadian pharmacy meds

  58. Pingback: canada medication

  59. Pingback: canadian pharmacy king

  60. Pingback: https://site656670376.fo.team/

  61. Pingback: site561571227.fo.team

  62. Pingback: site102906154.fo.team

  63. Pingback: https://hekluy.ucraft.site/

  64. Pingback: https://kawsear.fwscheckout.com/

  65. Pingback: canada pharmacy

  66. Pingback: list of reputable canadian pharmacies

  67. Pingback: online pharmacy

  68. Pingback: https://avuiom.sellfy.store/

  69. Pingback: pharmacies.bigcartel.com

  70. Pingback: canadian pharmacies online prescriptions

  71. Pingback: canada viagra

  72. Pingback: https://kqwsh.wordpress.com/2022/05/16/what-everybody-else-does-when-it-comes-to-online-pharmacies/

  73. Pingback: http://site592154748.fo.team/

  74. Pingback: lasert.gonevis.comrecommended-canadian-pharmacies-2

  75. Pingback: http://aonubs.website2.me/

  76. Pingback: dkyubn.bizwebs.com

  77. Pingback: asebg.bigcartel.comcanadian-pharmacy

  78. Pingback: canada pharmacies online

  79. Pingback: kertvbs.webgarden.com

  80. Pingback: disvaiza.mystrikingly.com

  81. Pingback: highest rated canadian pharmacies

  82. Pingback: https://kewburet.wordpress.com/2022/04/27/how-to-keep-your-workers-healthy-during-covid-19-health-regulations/

  83. Pingback: https://kaswesa.nethouse.ru/

  84. Pingback: https://628f789e5ce03.site123.me/blog/what-everybody-else-does-when-it-comes-to-canadian-pharmacies

  85. Pingback: canadian-pharmaceutical.webflow.io

  86. Pingback: psy-

  87. Pingback: no 1 canadian pharcharmy online

  88. Pingback: projectio

  89. Pingback: moskva psiholog online

  90. Pingback: slovar po psihoanalizu laplansh

  91. Pingback: psy online

  92. Pingback: pharmacy.prodact.site

  93. Pingback: hub.docker.comrgservpharmacies

  94. Pingback: uels ukrain

  95. Pingback: https://hertb.mystrikingly.com/

  96. Pingback: Canadian Pharmacies Shipping to USA

  97. Pingback: https://selera.mystrikingly.com/

  98. Pingback: ksorvb.estranky.skclankywhy-online-pharmacies-is-good-friend-to-small-business.html

  99. Pingback: https://gevcaf.estranky.cz/clanky/safe-canadian-online-pharmacies.html

  100. Pingback: https://kwersv.proweb.cz/

  101. Pingback: DPTPtNqS

  102. Pingback: qQ8KZZE6

  103. Pingback: D6tuzANh

  104. Pingback: SHKALA TONOV

  105. Pingback: Øêàëà òîíîâ

  106. Pingback: russianmanagement.com

  107. Pingback: chelovek-iz-90-h

  108. Pingback: sdtyli.zombeek.cz

  109. Pingback: kwsde.zombeek.cz

  110. Pingback: 3Hk12Bl

  111. Pingback: 3NOZC44

  112. Pingback: https://heklrs.wordpress.com/2022/06/14/canadian-government-approved-pharmacies/

  113. Pingback: 01211

  114. Pingback: tor-lyubov-i-grom

  115. Pingback: film-tor-2022

  116. Pingback: hd-tor-2022

  117. Pingback: hdorg2.ru

  118. Pingback: iercvsw.wordpress.com20220614canadian-pharmacies-the-fitting-manner

  119. Pingback: JXNhGmmt

  120. Pingback: Psikholog

  121. Pingback: netstate.ru

  122. Pingback: 2painted

  123. Pingback: site955305180.fo.team

  124. Pingback: Link

  125. Pingback: site841934642.fo.team

  126. Pingback: https://62b2f636ecec4.site123.me/blog/canadian-pharmaceuticals-online

  127. Pingback: https://62b2ffff12831.site123.me/blog/canadian-pharmaceuticals-for-usa-sales

  128. Pingback: tor-lyubov-i-grom.ru

  129. Pingback: psy

  130. Pingback: chelovek soznaniye mozg

  131. Pingback: https://thefencefilm.co.uk/community/profile/hswlux/

  132. Pingback: bit.ly

  133. Pingback: https://anewearthmovement.org/community/profile/mefug/

  134. Pingback: drugstore online

  135. Pingback: canadianpharmacy

  136. Pingback: herbsd.iwopop.com

  137. Pingback: cleantalkorg2.ru

  138. Pingback: canadian drugs

  139. Pingback: bucha killings

Leave a Reply

Your email address will not be published.