Programming

BOTTOM ... ENDBOTTOM Command in SAPscript

You can print text at the bottom of main window on each page by applying this command.

Syntax

/: BOTTOM
   ...
   ...
/: ENDBOTTOM

Example

SAPscript
img19

Output
img18

Time Mask Template in command SET TIME MASK for SAPscript

Syntax

/: SET TIME MASK = ’template’
Template    Description
HH Hour 2 digits
MM Minute 2 digits
SS Second 2 digits

Example

SAPscript
img17

Output
img16

Date Mask Template in command SET DATE MASK for SAPscript

Syntax

/: SET DATE MASK = ’template’
Template    Description
DD Day 2 digits
DDD Short name of day
DDDD Long name of day
MM Month 2 digits
MMM Short name of month
MMMM Long name of month
YY Year 2 digits
YYYY Year 4 digits

Example

SAPscript
img14

How to initial value of SELECT-OPTIONS in ABAP/4

We can initial value of SELECT-OPTIONS in event INITIALIZATION.

Example

TABLES: sflight.
SELECT-OPTIONS: s_carrid FOR sflight-carrid.
INITIALIZATION.
  s_carrid-sign = ’I’.
  s_carrid-option = ’EQ’.
  s_carrid-low = ’AA’.
  APPEND s_carrid.
  s_carrid-low = ’AB’.
  APPEND s_carrid.
  s_carrid-low = ’AC’.
  APPEND s_carrid.

The output is:

 img12

Loop ... Assigning & Loop ... Into in ABAP/4

Loop ... Into

LOOP AT itab INTO wa_tab.
  ...
  ...
...
wa_tab-fld1 = ’X’.
MODIFY itab FROM wa_tab.

ENDLOOP.

Loop ... Assigning


LOOP AT itab ASSIGNING .
  ...
  ...
...
-fld1 = ’X’.


ENDLOOP.
Loop ... Assigning is faster than Loop ... Into because when you modify field-symbol, system automatically update data in internal table. 

ABAP/4 Example Code: Download ABAP Spool to PDF

*** This program receive spool id and destination file name ***
DATA: it_pdf TYPE TABLE OF TLINE WITH HEADER LINE,
      gv_string TYPE string.


PARAMETERS: p_spool LIKE TSP01-RQIDENT,
            p_file LIKE RLGRAP-FILENAME.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CALL FUNCTION ’KD_GET_FILENAME_ON_F4’
    EXPORTING
*     PROGRAM_NAME        = SYST-REPID
*   &nb