Advertisement
yaramohamed78

Untitled

Mar 20th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. FUNCTION Z_REQ_FN_INQUIRY.
  2. *"----------------------------------------------------------------------
  3. *"*"Local Interface:
  4. *" IMPORTING
  5. *" REFERENCE(WA_REQ) TYPE ZFI_DISPOSAL_REQ
  6. *" REFERENCE(WA_REQ_STATUS) TYPE ZFI_LOOKUP
  7. *" REFERENCE(WA_SERVICE) TYPE ZFI_LOOKUP
  8. *" TABLES
  9. *" QT_REQ
  10. *"----------------------------------------------------------------------
  11. DATA : where_statement TYPE STRING,
  12. STR2 TYPE STRING,
  13. ERRORS TYPE INT1 VALUE 0.
  14.  
  15.  
  16.  
  17.  
  18.  
  19. WHERE_STATEMENT = 'r~ZZCOMPANY_CODE = wa_req-ZZCOMPANY_CODE'.
  20.  
  21. IF NOT wa_req-ZZCOST_CENTER IS INITIAL.
  22. STR2 = 'AND r~ZZCOST_CENTER = wa_req-ZZCOST_CENTER'.
  23. CONCATENATE where_statement STR2 INTO where_statement SEPARATED BY ' '.
  24. ENDIF.
  25.  
  26. IF NOT wa_req-ZZSR_NUMBER IS INITIAL.
  27. STR2 = 'AND r~ZZCOT_CENTER = wa_req-ZZSR_NUMBER'.
  28. CONCATENATE where_statement STR2 INTO where_statement SEPARATED BY ' '.
  29. ENDIF.
  30.  
  31. IF NOT wa_req-ZZDATE IS INITIAL.
  32. STR2 = 'AND r~ZZDATE = wa_req-ZZDATE'.
  33. CONCATENATE where_statement STR2 INTO where_statement SEPARATED BY ' '.
  34. ENDIF.
  35.  
  36. IF NOT wa_req_status-ZZCODE IS INITIAL.
  37. STR2 = 'AND rs~ZZCODE = wa_req_status-ZZCODE'.
  38. CONCATENATE where_statement STR2 INTO where_statement SEPARATED BY ' '.
  39. ENDIF.
  40.  
  41. IF NOT wa_service-ZZCODE IS INITIAL.
  42. STR2 = 'AND s~ZZCODE = wa_service-ZZCODE'.
  43. CONCATENATE where_statement STR2 INTO where_statement SEPARATED BY ' '.
  44. ENDIF.
  45.  
  46. *Select statement
  47.  
  48. 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
  49. INTO TABLE qt_req
  50. FROM ZFI_DISPOSAL_REQ as r
  51. LEFT JOIN ZFI_LOOKUP as s ON s~ZZLKUPID = r~ZZSERVICE_TYPE
  52. LEFT JOIN ZFI_LOOKUP as rs ON rs~ZZLKUPID = r~ZZRQSTTS
  53. WHERE (WHERE_STATEMENT).
  54.  
  55.  
  56.  
  57. ENDFUNCTION.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement