Advertisement
yaramohamed78

ZASG_SAL_INSERT

Jan 18th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 1.80 KB | None | 0 0
  1. *&---------------------------------------------------------------------*
  2. *& Report  ZASG_SAL_INSERT
  3. *&
  4. *&---------------------------------------------------------------------*
  5. *&
  6. *&
  7. *&---------------------------------------------------------------------*
  8.  
  9. REPORT ZASG_SAL_INSERT.
  10. TABLES: ZASG_SAL , ZASG_EMP , TCURC.
  11. DATA: l_subrc TYPE SY-SUBRC,
  12.       wa_emp TYPE ZASG_SAL,
  13.       it_emp type TABLE OF ZASG_EMP,
  14.       wa_emp_copy TYPE ZASG_SAL,
  15.       it_sal type TABLE OF TCURC.
  16.  
  17.  
  18. SELECTION-SCREEN BEGIN OF BLOCK SELECTION WITH FRAME TITLE text-001.
  19. *SELECTION-SCREEN SKIP.
  20. *SELECTION-SCREEN BEGIN OF LINE.
  21. PARAMETERS :     EMP_ID LIKE ZASG_SAL-empid OBLIGATORY.
  22. *SELECTION-SCREEN END OF LINE.
  23.  
  24. *SELECTION-SCREEN BEGIN OF LINE.
  25. PARAMETERS :     EMP_CUR LIKE ZASG_SAL-currency OBLIGATORY.
  26. *SELECTION-SCREEN END OF LINE.
  27.  
  28. *SELECTION-SCREEN BEGIN OF LINE.
  29. PARAMETERS :     EMP_AMNT LIKE ZASG_SAL-amount OBLIGATORY.
  30. *SELECTION-SCREEN END OF LINE.
  31. SELECTION-SCREEN END OF BLOCK SELECTION.
  32.  
  33. wa_emp-empid = EMP_ID.
  34. wa_emp-currency = EMP_CUR.
  35. wa_emp-amount = EMP_AMNT.
  36.  
  37. *ID VALIDATION.
  38.  
  39. SELECT * FROM ZASG_EMP
  40.   INTO CORRESPONDING FIELDS OF TABLE it_emp
  41.   WHERE id = wa_emp-empid .
  42.  
  43.   IF  it_emp[] IS INITIAL.
  44.     MESSAGE ID 'ZINSERTION_ERRORS' TYPE 'I' NUMBER '007'.
  45. ELSE.
  46.  
  47.  
  48.  SELECT * FROM TCURC
  49.    INTO CORRESPONDING FIELDS OF TABLE it_sal
  50.     WHERE waers = wa_emp-currency.
  51.  
  52.     IF it_sal[] IS INITIAL.
  53.       MESSAGE ID 'ZINSERTION_ERRORS' TYPE 'I' NUMBER '008'.
  54.   ELSE.
  55.  
  56.  
  57. CALL FUNCTION 'Z_ASG_FN_INSERTSAL'
  58.   EXPORTING
  59.     WA_EMP        = wa_emp
  60.  IMPORTING
  61.    E_SUBRC       =  l_subrc.
  62. if l_subrc = 1.
  63.   MESSAGE ID 'ZINSERTION_ERRORS' TYPE 'I' NUMBER '006'.
  64.  ELSEIF l_subrc = 0.
  65.    MESSAGE ID 'ZINSERTION_ERRORS' TYPE 'I' NUMBER '003'.
  66.    EXIT.
  67.  ENDIF.
  68. ENDIF.
  69. ENDIF.
  70. INITIALIZATION.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement