FUNCTION YTEST_PGRP_CREATE
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(EMAIL) TYPE AD_SMTPADR
*" VALUE(CURR_ENTRY) TYPE EKGRP
*" EXPORTING
*" VALUE(STATUS) TYPE STRING
*" VALUE(NEW_ENTRY) TYPE EKGRP
*"----------------------------------------------------------------------
TABLES: T024.
DATA: it_t024 TYPE TABLE OF T024,
wa_t024 TYPE T024,
wa_user TYPE T024,
lv_tmp TYPE EKORG,
lv_count TYPE I value 0,
lv_num TYPE I,
lv_1 TYPE C,
lv_2 TYPE C,
lv_3 TYPE C,
it_proc TYPE TABLE OF ZFI_VIM_APPR_CTR,
wa_proc TYPE ZFI_VIM_APPR_CTR,
lv_adrn TYPE ADR6-ADDRNUMBER,
lv_user TYPE BNAME.
SELECT SINGLE * FROM T024
WHERE SMTP_ADDR EQ EMAIL.
STATUS = SY-SUBRC.
IF SY-SUBRC NE 0.
lv_tmp = CURR_ENTRY.
WHILE lv_tmp > 0.
lv_2 = lv_tmp MOD 10.
lv_tmp = lv_tmp / 10.
IF lv_count EQ 0.
lv_3 = lv_2.
lv_count = lv_count + 1.
ENDIF.
lv_1 = lv_tmp.
ENDWHILE.
IF lv_3 NE '9'.
lv_3 = lv_3 + 1.
ELSE.
lv_3 = 0.
IF lv_2 NE 'Z'.
SEARCH sy-abcde FOR lv_2.
lv_num = sy-fdpos + 1.
lv_2 = sy-abcde + lv_num.
ELSE.
lv_2 = 'A'.
SEARCH sy-abcde FOR lv_1.
lv_num = sy-fdpos + 1.
lv_1 = sy-abcde + lv_num.
ENDIF.
ENDIF.
* lv_tmp = lv_1 * 10 + lv_2.
* lv_tmp = lv_tmp * 10 + lv_3.
CONCATENATE lv_1 lv_2 lv_3 INTO lv_tmp.
wa_t024-EKGRP = lv_tmp.
wa_t024-SMTP_ADDR = EMAIL.
INSERT INTO t024 VALUES wa_t024.
COMMIT WORK AND WAIT.
IF SY-SUBRC EQ 0.
ENDIF.
NEW_ENTRY = lv_tmp.
ENDIF.
ENDFUNCTION.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(EMAIL) TYPE AD_SMTPADR
*" VALUE(CURR_ENTRY) TYPE EKGRP
*" EXPORTING
*" VALUE(STATUS) TYPE STRING
*" VALUE(NEW_ENTRY) TYPE EKGRP
*"----------------------------------------------------------------------
TABLES: T024.
DATA: it_t024 TYPE TABLE OF T024,
wa_t024 TYPE T024,
wa_user TYPE T024,
lv_tmp TYPE EKORG,
lv_count TYPE I value 0,
lv_num TYPE I,
lv_1 TYPE C,
lv_2 TYPE C,
lv_3 TYPE C,
it_proc TYPE TABLE OF ZFI_VIM_APPR_CTR,
wa_proc TYPE ZFI_VIM_APPR_CTR,
lv_adrn TYPE ADR6-ADDRNUMBER,
lv_user TYPE BNAME.
SELECT SINGLE * FROM T024
WHERE SMTP_ADDR EQ EMAIL.
STATUS = SY-SUBRC.
IF SY-SUBRC NE 0.
lv_tmp = CURR_ENTRY.
WHILE lv_tmp > 0.
lv_2 = lv_tmp MOD 10.
lv_tmp = lv_tmp / 10.
IF lv_count EQ 0.
lv_3 = lv_2.
lv_count = lv_count + 1.
ENDIF.
lv_1 = lv_tmp.
ENDWHILE.
IF lv_3 NE '9'.
lv_3 = lv_3 + 1.
ELSE.
lv_3 = 0.
IF lv_2 NE 'Z'.
SEARCH sy-abcde FOR lv_2.
lv_num = sy-fdpos + 1.
lv_2 = sy-abcde + lv_num.
ELSE.
lv_2 = 'A'.
SEARCH sy-abcde FOR lv_1.
lv_num = sy-fdpos + 1.
lv_1 = sy-abcde + lv_num.
ENDIF.
ENDIF.
* lv_tmp = lv_1 * 10 + lv_2.
* lv_tmp = lv_tmp * 10 + lv_3.
CONCATENATE lv_1 lv_2 lv_3 INTO lv_tmp.
wa_t024-EKGRP = lv_tmp.
wa_t024-SMTP_ADDR = EMAIL.
INSERT INTO t024 VALUES wa_t024.
COMMIT WORK AND WAIT.
IF SY-SUBRC EQ 0.
ENDIF.
NEW_ENTRY = lv_tmp.
ENDIF.
ENDFUNCTION.
No comments:
Post a Comment