In this article, we will see how to create buttons dynamically in a tkinter window. Creating buttons dynamically means customizing the buttons and their functionality by adding events to them.First, we will import the tkinter library in the notebook, then we will create an instance using the Button function which takes parameters such as parent or root of the window, textvariable which is the value to assign in each button and command.SyntaxButton(parent, textvariable, command)Examplefrom tkinter import * import tkinter as tk # create an instance of tkinter win = tk.Tk() #Define the size of the window win.geometry("700x200") ... Read More
When you upload a file using the gui_upload function, the file is not uploaded to the Application server. The file is read from presentation layer to an internal table.ExampleFollowing code can be used to call a gui_upload function to read the file to an internet table:lv_filename = p_filebp. CLEAR lt_data_tab. IF NOT lv_filename IS INITIAL. CALL FUNCTION 'GUI_UPLOAD' EXPORTING filename = lv_filename TABLES data_tab = lt_data_tab EXCEPTIONS file_open_error = 1 OTHERS = 17. IF sy-subrc 0. EXIT. ... Read More
You have to use parameters correctly in the function. You have to import the file length to an integer value.CALL METHOD cl_gui_frontend_services=>gui_upload_file
...
IMPORTING
filelength = fleng_i
...Next is to write to a character type variable and add parameter i_attachment_size to a class of add attachment.CALL METHOD w_document->add_attachment
EXPORTING
i_attachment_size = fleng
...
You can take reference from GUI Scripting help section and it can explain things in detail.It provides you default property types as per requirement. If you want to perform next step, stop or abort user step, you can use the following properties.ValueDescriptionSSuccessWWarningEErrorA Abort I InformationSee the below code that uses above property type to display different messages −Public Sub get_status_bar_value_exit_if_Error() Dim usr_resp AsString If(session.findById("wnd[0]/sbar").messagetype = "E"Or session.findById("wnd[0]/sbar").messagetype= "W") Then usr_resp =MsgBox(session.findById("wnd[0]/sbar").Text & Chr(13) &"Show the Error in SAP ?", vbYesNo) If usr_resp =vbYes Then Else Callgo_to_Sap_home End If End End If End ... Read More