ABAP/4

Select...Where & Select...Check in ABAP/4

Select...Where


SELECT * FORM SPFLI
WHERE CARRID = ’LH’.
...
...
...
ENDSELECT.

Select...Check

SELECT * FORM SPFLI.
CHECK SPFLI-CARRID = ’LH’.
...
...
...
ENDSELECT.
In above logic, Select...Where is better than Select...Check because the database can then user an index and system resource load is considerably less.

SELECT...INTO TABLE & SELECT...APPEND in ABAP/4

Select...Into Table


DATA: itab LIKE SPFLI OCCURS 0 WITH HEADER LINE.
SELECT * FORM SPFLI INTO TABLE itab.

Select...Append

DATA: itab LIKE SPFLI OCCURS 0 WITH HEADER LINE.
SELECT * FORM SPFLI INTO itab.
APPEND itab.
ENDSELECT.
In above logic, Select...Into Table is faster than Select...Append.

How to call SMARTFORMS from ABAP/4

When you create the form by SMARTFORMS, system will automatically create the function module for called by ABAP/4. You can get this function module by apply function module "SSF_FUNCTION_MODULE_NAME" and send the form name. This function will return the function name for call SMARTFORMS that you created.

Example


DATA: smf_name TYPE TDSFNAME VALUE ’ZSMARTFORM01’,
fn_name TYPE RS38L_FNAM.
CALL FUNCTION ’SSF_FUNCTION_MODULE_NAME’
EXPORTING
FORMNAME = smf_name
IMPORTING
FM_NAME = fn_name.

How to Popup Confirm Message in ABAP/4

When you want to popup message to confirm action, you can apply function module "POPUP_TO_CONFIRM_WITH_MESSAGE". The function will return:

  • ’A’ - Yes
  • Others - No or Cancel

Example


CALL FUNCTION ’POPUP_TO_CONFIRM_WITH_MESSAGE’
EXPORTING
DIAGNOSETTEXT1 = ’Do you want save data?’
TEXTLINE1 = ’ ’
TITEL = ’Confirm message!’
IMPORTING
ANSWER = lv_answer.

Formatting Selection Screens in ABAP/4: Blank Lines, Underlines and Comments

  • Blank Lines

Example

SELECTION-SCREEN SKIP 3.
  • Underlines

Example

SELECTION-SCREEN ULINE.
SELECTION-SCREEN ULINE /1(20).
  • Comments

Example

Loop...Where & Loop...Check in ABAP/4

Loop...Where


LOOP AT itab where key = pa1.
...
...
...
ENDLOOP.

Loop...Check

LOOP AT itab.
CHECK itab-key = pa1.
...
...
...
ENDLOOP.
In above logic, Loop...Where is better than Loop...Check because Loop...Where verifys the specified condition internally.