ABAP/4

How to apply function module 'DATE_COMPUTE_DAY' in ABAP/4

The function module "DATE_COMPUTE_DAY" will return the day by 1...7 when you input date. If the date have day:

  • Monday : System will return value = 1
  • Tuesday : System will return value = 2
  • Wednesday : System will return value = 3
  • Thursday : System will return value = 4
  • Friday : System will return value = 5
  • Saturday : System will return value = 6
  • Sunday : System will return value = 7

Example


   CALL FUNCTION ’DATE_COMPUTE_DAY’
     EXPORTING
       date         = l_date1
     IMPORTING
       DAY          = l_day. "Return Value

How to upload PC file to internal table in ABAP/4

When you want to upload PC file to internal table in ABAP/4, you can apply function module "WS_UPLOAD".

Example


call function ’WS_UPLOAD’
      exporting
           filename               = lv_name
           filetype               = lv_type
      tables
           data_tab               = li_tab
      exceptions
           file_open_error        = 1
           file_read_error        = 2
           no_batch               = 3
           gui_refuse_filetransfer = 4
           others                 = 5.

How to download internal table to PC file in ABAP/4

When you want to download internal table to PC file in ABAP/4, you can apply function module "WS_DOWNLOAD".

Example


CALL FUNCTION ’WS_DOWNLOAD’
      EXPORTING
           FILENAME               = LV_TEXT "PC File Name and Location
           FILETYPE               = ’DAT’
      TABLES
           DATA_TAB               = I_MESG "Internal Table
      EXCEPTIONS
           FILE_OPEN_ERROR        = 1
           FILE_WRITE_ERROR       = 2
           INVALID_FILESIZE       = 3
           INVALID_TYPE           = 4
           NO_BATCH               = 5
           UNKNOWN_ERROR          = 6
           INVALID_TABLE_WIDTH    = 7
           GUI_REFUSE_FILETRANSFER = 8
           CUSTOMER_ERROR         = 9
           OTHERS                 = 10.

How to get name of day by Date in ABAP/4

When you want to get name of day by using date in ABAP/4, you can apply function module "DATE_TO_DAY".

Example


*&---------------------------------------------------------------------*
*&     Form get_name_of_day
*&---------------------------------------------------------------------*
FORM get_name_of_day USING   PAR_DATUM
                    CHANGING PAR_DAY_NAME.
clear par_day_name.
CALL FUNCTION ’DATE_TO_DAY’
   EXPORTING
     DATE         = par_datum
   IMPORTING
     WEEKDAY      = par_day_name
           .

How to get long text in ABAP/4

When you want to retrieve the data that record in long text on selected document for show in ABAP report, you can apply function module "READ_TEXT".

Example


DATA: I_LINE  LIKE TLINE OCCURS 0 WITH HEADER LINE.
     CALL FUNCTION ’READ_TEXT’
          EXPORTING
               ID                   = ’Z002’
               LANGUAGE             = SY-LANGU
               NAME                 = LV_NAME
               OBJECT               = ’VBBK’
          TABLES
               LINES                = I_LINE "Long text
          EXCEPTIONS
               ID                   = 1
               LANGUAGE             = 2
               NAME                 = 3
               NOT_FOUND            = 4
               OBJECT               = 5
               REFERENCE_CHECK      = 6
               WRONG_ACCESS_TO_ARCHIVE = 7
               OTHERS               = 8.

Standard Tag Column in SAPscript

Format     Description
* Default paragraph
Blank Continuous text

= Extended line
( Raw line
/ Line feed
/= Line feed and extended line
/( Line feed and raw line
/: Command line
/* Comment line
/E Text element