'SAP GUI Script with input window

I am working in finance and I have to download reports with different dates.

I can generate SAP GUI scripts but those contain date as fixed text or "Date" as current date. I have added it as variable in first 2 rows.

My question is if I can somehow implement an input window where I could insert dates I really want and didn't have to go in way like "Date - 30" to insert last day of previous month.

If it is not possible with SAP GUI script, can it be done by using Python?

Thank you in advance! :-)

Br, David

  d_current_month = Date - 1
    d_prior_month = Date - 30
    If Not IsObject(application) Then
       Set SapGuiAuto  = GetObject("SAPGUI")
       Set application = SapGuiAuto.GetScriptingEngine
    End If
    If Not IsObject(connection) Then
       Set connection = application.Children(0)
    End If
    If Not IsObject(session) Then
       Set session    = connection.Children(0)
    End If
    If IsObject(WScript) Then
       WScript.ConnectObject session,     "on"
       WScript.ConnectObject application, "on"
    End If
    session.findById("wnd[0]").maximize
    session.findById("wnd[0]/tbar[0]/okcd").text = "/nZV_QUERY_DL"
    session.findById("wnd[0]").sendVKey 0
    session.findById("wnd[0]/tbar[1]/btn[17]").press
    session.findById("wnd[1]/tbar[0]/btn[8]").press
    session.findById("wnd[1]/usr/cntlALV_CONTAINER_1/shellcont/shell").selectedRows = "0"
    session.findById("wnd[1]/usr/cntlALV_CONTAINER_1/shellcont/shell").doubleClickCurrentCell
    session.findById("wnd[0]/usr/tabsTABSTRIP_MYTAB/tabpPUSH1/ssub%_SUBSCREEN_MYTAB:Z_SD_R_NEB_ORDER_QUERY:0111/ctxtS_BUKRS-LOW").text = "232"
    session.findById("wnd[0]/usr/tabsTABSTRIP_MYTAB/tabpPUSH1/ssub%_SUBSCREEN_MYTAB:Z_SD_R_NEB_ORDER_QUERY:0111/ctxtS_BUKRS-HIGH").text = "233"
    session.findById("wnd[0]/usr/tabsTABSTRIP_MYTAB/tabpPUSH1/ssub%_SUBSCREEN_MYTAB:Z_SD_R_NEB_ORDER_QUERY:0111/ctxtS_VKORG-LOW").text = "232"
    session.findById("wnd[0]/usr/tabsTABSTRIP_MYTAB/tabpPUSH1/ssub%_SUBSCREEN_MYTAB:Z_SD_R_NEB_ORDER_QUERY:0111/ctxtS_VKORG-HIGH").text = "233"
    session.findById("wnd[0]/usr/tabsTABSTRIP_MYTAB/tabpPUSH1/ssub%_SUBSCREEN_MYTAB:Z_SD_R_NEB_ORDER_QUERY:0111/ctxtS_WSTDAT-LOW").text = d_prior_month
    session.findById("wnd[0]/usr/tabsTABSTRIP_MYTAB/tabpPUSH1/ssub%_SUBSCREEN_MYTAB:Z_SD_R_NEB_ORDER_QUERY:0111/ctxtS_WSTDAT-HIGH").text = d_current_month
    session.findById("wnd[0]/usr/tabsTABSTRIP_MYTAB/tabpPUSH1/ssub%_SUBSCREEN_MYTAB:Z_SD_R_NEB_ORDER_QUERY:0111/ctxtS_WSTDAT-HIGH").setFocus
    session.findById("wnd[0]/usr/tabsTABSTRIP_MYTAB/tabpPUSH1/ssub%_SUBSCREEN_MYTAB:Z_SD_R_NEB_ORDER_QUERY:0111/ctxtS_WSTDAT-HIGH").caretPosition = 9
    session.findById("wnd[0]/tbar[1]/btn[8]").press
    session.findById("wnd[0]/usr/cntlCC_CONTAINER/shellcont/shell").pressToolbarContextButton "&MB_EXPORT"
    session.findById("wnd[0]/usr/cntlCC_CONTAINER/shellcont/shell").selectContextMenuItem "&XXL"
    session.findById("wnd[1]/usr/ctxtDY_PATH").text = "XXXX"
    session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "XXX"
    session.findById("wnd[1]/usr/ctxtDY_FILENAME").caretPosition = 29
    session.findById("wnd[1]/tbar[0]/btn[11]").press
    session.findById("wnd[0]/tbar[0]/btn[15]").press
    session.findById("wnd[0]/tbar[0]/btn[15]").press


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source