From 113a8ba11b11b471fb50693973c7cd3d7239b97d Mon Sep 17 00:00:00 2001 From: Mathias G Date: Thu, 7 Aug 2025 08:42:17 +0200 Subject: [PATCH 1/2] Detect inactive FP popup --- itk_dev_shared_components/sap/fmcacov.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/itk_dev_shared_components/sap/fmcacov.py b/itk_dev_shared_components/sap/fmcacov.py index 8297fc0..0f9d755 100644 --- a/itk_dev_shared_components/sap/fmcacov.py +++ b/itk_dev_shared_components/sap/fmcacov.py @@ -10,7 +10,7 @@ def open_forretningspartner(session, fp: str) -> None: fp: The forretningspartner number. Raises: - ValueError: If the forretningspartner wasn't found. + LookupError: If the forretningspartner wasn't found. """ session.StartTransaction('fmcacov') @@ -18,10 +18,18 @@ def open_forretningspartner(session, fp: str) -> None: session.findById("wnd[0]/usr/ctxtGPART_DYN").text = fp session.findById("wnd[0]").sendVKey(0) - # Detect window "Forretningspartner * Entries" - if session.findById('wnd[1]/usr', False) is not None: - # Pop-up detected - for row_id in range(3, 5): + # Detect popup + popup = session.findById('wnd[1]', False) + + # Inactive FP popup + if popup and popup.Text == "BP inactive": + # Click 'OK' + session.FindById("wnd[1]/tbar[0]/btn[25]").press() + + # "Forretningspartner 2 Entries" popup + elif popup and popup.Text == 'Forretningspartner 2 Entries': + # Look for matching fp number + for row_id in (3, 4): fp_row = session.FindById(f'wnd[1]/usr/lbl[103,{row_id}]') if fp_row.text == fp: fp_row.SetFocus() @@ -29,8 +37,7 @@ def open_forretningspartner(session, fp: str) -> None: session.FindById('wnd[1]/tbar[0]/btn[0]').press() break else: - # Range exhausted - raise ValueError(f"Forretningspartner '{fp}' was not found in pop-up.") + raise LookupError(f"Forretningspartner '{fp}' was not found in pop-up.") def dismiss_key_popup(session, fp: str = "25564617") -> None: From fa4fcf0a1062ad330f4fa4b43bac0cd0e9a2b2e6 Mon Sep 17 00:00:00 2001 From: Mathias G Date: Thu, 7 Aug 2025 08:46:30 +0200 Subject: [PATCH 2/2] Updated changelog --- changelog.md | 9 ++++++++- pyproject.toml | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 48369f1..f11cb01 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.12.1] - 2025-08-07 + +### Fixed + +- SAP: Dismiss popup when opening an inactive FP. + ## [2.12.0] - 2025-06-17 ### Added @@ -226,7 +232,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release -[Unreleased]: https://github.com/itk-dev-rpa/ITK-dev-shared-components/compare/2.12.0...HEAD +[Unreleased]: https://github.com/itk-dev-rpa/ITK-dev-shared-components/compare/2.12.1...HEAD +[2.12.1]: https://github.com/itk-dev-rpa/ITK-dev-shared-components/releases/tag/2.12.1 [2.12.0]: https://github.com/itk-dev-rpa/ITK-dev-shared-components/releases/tag/2.12.0 [2.11.1]: https://github.com/itk-dev-rpa/ITK-dev-shared-components/releases/tag/2.11.1 [2.11.0]: https://github.com/itk-dev-rpa/ITK-dev-shared-components/releases/tag/2.11.0 diff --git a/pyproject.toml b/pyproject.toml index 81420c1..1ff963e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "itk_dev_shared_components" -version = "2.12.0" +version = "2.12.1" authors = [ { name="ITK Development", email="itk-rpa@mkb.aarhus.dk" }, ]