cancel
Showing results for 
Search instead for 
Did you mean: 

How to Open File Dialog box in SAP B1 9.1 on top of the SAP Screen?

Former Member
0 Kudos

Hi All,

When I need to open the 'OpenFileDialog' window in SAP, I used its 'ShowDialog(IWin32Window)' method, by parsing the 'Sap Business One''s Main window handler as the parameter.

It worked fine and showed on top of SAP screen, But when I try the same in SAP 9.1 it close the 'OpenFileDialog' box with the status of Cancel. Is there any other way to show this dialog on top of the SAP screen? Your thoughts and ideas are really appreciated.

Best Regards,

J S L Geeganage

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member445524
Participant
0 Kudos
Jeewan Sucharitha Lanka Geeganage:

> When I need to open the 'OpenFileDialog' window in
> SAP, I used its 'ShowDialog(IWin32Window)' method,
> by  parsing  the  'Sap Business One''s Main window
> handler as the parameter.

Strange.  I have reported this error to the SAP sup-
port,  and  they  said  they  fixed  it.   See  note
1960726: 64-bit SAP Business One client cannot  open
Windows modal forms as child windows.

P.S.: Attached  is  my  original  error  report, for
      whatever it is worth.
Former Member
0 Kudos

Hi All,

The OpenFileDialog is an old recurring question.

From my side, the only piece of code which is working accross all versions and environments (so including TSE) can be found here: http://scn.sap.com/thread/40272 (search after Denis Sapunkov's answer).

You'll find attached Denis' contribution converted for my own Framework.

Regards,

Eric

Former Member
0 Kudos

Hi ERIC,

It works indeed. And I also tried to reproduce the issue with my previous code. But It won't. I changed following line


IntPtr ptr = GetForegroundWindow();

with


IntPtr ptr = System.Diagnostics.Process.GetProcessesByName("Sap business one").First().MainWindowHandle;

And my code was missing


while (!threadGetFile.IsAlive); // Wait for thread to get started

Thread.Sleep(1); // Wait a sec more


So now everything working well without refereeing the unmanaged code as well.


Regards,
J S L Geeganage

Former Member
0 Kudos

Hi Anton,

Thanks for the reply, I don't get the same issue after I tried as Eric showed. Then I changed my code back as it was and that working fine as well.

Best Regards,
J S L Geeganage

Former Member
0 Kudos

Hi Jeewan,

Glad it works for you now.

Don't forget to close the thread if the question is answered.

Regards,

Eric