Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FUNCTION Z_REQ_FN_INQUIRY.
- *"----------------------------------------------------------------------
- *"*"Local Interface:
- *" IMPORTING
- *" REFERENCE(WA_REQ) TYPE ZFI_DISPOSAL_REQ
- *" REFERENCE(WA_REQ_STATUS) TYPE ZFI_LOOKUP
- *" REFERENCE(WA_SERVICE) TYPE ZFI_LOOKUP
- *" TABLES
- *" QT_REQ STRUCTURE ZFI_DISP_REQ_STRUCT
- *"----------------------------------------------------------------------
- DATA : where_statement TYPE STRING,
- STR2 TYPE STRING,
- ERRORS TYPE INT1 VALUE 0.
- WHERE_STATEMENT = 'r~ZZCOMPANY_CODE = wa_req-ZZCOMPANY_CODE'.
- IF NOT wa_req-ZZCOST_CENTER IS INITIAL.
- STR2 = 'AND r~ZZCOST_CENTER = wa_req-ZZCOST_CENTER'.
- CONCATENATE where_statement STR2 INTO where_statement SEPARATED BY ' '.
- ENDIF.
- IF NOT wa_req-ZZSR_NUMBER IS INITIAL.
- STR2 = 'AND r~ZZSR_NUMBER = wa_req-ZZSR_NUMBER'.
- CONCATENATE where_statement STR2 INTO where_statement SEPARATED BY ' '.
- ENDIF.
- IF NOT wa_req-ZZDATE IS INITIAL.
- STR2 = 'AND r~ZZDATE = wa_req-ZZDATE'.
- CONCATENATE where_statement STR2 INTO where_statement SEPARATED BY ' '.
- ENDIF.
- IF NOT wa_req_status-ZZCODE IS INITIAL.
- * MESSAGE ID 'ZALV_ERRORS' TYPE 'I' NUMBER '000' WITH wa_req_status-ZZCODE.
- STR2 = 'AND rs~ZZCODE = wa_req_status-ZZCODE'.
- CONCATENATE where_statement STR2 INTO where_statement SEPARATED BY ' '.
- ENDIF.
- IF NOT wa_service-ZZCODE IS INITIAL.
- * MESSAGE ID 'ZALV_ERRORS' TYPE 'I' NUMBER '000' WITH wa_service-ZZCODE.
- STR2 = 'AND s~ZZCODE = wa_service-ZZCODE'.
- CONCATENATE where_statement STR2 INTO where_statement SEPARATED BY ' '.
- ENDIF.
- *MESSAGE ID 'ZALV_ERRORS' TYPE 'I' NUMBER '000' WITH where_statement.
- *Select statement
- * WRITE : / WHERE_STATEMENT.
- SELECT r~ZZID r~ZZCOMPANY_CODE r~ZZCOST_CENTER r~ZZDATE r~ZZSR_NUMBER s~ZZCODE AS ZZSERVICE_TYPE rs~ZZCODE AS ZZRQSTTS s~ZZDESC AS ZZSERVICE_DESC rs~ZZDESC AS ZZSTATUS_DESC r~CREA_USER r~CREA_TIME r~CHNG_USER
- r~CHNG_TIME
- INTO TABLE qt_req
- FROM ZFI_DISPOSAL_REQ as r
- INNER JOIN ZFI_LOOKUP as s ON s~ZZLKUPID = r~ZZSERVICE_TYPE
- INNER JOIN ZFI_LOOKUP as rs ON rs~ZZLKUPID = r~ZZRQSTTS
- WHERE (WHERE_STATEMENT).
- IF SY-SUBRC <> 0.
- MESSAGE ID 'ZINSERTION_ERRORS' TYPE 'I' NUMBER '012'.
- ENDIF.
- ENDFUNCTION.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement