Revision: 52726
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 31, 2011 20:13 by mrowken
Initial Code
*&---------------------------------------------------------------------*
*& Include Z_GET_PERSON_DATA_PROGRAM_TOP Module Pool Z_GET_PERSON_DATA_PROGRAM
*&
*&---------------------------------------------------------------------*
PROGRAM z_get_person_data_program.
*&---------------------------------------------------------------------*
*& Module READ_PESEL INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* Global data declarations
DATA: gr_regex TYPE REF TO cl_abap_regex,
gr_matcher TYPE REF TO cl_abap_matcher,
ok_code TYPE sy-ucomm,
pesel_input TYPE zzpersons-pesel,
name_output TYPE zzpersons-name,
surname_output TYPE zzpersons-surname,
birthdate_output TYPE dats,
g_msg TYPE c,
g_out TYPE string.
*----------------------------------------------------------------------*
* MODULE READ_PESEL INPUT
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
MODULE read_pesel INPUT.
IF ok_code EQ 1.
g_out = pesel_input.
CREATE OBJECT gr_regex
EXPORTING
pattern = `{11}`.
gr_matcher = gr_regex->create_matcher( text = g_out ).
IF gr_matcher->match( ) IS INITIAL.
MESSAGE 'Pesel must consist of 11 numeral' TYPE 'I' DISPLAY LIKE 'E'.
ELSE.
CALL FUNCTION 'Z_SAP_PERSON_DATA' DESTINATION 'ZPLASAPBC'
EXPORTING
i_pesel = pesel_input
IMPORTING
e_name = name_output
e_surname = surname_output
e_birthdate = birthdate_output
EXCEPTIONS
no_input_given = 1
communication_failure = 2 MESSAGE g_msg
system_failure = 3 MESSAGE g_msg
OTHERS = 4.
CASE sy-subrc.
WHEN 1.
g_out = 'Exception received: NO_INPUT_GIVEN' .
WHEN 2.
CONCATENATE 'COMMUNICATION_FAILURE received:' g_msg INTO g_out SEPARATED
BY space.
WHEN 3.
CONCATENATE 'SYSTEM_FAILURE received:' g_msg INTO g_out SEPARATED BY
space.
WHEN 4.
g_out = 'Exception received: OTHERS'.
ENDCASE.
IF sy-subrc <> 0.
WRITE g_out.
ENDIF.
"MESSAGE g_msg TYPE 'I'.
MESSAGE 'Pesel OK' TYPE 'S'.
ENDIF.
ENDIF.
" LEAVE TO SCREEN 0.
ENDMODULE. " READ_PESEL INPUT
*&---------------------------------------------------------------------*
*& Module CHECK_INPUT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE check_input INPUT.
ENDMODULE. " CHECK_INPUT INPUT
*&---------------------------------------------------------------------*
*& Module EXIT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE exit INPUT.
CASE ok_code.
WHEN 'CANCEL'.
CLEAR ok_code.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " EXIT INPUT
Initial URL
Initial Description
Initial Title
Calling service on BC via RFC
Initial Tags
Initial Language
Other