Advertisement
yaramohamed78

Untitled

Apr 18th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 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 STRUCTURE ZFI_DISP_REQ_STRUCT
  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~ZZSR_NUMBER = 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. * MESSAGE ID 'ZALV_ERRORS' TYPE 'I' NUMBER '000' WITH wa_req_status-ZZCODE.
  38. STR2 = 'AND rs~ZZCODE = wa_req_status-ZZCODE'.
  39. CONCATENATE where_statement STR2 INTO where_statement SEPARATED BY ' '.
  40. ENDIF.
  41.  
  42. IF NOT wa_service-ZZCODE IS INITIAL.
  43. * MESSAGE ID 'ZALV_ERRORS' TYPE 'I' NUMBER '000' WITH wa_service-ZZCODE.
  44. STR2 = 'AND s~ZZCODE = wa_service-ZZCODE'.
  45. CONCATENATE where_statement STR2 INTO where_statement SEPARATED BY ' '.
  46. ENDIF.
  47. *MESSAGE ID 'ZALV_ERRORS' TYPE 'I' NUMBER '000' WITH where_statement.
  48. *Select statement
  49.  
  50. * WRITE : / WHERE_STATEMENT.
  51. 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
  52. r~CHNG_TIME
  53. INTO TABLE qt_req
  54. FROM ZFI_DISPOSAL_REQ as r
  55. INNER JOIN ZFI_LOOKUP as s ON s~ZZLKUPID = r~ZZSERVICE_TYPE
  56. INNER JOIN ZFI_LOOKUP as rs ON rs~ZZLKUPID = r~ZZRQSTTS
  57. WHERE (WHERE_STATEMENT).
  58.  
  59. IF SY-SUBRC <> 0.
  60. MESSAGE ID 'ZINSERTION_ERRORS' TYPE 'I' NUMBER '012'.
  61. ENDIF.
  62.  
  63. ENDFUNCTION.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement