Sei sulla pagina 1di 6

REPORT zvendor_validations TABLES: zpincode, zstate_code. DATA: i_lfa1-land1 LIKE kna1_bf-stceg, country_code LIKE t005-intca.

DATA: lt TYPE TABLE OF zpincode, wa_pin TYPE zpincode.

DATA: lt1 TYPE TABLE OF zstate_code, wa_code TYPE zstate_code.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME. PARAMETERS : country LIKE country_code, vat LIKE i_lfa1-land1. SELECTION-SCREEN END OF BLOCK b1. AT SELECTION-SCREEN. IF country EQ 'IN'.

DATA: i_lfa1-land1_fifth TYPE c, i_lfa1-land1_fftn TYPE c, i_lfa1-land1_sixtn TYPE c, i_lfa1-land1_eight TYPE c, i_lfa1-land1_ninth TYPE c, i_lfa1-land1_ten TYPE c, i_lfa1-land1_leven TYPE c, i_lfa1-land1_twl TYPE c, i_lfa1-land1_thirteen TYPE c, i_lfa1-land1_foutn TYPE c, temp(16) TYPE c, a(2) TYPE c, ai TYPE c, bi TYPE i, b(6) TYPE c, lv TYPE i, p1(20) TYPE c, p2(9) TYPE c, p3(10) TYPE c, p4(10) TYPE c, del(7) TYPE c, del1(3) TYPE c. i_lfa1-land1 = vat.

i_lfa1-land1_fifth = i_lfa1-land1+04(1). i_lfa1-land1_fftn = i_lfa1-land1+14(1). i_lfa1-land1_sixtn = i_lfa1-land1+15(1) . i_lfa1-land1_eight = i_lfa1-land1+07(1). i_lfa1-land1_foutn = i_lfa1-land1+13(1) . i_lfa1-land1_thirteen = i_lfa1-land1+12(1) .

CONCATENATE i_lfa1-land1_fftn i_lfa1-land1_sixtn INTO a. ai = a. IF NOT strlen( vat ) EQ 16. MESSAGE 'Please enter 16 digit number' TYPE 'E'. ENDIF. IF vat(16) CO '0123456789'. MESSAGE 'success' TYPE 'S'. ELSE. MESSAGE 'enter numaric digits only' TYPE 'E'. ENDIF.

lv = 2 * i_lfa1-land1_fifth.

*i_lfa1-land1 = vat . CALL FUNCTION EXPORTING string = pos = IMPORTING string1 = string2 = WRITE / p1. WRITE / p2. 'STRING_SPLIT_AT_POSITION' vat 7 p1 p2.

* *

CALL FUNCTION 'STRING_SPLIT_AT_POSITION' EXPORTING string = p2 pos = 6 IMPORTING string1 = p3 string2 = p4 EXCEPTIONS string1_too_small = 1 string2_too_small = 2 pos_not_valid = 3 OTHERS = 4.

SELECT * FROM zpincode INTO TABLE lt. READ TABLE lt INTO wa_pin WITH KEY pincode = p3. IF sy-subrc = 0. MESSAGE 'pincode inserted' TYPE 'S'. WRITE:/ i_lfa1-land1 . ELSE. MESSAGE 'insert pincode in 8 th position' TYPE 'E'. ENDIF. lv = 2 * i_lfa1-land1_fifth. IF a eq lv . MESSAGE 'condition success' TYPE 'S'. ELSE. MESSAGE 'last two digits should be double to 5 th position' TYPE 'E'. ENDIF.

elseif i_lfa1-land1 eq 'DE'. i_lfa1-land1_first TYPE c value 'D', i_lfa1-land1_second TYPE c value 'E', a1(2) TYPE c, G(2) type c, f type i, f1 type i, p5(20) TYPE c, p6(7) type c , w_str(7) TYPE c VALUE '01234567'. DATA:

* *i_lfa1-land1 = vat . i_lfa1-land1_first = i_lfa1-land1+00(1). i_lfa1-land1_second = i_lfa1-land1+01(1).

CONCATENATE i_lfa1-land1_first i_lfa1-land1_second INTO a1. G = a1. IF NOT strlen( i_lfa1-land1 ) EQ 9. MESSAGE 'Please enter 9 alphanumaric characters' TYPE 'E'. endif.

CALL FUNCTION 'STRING_SPLIT_AT_POSITION' EXPORTING string = i_lfa1-land1 pos = 2

LANGU IMPORTING STRING1 STRING2 .

= SY-LANGU = p5 = p6

W_STR = p6. if w_str co '0123456789'. * write: / w_str. MESSAGE 'condition success' TYPE 'S'. else. * write: / w_str. MESSAGE 'Please last 7 digits should number' TYPE 'E'. endif. IF NOT strlen( i_lfa1-land1 ) EQ 9. MESSAGE E000(zvatmsg). endif. if f1 = f. MESSAGE 'condition success' TYPE 'S'. else. MESSAGE 'Please last 9 digits should number' TYPE 'E'. endif. if G = 'DE' . **write:/ i_lfa1-land1_first , / i_lfa1-land1_second , / a1 , */ *vat. else. MESSAGE E001(zvatmsg). ENDIF. elseif country = 'AU'. DATA: i_lfa1-land1_tenth TYPE c , t type i, p0(20) TYPE c, p7(19) TYPE c, p8(10) TYPE c, p9(10) TYPE C. * i_lfa1-land1 = vat . i_lfa1-land1_first = i_lfa1-land1+00(1). i_lfa1-land1_second = i_lfa1-land1+01(1). i_lfa1-land1_second = i_lfa1-land1+02(1). i_lfa1-land1_fifth = i_lfa1-land1+04(1). i_lfa1-land1_fftn = i_lfa1-land1+14(1). i_lfa1-land1_sixtn = i_lfa1-land1+15(1) . i_lfa1-land1_eight = i_lfa1-land1+07(1).

i_lfa1-land1_tenth = i_lfa1-land1+09(1). t = i_lfa1-land1_tenth .

IF NOT strlen( i_lfa1-land1 ) EQ 12. MESSAGE 'enter 12 digit no' type 'W'. endif. CALL FUNCTION 'STRING_SPLIT_AT_POSITION' EXPORTING string = i_lfa1-land1 pos = 2 IMPORTING string1 = p0 string2 = p7. WRITE / p0. WRITE / p7. CALL FUNCTION 'STRING_SPLIT_AT_POSITION' EXPORTING string = P7 pos = 3 IMPORTING string1 = p8 string2 = p9. WRITE / p8. WRITE / p9. if p0(2) co '0123456789'. message 'success' type 'S'. else. message 'enter numaric digits in first and second place' type 'E'. endif.

select * from zstate_code into table lt1. read table lt1 into wa_code with key code = p8. if sy-subrc = 0. MESSAGE 'state code inserted' TYPE 'S'. *WRITE:/ i_lfa1-land1 . else. MESSAGE 'insert pincode in 3 rd position' TYPE 'E'. endif. if t = 3 or t = 5. message 'condition success' type 'S'. *write:/ i_lfa1-land1, i_lfa1-land1_tenth. else. message ' 10th place should be either 3 or 5' type 'E'. endif.

if p9(7) co '0123456789'. message 'condition success' type 'S'. else. message 'enter numaric digits in last 7 place' type 'E'. endif.

Potrebbero piacerti anche