DATA : lv_answer . CALL FUNCTION ‘POPUP_WITH_2_BUTTONS_TO_CHOOSE’ EXPORTING diagnosetext1 = ‘Please Choose Option’ textline1 = space textline2 = space text_option1 = ‘YES’ text_option2 = ‘NO’ titel = ‘Check’ IMPORTING answer = lv_answer. CASE lv_answer. WHEN ‘1’. WRITE ‘Yes is selected, proceeding…’. ” continue logic WHEN ‘2’. WRITE
‘No is selected, retruning …’. ” return logic WHEN OTHERS. ENDCASE. Execute the program. Output :
Author: coderobbot
Function Module ‘POPUP_WITH_WARNING’ to display a POP UP
CALL FUNCTION ‘POPUP_WITH_WARNING’ EXPORTING textline1 = ‘Some Important Info Missing’ textline2 = ‘Still Want to Continue’ titel = ‘Warning’. WRITE ‘proceed after warning popup’. Execute the program. Here is the pop up. After continue.
Accessing one program data in another program easily without export and import / Set and Get
The first program sets a table record LT and calls subroutine of the second program and it doesn’t pass the table to the subroutine. Hers
Downloading Internal Table as a ZIP file on the Presentation Server
DATA : lt TYPE TABLE OF scarr, ls TYPE scarr, lv_string TYPE string, lv_xstring TYPE xstring, lr_zip TYPE REF TO cl_abap_zip, lt_bin TYPE TABLE OF x255. START-OF-SELECTION. SELECT * FROM scarr INTO TABLE lt. LOOP AT lt INTO ls. CONCATENATE lv_string ls INTO lv_string SEPARATED BY cl_abap_char_utilities=>newline. ENDLOOP. * Convert String to X String CALL FUNCTION ‘SCMS_STRING_TO_XSTRING’ EXPORTING text = lv_string IMPORTING buffer = lv_xstring. CREATE OBJECT lr_zip. * Add teh X String as a Zip file CALL METHOD lr_zip->add EXPORTING name = ‘flight’ content = lv_xstring. CALL METHOD lr_zip->save RECEIVING
Locking DB table in SAP by Standard Function Module
PARAMETERS : p_table TYPE tabname. * FM to lock a table CALL FUNCTION ‘ENQUEUE_E_TABLE’ EXPORTING mode_rstable = ‘E’ tabname = p_table * VARKEY = * X_TABNAME = ‘ ‘ * X_VARKEY = ‘ ‘ * _SCOPE = ‘2’ * _WAIT = ‘ ‘ * _COLLECT = ‘ ‘ EXCEPTIONS foreign_lock = 1 system_failure = 2 OTHERS = 3. IF sy–subrc = 0. MESSAGE ‘Table locked’ TYPE ‘I’. ENDIF. * FM to unlock the table CALL FUNCTION ‘DEQUEUE_E_TABLE’ EXPORTING mode_rstable = ‘E’ tabname = p_table * _COLLECT = ‘ ‘
Function Module that provides details of a table
PARAMETERS : p_table TYPE dfies–tabname DEFAULT ‘VBAK’. DATA : lt TYPE TABLE OF dfies, ls_layout TYPE slis_layout_alv. * FM that provides details of a Table CALL FUNCTION ‘DDIF_NAMETAB_GET’ EXPORTING tabname = p_table status = ‘A’ TABLES dfies_tab = lt. ls_layout–colwidth_optimize = ‘X’. CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’ EXPORTING i_callback_program = sy–repid i_structure_name = ‘DFIES’ is_layout = ls_layout TABLES t_outtab = lt.