Thursday, 2 May 2013
TRANSPORTING keyword example. To Change a single field/Column in Internal Table without changing remaining columns of same Row
LOOP AT file_structure INTO gw_file_structure.
CLEAR : gv_tabix .
gv_tabix = sy-tabix .
READ TABLE gt_components INTO gw_components INDEX gv_tabix.
gw_file_structure-file_size = gw_components-comp_size.
IF sy-subrc EQ 0.
MODIFY file_structure FROM gw_file_structure
INDEX gv_tabix TRANSPORTING file_size.
ENDIF.
ENDLOOP.
only file_size has to be changed in the internal table, so we are using TRANSPORTING command.
Note : Instead of transporting , always using field symbols as we don't need to maintain the logic for tabix or index and clear the workarea. We can directly change it in the workarea which will reflect in the internal table.
Tuesday, 30 April 2013
Appending One Internal table to another internal table of same structure without replacing the existing data
First internal table is having some data , second internal table is also having some data.
We have to add data from itab2 to itab1 without removing itab1 existing data.
Below is the command to append itab2 to itab1.
APPEND LINES OF itab2 to itab1 .
Note : itab1 and itab2 should be of same structure.
We have to add data from itab2 to itab1 without removing itab1 existing data.
Below is the command to append itab2 to itab1.
APPEND LINES OF itab2 to itab1 .
Note : itab1 and itab2 should be of same structure.
To find Offset of a character in a string
PARAMETERS : name TYPE c LENGTH 26 DEFAULT 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
PARAMETERS : j TYPE c LENGTH 10.
DATA : k TYPE i.
FIND j IN name MATCH OFFSET k.
WRITE : / name, / k.
j is the character we enter to search in the variable name, k holds the offset of value in j with respect to name.
Offset starts from 0 (zero) always.
offset or position of A is 0, B is 1 ....... Z is 25.
Standard Table which holds data of READ_TEXT Function Module is STXH
Standard Table which holds data of READ_TEXT Function Module is STXH
Tuesday, 9 April 2013
Wednesday, 3 April 2013
Difference between SY-TABIX and SY-INDEX
In LOOP and ENDLOOP with respect to internal table and workarea use SY-TABIX as tabix takes the row number of internal table during the current loop process.
SY-Index comes into picture during DO and ENDDO
Index is also used incase of Read table commmand
SY-Index comes into picture during DO and ENDDO
Index is also used incase of Read table commmand
Wednesday, 27 March 2013
Change Button Text Dynamically
LOOP AT SCREEN.
IF screen-name = 'GV_BUTTON' .
gv_button = 'Darling ' .
MODIFY SCREEN.
ENDIF.
ENDLOOP.
gv_button is the button name created in screen.
We have to check the checkbox for output in program tab in buton attributes.
IF screen-name = 'GV_BUTTON' .
gv_button = 'Darling ' .
MODIFY SCREEN.
ENDIF.
ENDLOOP.
gv_button is the button name created in screen.
We have to check the checkbox for output in program tab in buton attributes.
Subscribe to:
Posts (Atom)