1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
FORM pt_acct_expire USING iv_msh_guid TYPE loy_frw_guid. DATA: t_pt TYPE STANDARD TABLE OF loyd_pt_acct, txn TYPE loyt_pt_txn, ls_txn LIKE LINE OF txn, lr_txn TYPE REF TO data, lv_success TYPE abap_bool. FIELD-SYMBOLS: <ls_pt> LIKE LINE OF t_pt. SELECT loyd_pt_acct~guid loyd_pt_acct~pt_type loyd_pt_acct~balance FROM loyd_pt_acct INNER JOIN loyd_msh_mems ON loyd_pt_acct~ref_guid = loyd_msh_mems~pa_set_guid INNER JOIN loyd_pt_acct_set ON loyd_pt_acct_set~guid = loyd_msh_mems~pa_set_guid INTO CORRESPONDING FIELDS OF TABLE t_pt WHERE loyd_msh_mems~guid = iv_msh_guid AND pt_type = 'Dram' AND loyd_pt_acct_set~istat = cl_loy_pt_acct_constants=>gc_active AND loyd_pt_acct~balance > 0. CHECK sy-subrc = 0. LOOP AT t_pt ASSIGNING <ls_pt>. ls_txn-application = 'PTAC'. ls_txn-process_mode = cl_loy_frw_obj_constants=>gc_mode_create. ls_txn-pt_type = <ls_pt>-pt_type. ls_txn-ref_guid = <ls_pt>-guid. ls_txn-actual_points = <ls_pt>-balance. ls_txn-txn_type = 'CONS'. ls_txn-txn_reason = 'MERGE'. ls_txn-qual_type = 'NON_QUALIFYING'. ls_txn-membership_guid = iv_msh_guid. APPEND ls_txn TO txn. ENDLOOP. CHECK NOT txn IS INITIAL. GET REFERENCE OF txn INTO lr_txn. DATA appl TYPE REF TO cl_loy_ptac_appl_controller. PERFORM factory_appl CHANGING appl. appl->create_transactions( EXPORTING iv_object_name = cl_loy_pt_acct_constants=>child1 " LOY FRW : Object IMPORTING ev_success = lv_success CHANGING ct_data = lr_txn ). appl->if_loy_frw_appl_controller~create_object_data( EXPORTING iv_object = cl_loy_pt_acct_constants=>child1 " LOY FRW : Object iv_create_key = abap_true IMPORTING ev_success = lv_success CHANGING ct_data = lr_txn ). appl->save_data( ). IF lv_success = 'X'. DATA return TYPE bapiret2. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = '' IMPORTING return = return. ENDIF. ENDFORM. FORM factory_appl CHANGING so_appl TYPE REF TO cl_loy_ptac_appl_controller. DATA: core TYPE REF TO cl_loy_frw_appl_core. IF NOT so_appl IS BOUND. core ?= cl_loy_frw_appl_core=>get_instance( ). IF core IS NOT BOUND. RETURN. ENDIF. TRY. core->load_application( iv_application = cl_loy_pt_acct_constants=>application ). CATCH cx_loy_frw_core_excep. RETURN. ENDTRY. TRY. so_appl ?= core->get_appl_controller( cl_loy_pt_acct_constants=>application ). CATCH cx_loy_frw_core_excep. RETURN. ENDTRY. ENDIF. ENDFORM. |