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
- *"----------------------------------------------------------------------
- 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~ZZCOT_CENTER = 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.
- 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.
- STR2 = 'AND s~ZZCODE = wa_service-ZZCODE'.
- CONCATENATE where_statement STR2 INTO where_statement SEPARATED BY ' '.
- ENDIF.
- *Select statement
- SELECT r~ZZCOMPANY_CODE r~ZZCOST_CENTER r~ZZSR_NUMBER r~ZZDATE r~ZZSERVICE_TYPE r~ZZRQSTTS r~CREA_USER r~CREA_TIME r~CHNG_USER r~CHNG_TIME s~ZZDESC rs~ZZDESC
- INTO TABLE qt_req
- FROM ZFI_DISPOSAL_REQ as r
- LEFT JOIN ZFI_LOOKUP as s ON s~ZZLKUPID = r~ZZSERVICE_TYPE
- LEFT JOIN ZFI_LOOKUP as rs ON rs~ZZLKUPID = r~ZZRQSTTS
- WHERE (WHERE_STATEMENT).
- ENDFUNCTION.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement