Advertisement
yaramohamed78

Untitled

Apr 13th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 2.11 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~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~ZZSR_NUMBER r~ZZCOMPANY_CODE r~ZZCOST_CENTER  r~ZZDATE s~ZZDESC rs~ZZDESC r~CREA_USER r~CREA_TIME r~CHNG_USER r~CHNG_TIME
  52.     INTO  TABLE qt_req
  53.     FROM ZFI_DISPOSAL_REQ as r
  54.     INNER JOIN ZFI_LOOKUP as s ON  s~ZZLKUPID = r~ZZSERVICE_TYPE
  55.     INNER JOIN ZFI_LOOKUP as rs ON  rs~ZZLKUPID = r~ZZRQSTTS
  56.     WHERE   (WHERE_STATEMENT).
  57.  
  58. IF  SY-SUBRC <> 0.
  59. MESSAGE ID 'ZINSERTION_ERRORS' TYPE 'I' NUMBER '012'.
  60. ENDIF.
  61.  
  62. ENDFUNCTION.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement