Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *&---------------------------------------------------------------------*
- *& Report Z_SELECTOPTION_TEST
- *&
- *&---------------------------------------------------------------------*
- *&
- *&
- *&---------------------------------------------------------------------*
- REPORT Z_SELECTOPTION_TEST.
- *Tables Used
- TABLES: ZASG_SAL , ZASG_EMP .
- *Data Variables.
- DATA: l_subrc TYPE SY-SUBRC,
- wa_emp TYPE ZASG_EMP,
- S_empid TYPE TABLE OF SELOPT WITH HEADER LINE,
- where_statement TYPE STRING,
- STR2 TYPE STRING,
- emp_name LIKE ZASG_EMP-name,
- emp_amount LIKE ZASG_SAL-amount,
- emp_currency LIKE ZASG_SAL-currency,
- counter TYPE INT1 VALUE 0,
- errors TYPE INT1 VALUE 0.
- *Selection Screen (ID)
- SELECTION-SCREEN BEGIN OF BLOCK SELECTION WITH FRAME TITLE text-001.
- SELECT-OPTIONS EMP_ID FOR ZASG_EMP-id .
- SELECTION-SCREEN END OF BLOCK SELECTION.
- S_empid-SIGN = EMP_ID-SIGN.
- S_empid-OPTION = EMP_ID-OPTION.
- S_empid-LOW = EMP_ID-LOW.
- S_empid-HIGH = EMP_ID-HIGH.
- CALL FUNCTION 'Z_ASG_FN_SEARCH_TEST'
- TABLES
- Z_EMPID = S_empid
- Z_TEST = EMP_ID[].
- INITIALIZATION.
- *
- **Loop through all entered values for employee id.
- *loop at EMP_ID.
- * counter = counter + 1.
- * IF EMP_ID-OPTION = 'EQ'.
- * where_statement = 'e~id = EMP_ID-LOW'.
- * CONCATENATE where_statement STR2 INTO where_statement.
- * ELSEIF EMP_ID-OPTION = 'NE'.
- * CONCATENATE where_statement STR2 INTO where_statement.
- * STR2 = 'e~id <> EMP_ID-LOW'.
- * ELSEIF EMP_ID-OPTION = 'GT'.
- * STR2 = 'e~id > EMP_ID-LOW'.
- * CONCATENATE where_statement STR2 INTO where_statement.
- * ELSEIF EMP_ID-OPTION = 'LT'.
- * STR2 = 'e~id < EMP_ID-LOW'.
- * CONCATENATE where_statement STR2 INTO where_statement.
- * ELSEIF EMP_ID-OPTION = 'GE'.
- * STR2 = 'e~id >= EMP_ID-LOW'.
- * CONCATENATE where_statement STR2 INTO where_statement.
- * ELSEIF EMP_ID-OPTION = 'LE'.
- * STR2 = 'e~id <= EMP_ID-LOW'.
- * CONCATENATE where_statement STR2 INTO where_statement.
- * ELSEIF EMP_ID-OPTION = 'BT'.
- * STR2 = 'e~id BETWEEN EMP_ID-LOW AND EMP_ID-HIGH'.
- * CONCATENATE where_statement STR2 INTO where_statement.
- * ENDIF.
- * SELECT e~name s~amount s~currency
- * INTO (emp_name,emp_amount,emp_currency)
- * FROM (
- * ZASG_EMP AS e
- * INNER JOIN ZASG_SAL AS s ON e~id = s~empid
- * )
- * WHERE (where_statement).
- * WRITE : / emp_name , emp_amount , emp_currency.
- * ENDSELECT.
- ** If no id is found.
- * IF SY-SUBRC <> 0.
- * errors = errors + 1.
- * ENDIF.
- *
- *
- *endloop.
- *
- *if errors = counter.
- *MESSAGE ID 'ZINSERTION_ERRORS' TYPE 'I' NUMBER '007'.
- *ENDIF.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement