Real Time Reports
Real Time Reports
Real Time Reports
Enter the name of the program, choose Variants radio button and press Display button.
When you click on menu Utilities > Transport request, it will call the SAP standard report RSTRANSP. You can also reach the above screen by just executing the report RSTRANSP in ABAP Editor (SE38). Enter the name of the program and variant name and execute (F8).
Select all the variants you want to transport and press continue.
Assign the variant to an already existing Transport request or create a new request.
*----------------------------------------------------------------------* PERFORM get_data. IF NOT gt_spfli[] IS INITIAL. PERFORM save_file. ELSE. MESSAGE 'No data found' TYPE 'I'.
*&---------------------------------------------------------------------* FORM get_data. *Get data from table SPFLI SELECT * FROM spfli INTO TABLE gt_spfli. ENDFORM. " get_data
*&---------------------------------------------------------------------* FORM save_file. *Move complete file path to file name gv_filename = 'C:\test\data.txt'.
*Download the internal table data into a file in SAP presentation server CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING filename filetype = gv_filename = 'ASC'
= 'X'
= gt_spfli.
ENDFORM.
" save_file
When you execute the above program, the file data.txt will be downloaded to C:\test.
We can also use GUI_DOWNLOAD method of CL_GUI_FRONTEND_SERVICES class to download the file. Instead of calling GUI_DOWNLOAD function module in the save_file subroutine of above program, call the GUI_DOWNLOAD method of CL_GUI_FRONTEND_SERVICES class.
Use the following steps to download the ABAP internal table data to a file in SAP application server. 1. 2. 3. Declare a ABAP internal table and fill the internal table with required data. Use OPEN DATASET ABAP statement to open/create a file on the SAP application server. Loop through the internal table and use TRANSFER ABAP statement to move each internal table record to file on application server. 4. Close the file on the application server using CLOSE DATASET ABAP statement. Below program uses OPEN DATASET, TRANSFER and CLOSE DATASET statements to download the file.
*----------------------------------------------------------------------* * START-OF-SELECTION
*----------------------------------------------------------------------* PERFORM get_data. IF NOT gt_spfli[] IS INITIAL. PERFORM save_file. ELSE. MESSAGE 'No data found' TYPE 'I'.
*&---------------------------------------------------------------------* FORM get_data. *Get data from table SPFLI SELECT * FROM spfli INTO TABLE gt_spfli. ENDFORM. " get_data
* Open the file in output mode OPEN DATASET gv_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT. IF sy-subrc NE 0.
LOOP AT gt_spfli INTO gwa_spfli. CONCATENATE gwa_spfli-carrid gwa_spfli-connid gwa_spfli-countryfr gwa_spfli-cityfrom gwa_spfli-airpfrom gwa_spfli-countryto gwa_spfli-cityto gwa_spfli-airpto gwa_spfli-arrtime INTO lv_data SEPARATED BY ','. *TRANSFER moves the above fields from workarea to file *delimited format TRANSFER lv_data TO gv_file. CLEAR: gwa_spfli. ENDLOOP. with comma
ENDFORM.
" save_file
When you execute the above program, the data in the internal table will be downloaded to a file on the application server. Use t-code AL11 to view the file on SAP application server.
Use the following steps to upload data from a file in SAP application server to ABAP internal table. 1. 2. 3. Declare a ABAP internal table. Use OPEN DATASET ABAP statement to open file on appliction server. Use READ DATASET ABAP statement to read each line in the file to workarea. Append work area data to internal table. 4. 5. Use CLOSE DATASET ABAP statement to close the application server file. Process the data in the internal table. Below program uses OPEN DATASET, READ DATASET and CLOSE DATASET statements to upload the file.
*----------------------------------------------------------------------* * START-OF-SELECTION
*&---------------------------------------------------------------------*
*&
Form
read_file
*Open the file in application server to read the data OPEN DATASET gv_file FOR INPUT IN TEXT MODE ENCODING DEFAULT. IF sy-subrc NE 0. MESSAGE 'Unable to open file' TYPE 'I'. ENDIF. DO. * * Loop through the file, if a record is found move it to temporary structure else exit out of the loop. READ DATASET gv_file INTO lv_data. IF sy-subrc = 0. * * Split the fields in temporary structure to corresponding fields in workarea. SPLIT lv_data AT ',' INTO gwa_spfli-carrid
gwa_spfli-connid gwa_spfli-countryfr gwa_spfli-cityfrom gwa_spfli-airpfrom gwa_spfli-countryto gwa_spfli-cityto gwa_spfli-airpto gwa_spfli-arrtime. APPEND gwa_spfli TO gt_spfli. CLEAR gwa_spfli. ELSE. EXIT. ENDIF. ENDDO. *Close the file CLOSE DATASET gv_file.
ENDFORM.
" read_file
*&---------------------------------------------------------------------* FORM display_data . LOOP AT gt_spfli INTO gwa_spfli. WRITE:/ gwa_spfli-carrid, gwa_spfli-connid, gwa_spfli-countryfr, gwa_spfli-cityfrom, gwa_spfli-airpfrom, gwa_spfli-countryto, gwa_spfli-cityto, gwa_spfli-airpto, gwa_spfli-arrtime. CLEAR: gwa_spfli. ENDLOOP. ENDFORM. " DISPLAY_DATA
When you execute the above program reads the data from the file in application server and displays the following output.
5.
1. 2.
Use the following steps to provide ABAP F4 help for SAP application server file on selection screen. Declare a input field(PARAMETER) for filename. Use function module /SAPDMC/LSM_F4_SERVER_FILE in AT SELECTION-SCREEN ON VALUE-REQUEST FOR FIELD event to provide F4 help for SAP application server file. 3. Upload data from/Download data to file. Below program uses function module/SAPDMC/LSM_F4_SERVER_FILE to provide ABAP F4 help for a file on application server.
g_directory = '.'.
*F4 help for file name on SAP application server CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE' EXPORTING directory IMPORTING serverfile EXCEPTIONS canceled_by_user = 1 OTHERS IF sy-subrc <> 0. MESSAGE 'Error Message' TYPE 'I'. ENDIF. = 2. = p_file = g_directory
*----------------------------------------------------------------------* * START-OF-SELECTION
When you execute the above program and press F4 help for file on selection screen, file dialog pop up will be displayed.
Sometimes we want to run reports only in background due to performance issues or some other reasons. Here we are trying to deactivate the EXECUTE option altogether so that the user has to use background option only. Function module RS_SET_SELSCREEN_STATUS can be used to exclude any function codes from customized or standard GUI status on selection screen. ONLI is the function code attached to the EXECUTE option. We can deactivate this option using the following code.
PARAMETERS: p_name(10).
AT SELECTION-SCREEN OUTPUT.
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS' EXPORTING p_status * P_PROGRAM TABLES = sy-pfkey = ' '
p_exclude
= gt_ucomm.
Sometimes
we
bad
performance Sales
while
accessing
the
following
SD
Header
Header Item
Billing:
The R/3 System contains no secondary indexes to the most important SD transaction data tables in the delivery. Instead, the R/3 System has proprietary index tables (sales document indexes, for example the tables VAKPA and VAPMA, matchcode tables for example M_VMVAB, M_VMVAC or matchcode views for example M_VMVAA, M_VMVAE), which allow an efficient access. Consider the following NOTES mentioned in SAP Note 185530 while accessing SAP SD tables in order to improve the performance: 1. Search for deliveries with sales order number (preceding document, field LIPS-VGBEL): Incorrect:
SELECT vgbel FROM vbrp WHERE vbeln = ...; or SELECT aubel FROM vbrp WHERE vbeln = ...
Search Incorrect: for shipping unit item with delivery
Sometimes
we
bad
performance
while
accessing
the
following Segment:
SAP
MM
tables: Material
Document
Purchase
Requisition
Consider the following NOTES mentioned in SAP Note 191492 while accessing SAP MM tables in order to improve the 1. Access to material documents via the purchase order number Incorrect: performance:
SELECT FROM EKBE WHERE EBELN = .. AND EBELP = ... AND VGABE IN (1,6,7,8,9).
SELECT FROM MSEG WHERE MBLNR = EKBE-BELNR AND MJAHR = EKBE-GJAHR AND ZEILE = EKBE-BUZEI.
Remark: The fiscal year must be specified so that the system has effective access possibilities via the primary index.If the fiscal year is missing, the database can no longer effectively use the item number for the search (this is a problem, especially for material documents with many items).If the operation type VGABE is specified, the values can be additionally restricted to the corresponding goods movements that are relevant. 2. Access to material documents Via the vendor number Incorrect:
SELECT MSEG WHERE MBLNR = EKBE-BELNR AND MJAHR = EKBE-GJAHR AND ZEILE = EKBE-BUZEI.
Remark: Accesses to EKKO and EKBE return several datasets under certain circumstances. This must be taken into account in the program logic.With the operation type VGABE = 1, only goods movements for purchase orders are selected. As an alternative you can use matchcode object M_MEKKL in place of table EKKO (for example SELECT FROM M_EKKL WHERE LIFNR = ).Access can be improved by specifying additional restrictions.Thefields purchasing organization EKORG, purchasing group EKGRP, document date BEDAT, purchasing document category BSTYP, order type BSART can make the access more selective. 3. Accesses to purchase requisitions via the reservation number Incorrect:
SELECT FROM EKBE WHERE EBELN = ... AND EBELP = ... AND VGABE IN (2,3,P).
SELECT FROM RSEG WHERE BELNR = EKBE-BELNR AND GJAHR = EKBE-GJAHR AND BUZEI = EKBE-BUZEI.
Remark: By specifying transaction type VGABE, the values are restricted to the relevant goods movements. With GJAHR and BUZEI, the primary index is completely utilized by RSEG. Refer to SAP Note 191492 for more information.
The properties for the logo in SAP Easy Access is maintained in the table "SSM_CUST". First upload the logo to SAP system. Then go to SM30 to maintain the table SSM_CUST.
The table SSM_CUST consists name value pairs for different properties. The property START_IMAGE contains the name of the logo to be displayed in SAP Easy Access. Please maintain the proper name of the logo i.e uploaded using SMW0 and save the entries. Now open a new session and observe the new logo in SAP Easy Access.
Other properties in the table also controls the display of the logo in SAP Easy Access. For example, if we set HIDE_START_IMAGE to YES it will not display the logo. Similarly if we set RESIZE_IMAGE to NO it will display the image with original size.
Use the tcode SMW0 to upload the company logo to SAP system. Go to tcode SMW0.
Select Binary data for WebRFC applications radio button and press find(F8) button.
The logo is uploaded to SAP and is ready to use in SAP ABAP programs.
We can provide custom F4 help for any input fields on selection screen using the function module F4IF_INT_TABLE_VALUE_REQUEST in AT SELECTION-SCREEN ON VALUE-REQUEST FOR field event.
TYPES: BEGIN OF ty_matnr, matnr TYPE makt-matnr, maktx TYPE makt-maktx, END OF ty_matnr. *--------------------------------------------------------------* *Data Declaration *--------------------------------------------------------------* DATA: gwa_matnr gt_matnr DATA: gt_return TYPE ty_matnr, TYPE TABLE OF ty_matnr. TYPE TABLE OF ddshretval,
gwa_return TYPE ddshretval. *--------------------------------------------------------------* *Selection-Screen *--------------------------------------------------------------* PARAMETERS: p_matnr TYPE mara-matnr.
REFRESH gt_matnr.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING retfield value_org TABLES value_tab return_tab EXCEPTIONS parameter_error = 1 no_values_found = 2 OTHERS = 3. = gt_matnr = gt_return = 'MATNR' = 'S'
READ TABLE gt_return INTO gwa_return INDEX 1. IF sy-subrc = 0. p_matnr = gwa_return-fieldval. ENDIF.
Selection Screen Output
Use the function module COPO_POPUP_TO_DISPLAY_TEXTLIST to create custom F1 help for checkbox and radio button in SAP ABAP.
DATA: gt_text
gwa_text-tdformat = 'U1'. " To display text in blue color gwa_text-tdline = 'F1 Help'. APPEND gwa_text TO gt_text. CLEAR gwa_text.
= 'F1 Help'
Dropdown list is a user interface element which displays a list of values from which a user can select one value. Follow the below steps to create a dropdown list in SAP ABAP selection screen.
First build the list in the INITIALIZATION event. Capture the value selected by the user from the list in the AT SELECTION-SCREEN event. Use the selected value for further processing.
TYPE-POOLS: vrm.
DATA: gv_selected_value(10) TYPE c. *--------------------------------------------------------------* *Selection-Screen *--------------------------------------------------------------* PARAMETERS: list TYPE c AS LISTBOX VISIBLE LENGTH 20. *--------------------------------------------------------------* *At Selection Screen *--------------------------------------------------------------* AT SELECTION-SCREEN ON list. CLEAR: gwa_values, gt_values. REFRESH gt_values. gwa_values-fieldname = 'LIST'. APPEND gwa_values TO gt_values. CALL FUNCTION 'DYNP_VALUES_READ'
READ TABLE gt_values INDEX 1 INTO gwa_values. IF sy-subrc = 0 AND gwa_values-fieldvalue IS NOT INITIAL. READ TABLE gt_list INTO gwa_list WITH KEY key = gwa_values-fieldvalue. IF sy-subrc = 0. gv_selected_value = gwa_list-text. ENDIF. ENDIF. *--------------------------------------------------------------* *Initialization *--------------------------------------------------------------* INITIALIZATION. gwa_list-key = '1'. gwa_list-text = 'Product'. APPEND gwa_list TO gt_list. gwa_list-key = '2'. gwa_list-text = 'Collection'. APPEND gwa_list TO gt_list. gwa_list-key = '3'. gwa_list-text = 'Color'. APPEND gwa_list TO gt_list. gwa_list-key = '4'. gwa_list-text = 'Count'. APPEND gwa_list TO gt_list.
We can create pushbuttons on ABAP selection screen using the statement SELECTION-SCREEN PUSHBUTTON. The event that gets triggered when the pushbutton is pressed is handled in the AT SELECTION-SCREEN event.
TABLES sscrfields. *--------------------------------------------------------------* *Selection-Screen *--------------------------------------------------------------* SELECTION-SCREEN: PUSHBUTTON /2(40) button1 USER-COMMAND but1, PUSHBUTTON /2(40) button2 USER-COMMAND but2. *--------------------------------------------------------------* *At Selection-Screen *--------------------------------------------------------------* AT SELECTION-SCREEN. CASE sscrfields. WHEN 'BUT1'. MESSAGE 'Button 1 was clicked' TYPE 'I'. WHEN 'BUT2'. MESSAGE 'Button 2 was clicked' TYPE 'I'. ENDCASE. *--------------------------------------------------------------* *Initialization *--------------------------------------------------------------* INITIALIZATION. button1 = 'Button 1'. button2 = 'Button 2'.
Selection Screen Output
TYPE-POOLS: icon. TABLES sscrfields. *--------------------------------------------------------------* *Selection-Screen *--------------------------------------------------------------* SELECTION-SCREEN: PUSHBUTTON /2(40) button1 USER-COMMAND but1, PUSHBUTTON /2(40) button2 USER-COMMAND but2. *--------------------------------------------------------------* *At Selection-Screen *--------------------------------------------------------------* AT SELECTION-SCREEN. CASE sscrfields. WHEN 'BUT1'. MESSAGE 'Button 1 was clicked' TYPE 'I'. WHEN 'BUT2'. MESSAGE 'Button 2 was clicked' TYPE 'I'. ENDCASE. *--------------------------------------------------------------* *Initialization *--------------------------------------------------------------*
CALL FUNCTION 'ICON_CREATE' EXPORTING name text info IMPORTING RESULT = button1 EXCEPTIONS OTHERS = 0. = icon_okay = 'Continue' = 'Click to Continue'
CALL FUNCTION 'ICON_CREATE' EXPORTING name text info IMPORTING RESULT = button2 EXCEPTIONS OTHERS = 0.
Selection Screen Output
There is no standard way to find a LSMW for a SAP tcode. But we can achieve this by writing a small program.
First check if the tcode is used in any recording. Check if the recordings found are assigned to any objects Program
*----------------------------------------------------------------------* CONSTANTS: con_user_comm TYPE slis_formname VALUE 'USER_COMMAND', con_ucomm TYPE sy-ucomm VALUE '&IC1'.
DATA: gt_tcode
DATA: gt_object TYPE TABLE OF /sapdmc/lsorec, wa_object TYPE /sapdmc/lsorec. DATA: g_title g_layout TYPE lvc_title, TYPE slis_layout_alv.
*----------------------------------------------------------------------* START-OF-SELECTION.
g_repid = sy-repid. *Check if the tcode is used in any recording SELECT * FROM /sapdmc/lsgbdca INTO TABLE gt_tcode WHERE recordingtcode = p_tcode. IF sy-subrc = 0. *Check if the recordings found are assigned to any objects SELECT * FROM /sapdmc/lsorec
INTO TABLE gt_object FOR ALL ENTRIES IN gt_tcode WHERE recording = gt_tcode-recording. ENDIF.
*Build Field Catalog PERFORM build_fld_catalog USING: 'PROJECT' 'SUBPROJ' 'OBJECT' 'GT_OBJECT' 'Project'(001), 'GT_OBJECT' 'Sub Project'(002), 'GT_OBJECT' 'Object'(003),
*Display table values in ALV CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = g_repid
i_callback_user_command = con_user_comm i_grid_title is_layout it_fieldcat TABLES t_outtab EXCEPTIONS program_error OTHERS IF sy-subrc <> 0. = 1 = 2. = gt_object = g_title = g_layout = it_fieldcat
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF.
ENDFORM.
" display_data
*&---------------------------------------------------------------------* FORM build_fld_catalog USING value(p_fieldname) value(p_tabname) value(p_description). CLEAR wa_fieldcat. wa_fieldcat-fieldname = p_fieldname. wa_fieldcat-tabname = p_tabname.
ENDFORM.
" build_fld_catalog
*&---------------------------------------------------------------------*
TYPE sy-ucomm
rs_selfield TYPE slis_selfield. IF r_ucomm EQ con_ucomm. READ TABLE gt_object INTO wa_object INDEX rs_selfield-tabindex. IF sy-subrc = 0. * Start LSMW CALL FUNCTION '/SAPDMC/LSM_OBJ_STARTER' EXPORTING project subproj object EXCEPTIONS no_such_object = 1 OTHERS IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. = 2. = wa_object-project = wa_object-subproj = wa_object-object
ENDIF. ENDIF.
ENDFORM.
Output
"User_command
Enter the tcode for which you want to find the LSMW.
The output will display all the LSMW project details for the given tcode. Double click on any line will take you to the LSMW project overview screen.
See step 3(Fields from flat file) and 5(All fields updating in current LSMW) to check whether the existing LSMW satisfy your requirement.
Function modules can be copied in function builder(SE37). But if you want to copy an entire function group along with all the function modules follow the steps given below. First go to Object Navigator(SE80).
Select Function Group in the drop down box and enter the name of the Function Group that we want to copy and press enter.
Once the enter is pressed, the function group will be displayed in the bottom window. Now right click on the function group name and select copy.
Enter the name for the new function group and press copy.
This will create the new function group, now we can copy all the function modules one by one. Just press continue.
This will display all theFunction Modules that is there in the original function group. Here we copy all the function modules or we can deselect the function modules that we dont want. Press copy.
A popup will be displayed for the first function module, enter the name for the new function module and press copy. This will copy the first function module and again a popup will be displayed for the next function module. Follow the same procedure for all the remaining function modules.
This code shows how to check all/uncheck all checkboxes in one go on the selection screen instead of checking the checkboxes individually.If the user checks the Select All checkbox then all other checkboxes will be checked, similarly if the user unchecks the Select All checkbox then all other checkboxes will be unchecked.
*-------------------------------------------------------------
* Constants
*-------------------------------------------------------------
*-------------------------------------------------------------
* Selection Screen
*-------------------------------------------------------------
SELECTION-SCREEN: SKIP.
SELECTION-SCREEN: SKIP.
cb_b AS CHECKBOX,
cb_c AS CHECKBOX,
cb_d AS CHECKBOX,
cb_e AS CHECKBOX.
*-------------------------------------------------------------
*-------------------------------------------------------------
AT SELECTION-SCREEN.
IF sy-ucomm = 'UC'.
IF cb_all = 'X'.
ELSE.
ENDIF.
ENDIF.
*-------------------------------------------------------------
* Initialization
*-------------------------------------------------------------
INITIALIZATION.
v_name = c_title.
Selection Screen
Try check/uncheck the Select All checkbox observing the status of other checkboxes. Maintain Selection Texts to get the proper descriptions for the checkboxes on the selection screen.
Dropdown list is a user interface element which displays a list of values from which a user can select one value. Follow the below steps to create a dropdown list in SAP ABAP selection screen.
First build the list in the INITIALIZATION event. Capture the value selected by the user from the list in the AT SELECTION-SCREEN event. Use the selected value for further processing.
TYPE-POOLS: vrm.
DATA: gv_selected_value(10) TYPE c. *--------------------------------------------------------------* *Selection-Screen *--------------------------------------------------------------* PARAMETERS: list TYPE c AS LISTBOX VISIBLE LENGTH 20. *--------------------------------------------------------------* *At Selection Screen *--------------------------------------------------------------* AT SELECTION-SCREEN ON list. CLEAR: gwa_values, gt_values. REFRESH gt_values. gwa_values-fieldname = 'LIST'. APPEND gwa_values TO gt_values. CALL FUNCTION 'DYNP_VALUES_READ'
READ TABLE gt_values INDEX 1 INTO gwa_values. IF sy-subrc = 0 AND gwa_values-fieldvalue IS NOT INITIAL. READ TABLE gt_list INTO gwa_list WITH KEY key = gwa_values-fieldvalue. IF sy-subrc = 0. gv_selected_value = gwa_list-text. ENDIF. ENDIF. *--------------------------------------------------------------* *Initialization *--------------------------------------------------------------* INITIALIZATION. gwa_list-key = '1'. gwa_list-text = 'Product'. APPEND gwa_list TO gt_list. gwa_list-key = '2'. gwa_list-text = 'Collection'. APPEND gwa_list TO gt_list. gwa_list-key = '3'. gwa_list-text = 'Color'. APPEND gwa_list TO gt_list. gwa_list-key = '4'. gwa_list-text = 'Count'. APPEND gwa_list TO gt_list.
There is no password field type in ABAP. But it is very easy to create a password like field in ABAP selection screen using the invisible field of the screen table. Refer to the below code to create a password like field on selection screen
*----------------------------------------------------------------------* *Selection-Screen *----------------------------------------------------------------------* PARAMETERS: p_name TYPE char10. PARAMETERS: p_pass TYPE char10.
*----------------------------------------------------------------------* *At Selection Screen Output *----------------------------------------------------------------------* AT SELECTION-SCREEN OUTPUT. LOOP AT SCREEN. IF screen-name = 'P_PASS'. screen-invisible = 1. MODIFY SCREEN. ENDIF. ENDLOOP.
*----------------------------------------------------------------------* *Start of Selection *----------------------------------------------------------------------* START-OF-SELECTION. WRITE:/ 'Name', ' : ', p_name. WRITE:/ 'Pass', ' : ', p_pass.
Selection Screen
31.
First upload the logo into SAP system to display it on the SAP ABAP selection screen. Split the selection screen using docking container and use the HTML Viewer to display the logo.
TYPE-POOLS cndp. *&---------------------------------------------------------------------* *& Data Declaration. *&---------------------------------------------------------------------* DATA: docking TYPE REF TO cl_gui_docking_container,
DATA url
TYPE cndp_url.
PERFORM build_htmlviewer.
EXCEPTIONS OTHERS = 1.
* Load the picture. IF sy-subrc = 0. CALL METHOD picture->load_picture_from_url_async EXPORTING url = url. ENDIF. *&---------------------------------------------------------------------* *& Form build_htmlviewer
IF docking IS INITIAL.
CREATE OBJECT docking EXPORTING REPID DYNNR SIDE EXTENSION EXCEPTIONS CNTL_ERROR CNTL_SYSTEM_ERROR CREATE_ERROR LIFETIME_ERROR = 1 = 2 = 3 = 4 = repid = sy-dynnr = cl_gui_docking_container=>dock_at_top = 150
LIFETIME_DYNPRO_DYNPRO_LINK = 5 others = 6.
IF htmlviewer IS INITIAL .
= docking .
We can also split the selection screen vertically and display the logo on right side of the selection screen using the side parameter of the docking container.
CREATE OBJECT docking EXPORTING REPID DYNNR SIDE EXTENSION = repid = sy-dynnr = cl_gui_docking_container=>dock_at_right = 500
LIFETIME_DYNPRO_DYNPRO_LINK = 5 others = 6.
Output
We have a database field to hold year and month together in the format YYYYMM (example 201201). We are creating a report using this field on the selection screen, so we need to provide F4 help for this month field. The following code will provide the F4 help for month.
CALL FUNCTION 'POPUP_TO_SELECT_MONTH' EXPORTING actual_month IMPORTING selected_month EXCEPTIONS factory_calendar_not_found = 1 holiday_calendar_not_found = 2 = p_month = sy-datum(6)
= 3 = 4.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF.
When we press F4 help for the month field, the following popup will be displayed.
Sometimes we want to schedule a report to run daily to update some information in certain tables based on todays or yesterdays date or to mail the output of daily MIS reports. We a need a variant to schedule a report, so following are the steps to create a report variant with dynamic date. First display the selection screen.
Enter variant name and description, select the selection variable checkbox and click on Selection variables in the application toolbar.
Once option D is selected, click on the small black triangle to get the F4 values.
From the list of F4 values select the appropriate value. Here we are creating a variant with yesterdays date, so we select the second option from the list.
To get yesterdays date enter the value -1. Save the variant.
When we try to download the list using the menu System->List-Save, function module "DOWNLOAD" will be called. DOWNLOAD Function module will perform a dynamic authorization check if the program and subroutine names are set.
The program and subroutine names can be set using the function module SET_DOWNLOAD_AUTHORITY which is present in the same function group (GRAP). Program ZZDEMO
WRITE:/ 'Hello'.
In the above program we are setting the program(ZZDEMO_AUTH) and subroutine (CHECK_AUTH) to check the authorization for list download before generating the list output. In program ZZDEMO_AUTH we will implement a subroutine CHECK_AUTH and write the authorization logic inside the subroutine. Program ZZDEMO_AUTH