SAP R/3

Create PC Directory in ABAP/4

Example:  We will create directory ’Temp’ on drive C:

CALL FUNCTION ’GUI_CREATE_DIRECTORY’      
EXPORTING         
DIRNAME            = ’C:\Temp’     
EXCEPTIONS         
FAILED              = 1         
OTHERS              = 2
              . 
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. 
ENDIF.

How to Get Name of Months in ABAP/4

You can get name of months by select table ’T247’

DATA: it_month_name TYPE TABLE OF t247 WITH HEADER LINE.

SELECT * INTO TABLE it_month_name FROM T247
WHERE spras = sy-langu.

or using function module ’MONTH_NAMES_GET’

DATA: it_month_name TYPE TABLE OF t247 WITH HEADER LINE.
CALL FUNCTION ’MONTH_NAMES_GET’
EXPORTING
LANGUAGE = SY-LANGU
* IMPORTING
* RETURN_CODE =
TABLES
MONTH_NAMES = it_month_name
EXCEPTIONS
MONTH_NAMES_NOT_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Related Function Module in SAPscript

Fn Name           Description
START_FORM Start Layout Set
OPEN_FORM Open Layout Set
WRITE_FORM Write data by specified text element in window
WRITE_FORM_LINES Write data in TLINE structure to window
CLOSE_FORM Close Layout Set
END_FORM End Layout Set
CONTROL_FORM Create SAPscript Control Statement

See Example

Technorati Tags:

AT Statement in a Loop of ABAP/4


Statement           Description
AT FIRST ... END AT The statement in this block will be executed
if that record is a first record of internal table.
AT LAST ... END AT The statement in this block will be executed
if that record is a last record of internal table.

AT NEW ... END AT The statement is this block will be executed
if the record contains value of the beginning group.

Select ... Into Table & Select ... Appending Table in ABAP/4

Select ... Into Table


SELECT * FROM TABLE1 INTO TABLE itab1
WHERE fld1 = ’AA’.

Select ... Appending Table


SELECT * FROM TABLE1 APPENDING TABLE itab1
WHERE fld1 = ’AA’. 

Two statements are similar if itab1 has no entry.

But if itab1 has at least one row before select clause:

  • Select ... Into Table
    The entries of internal table will be cleared before adding new records.

Options of NEW-PAGE statement in ABAP/4

Option            Description
NO-TITLE New page without title
WITH-TITLE New page with title
NO-HEADING New page without column heading
WITH-HEADING New page with column heading
LINE-COUNT Specify line count in new page
LINE-SIZE Specify line size in new page
PRINT [ON/OFF] Specify printer control