Add Icon in Selection Screen of Dialog Programming
To add icon in the selection screen with parameters:
In the selection text of the parameter or select-option write @01@
Or select option:
You can use 01, 02, 03 and so on for different different icons.
Change the Name of Parameter at Run Time
Here's the cool trick to change the parameter at run time:
on particular time or click the label of parameter will change...
SELECTION-SCREEN BEGIN OF BLOCK b1.
PARAMETERS : rd1 RADIOBUTTON GROUP g1 USER-COMMAND abc DEFAULT 'X',
rd2 RADIOBUTTON GROUP g1 .
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: COMMENT 1(50) TEXT_003. * (text_003 will holds the name)
PARAMETERS p_matnr TYPE matnr .
SELECTION-SCREEN: END OF LINE.
SELECTION-SCREEN END OF block b1.
*To change the name on click of radio button
AT SELECTION-SCREEN OUTPUT:
IF rd1 = 'X'.
text_003 = 'Matnr'.
ELSEIF rd2 = 'X'.
text_003 = 'Material Number'.
endif.
Alternate of Describe
We can count the line of the internal table without using DESCRIBE statement
count = lines( itab)
Select Data Dynamically
Here's the trick to create select query fully dynamically
SELECT (<fs_fields>)
FROM (<fs_tabname>)
APPENDING TABLE <fs_itab>
WHERE (wa_tab) .
[every variable should be of character type]
Simplest Way to Display ALV
Use this code to display easiest and shortest way for ALV:
data: gr_table type ref to cl_salv_table.
call method cl_salv_table=>factory
IMPORTING
R_SALV_TABLE = gr_table
changing
t_table = itab. * internal table having data to display
gr_table->display( ).
Run Blocked T-Code
Tcodes are blocked... not a big issue. Here's two ways to run any tcode:
1. RS_HDSYS_CALL_TC_VARIANT
call by FM: RS_HDSYS_CALL_TC_VARIANT and use the parameter authority check
2. Use this code in report:
DATA: l_tcode TYPE sytcode.
PARAMETERS: p_tcode TYPE sy-tcode.
START-OF-SELECTION.
SELECT SINGLE tcode FROM tstc
INTO l_tcode
WHERE tcode = p_tcode.
IF sy-subrc = 0.
CALL TRANSACTION p_tcode.
ELSE.
MESSAGE 'TCODE not found.' TYPE 'I'.
ENDIF.
Display Pop-up
use 'method th_popup' fm to display the popup
Create Log in the Report
Here is the code to create log display in ABAP:
CREATE OBJECT lc_app_log
EXCEPTIONS
log_header_inconsistent = 1
OTHERS = 2.
*Error messages
LOOP AT i_msg_log INTO wa_msg_log.
lw_msg = wa_msg_log-message.
lw_msgty = wa_msg_log-msgtyp.
CALL METHOD lc_app_log->add_msg_free_text
EXPORTING
im_msg = lw_msg
im_msgty = lw_msgty
EXCEPTIONS
msg_error = 1
OTHERS = 2.
IF NOT sy-subrc IS INITIAL.
RETURN.
ENDIF.
CLEAR wa_msg_log.
ENDLOOP.
lc_app_log->display_log( ).
Find Report with the String
We can find the report by just entering the string written in any program by using report 'RS_ABAP_SOURCE_SCAN'
Copy Any Line Without Pressing ctrl+c or ctrl+v
use ctrl+d to make a exact copy of any line