Modified from SAP NOTE 2107672 BPJS Kesehatan Premium Calculation Report for SAP release 4.6D
Step 1 : Create Report ZHIDCHCR0
*&---------------------------------------------------------------------*
*& Report HIDCHCR0
*&
*&---------------------------------------------------------------------*
*& Indonesia BPJS Health Care Report
*&---------------------------------------------------------------------*
REPORT ZHIDCHCR0 MESSAGE-ID 3D.
INCLUDE zhidchcr0_top. "Data Declaration
INCLUDE zpy_simulation. "Payroll Simulation
INCLUDE zhr_gen_excel_ver1. "Excel function
INCLUDE zhidcbmr0_alv. "Popup ALV
INCLUDE zhidchcr0_sel. "Selection Screen
INCLUDE zhidchcr0_f01. "Main Functions
INCLUDE zhidchcr0_f02. "Other Functions
INCLUDE zhidchcr0_mai. "Main Include
Step 2 : Create Include programs ( See Below for details )
Step 3 : Create Excel Template and put it in tcode OAOR
That's it....
INCLUDE zhidchcr0_top. "Data Declaration
*----------------------------------------------------------------------*
* INCLUDE ZHIDCHCR0_TOP *
*----------------------------------------------------------------------*
TABLES: pernr.
TABLES: t512w,
t500p,
t005u,
t005f,
t005t.
*NODES: peras.
TYPE-POOLS: icon.
TYPE-POOLS: slis.
INFOTYPES: 0000,
0001,
0002,
3385.
CONSTANTS: gc_lowdate TYPE datum VALUE '18000101',
gc_highdate TYPE datum VALUE '99991231',
gc_molga TYPE molga VALUE '34'.
*CONSTANTS: gc_form_group TYPE hr99s_fogroup VALUE 'HR_ID_BPJS',
* gc_form_logic_name TYPE p_99b_formlogc VALUE
*'HR_ID_HIDCHCR0'.
*CONSTANTS:
* BEGIN OF c_alv_structures_sel,
* ae_headline TYPE dd02l-tabname VALUE 'P34_LOG_SEL',
* END OF c_alv_structures_sel,
* BEGIN OF c_alv_structures_alv,
* ae_headline TYPE dd02l-tabname VALUE 'P34_HIDCHCR0_ALV',
* END OF c_alv_structures_alv.
*CONSTANTS:
* BEGIN OF c_pal_categids_sel,
* ae_headline TYPE hrpad_pal_categ_id VALUE 'SEL',
* END OF c_pal_categids_sel,
* BEGIN OF c_pal_categids_alv,
* ae_headline TYPE hrpad_pal_categ_id VALUE 'ALV',
* END OF c_pal_categids_alv.
*CONSTANTS:
* gc_cate_sel TYPE hrpad_pal_categ_id VALUE 'SEL',
* gc_cate_alv TYPE hrpad_pal_categ_id VALUE 'ALV'.
*CONSTANTS: gc_pdf_data_structure TYPE string VALUE 'P34_HIDCHCR0_DATA'.
*TYPES: BEGIN OF gty_f4_help_for_form_name,
* fogroup TYPE p_99b_fogroup,
* foltxt TYPE p_99b_fptext,
* END OF gty_f4_help_for_form_name.
*TYPES: BEGIN OF ty_result,
* index TYPE syindex,
* time TYPE syuzeit,
* size TYPE filesize,
* content TYPE fpcontent,
* END OF ty_result,
* ty_result_tab TYPE STANDARD TABLE OF ty_result.
TYPES: BEGIN OF tt_pernr_data,
werks TYPE persa, "Personnel Area
seqno TYPE aufseqnr, "p34_seqno,
pernr TYPE pernr_d,
btrtl TYPE btrtl,
eenam TYPE pad_cname, "p34_eenam,
bpjsi TYPE zbpjsi, "p34_bpjsi, "BPJS ID
relty TYPE sbttx, "p34_edrel,
"Relation Type (employee, spouse,child)
salar TYPE pad_amt7s, "p34_salar, "Salary
allow TYPE pad_amt7s, "p34_regal, "Fix Allow. (Uang Makan)
totin TYPE ben_bscov, "p34_bpjsb, "Total Gaji + Tunj tetap
bpjsb TYPE ben_bscov, "p34_bpjsb, "Gaji Perhitungan iuran
eecon TYPE pad_amt7s, "p34_eecon, "/3E6 + /3E7 EE Contrb.
ercon TYPE pad_amt7s, "p34_ercon, "/3R6 + /3R7 ER Contrb.
tocon TYPE pad_amt7s, "p34_tocon, "Total Iuran
bencl TYPE zbecls, "p34_becls, "Benefit Class
waers TYPE waers,
END OF tt_pernr_data.
DATA: gv_fname TYPE pad_cname, "p34_eenam,
gv_natio(3) TYPE c,
gv_abkrs TYPE abkrs,
gv_fpper TYPE faper.
DATA: gv_company_name TYPE butxt,
gv_location type string.
DATA: gv_exclud_ee TYPE i,
gv_valid_ee TYPE i,
gv_noprocess_ee TYPE i,
gv_total_ee TYPE i.
* gt_alv_data TYPE hrpayid_hidchcr0_alv,
* gt_msg_data TYPE hrpayid_message,
* gs_pdf_data TYPE p34_hidchcr0_data,
* gt_pdf_data TYPE TABLE OF p34_hidchcr0_data,
* gref_report_logic TYPE REF TO cl_hrpayid_report_hcr,
* obj_pal_log TYPE REF TO cl_hr99b_pal,
* gv_fp_docparams TYPE sfpdocparams,
* gv_fp_outputparams TYPE sfpoutputparams,
* gt_f4_help_for_form_name TYPE TABLE OF gty_f4_help_for_form_name,
* gv_fm_name TYPE rs38l_fnam,
* gv_node_index TYPE i.
DATA: gt_pernr_data TYPE STANDARD TABLE OF tt_pernr_data.
* gt_download_data TYPE STANDARD TABLE OF tt_pernr_data.
*DATA: result_tab TYPE ty_result_tab.
* zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
DATA: lt_pernr_data TYPE STANDARD TABLE OF tt_pernr_data.
DATA: lt_wa LIKE LINE OF lt_pernr_data.
DATA: xoutput(1), xnotpassed(1).
DATA: vdtsep(1) TYPE c VALUE '.'.
INCLUDE zpy_simulation. "Payroll Simulation
*----------------------------------------------------------------------*
* INCLUDE ZPY_SIMULATION *
*----------------------------------------------------------------------*
*---------------------------------------------------------------------*
* FORM zpy_payroll_simulation *
*---------------------------------------------------------------------*
TYPE-POOLS: hrpay.
TABLES: pcl1, "IMPORT/EXPORT
pcl2. "IMPORT/EXPORT
INCLUDE hidpaymacro.
INCLUDE rpc2cd09.
INCLUDE rpppxd10.
INCLUDE rpc2rx29.
INCLUDE rpc2ps00.
INCLUDE rpc2pt00.
INCLUDE pc2rxid0.
INCLUDE rpc2rx02.
INCLUDE rpc2rx39.
INCLUDE rpppxd00.
INCLUDE rpppxm00.
*---------------------------------------------------------------------*
* FORM zpy_payroll_simulation *
*---------------------------------------------------------------------*
FORM zpy_payroll_simulation
TABLES p_rgdir STRUCTURE rgdir
* p_rt STRUCTURE rt
USING p_abkrs zperiod zyear p_pernr.
DATA: molga(2) TYPE c.
DATA: buffer TYPE hrpay_buffer.
* DATA: rgdir_line LIKE pc261.
DATA: trgdir LIKE rgdir OCCURS 0 WITH HEADER LINE.
DATA: p_var(14) TYPE c VALUE ''.
DATA: p_prog TYPE trdir-name VALUE 'ZHIDCALC0'.
DATA: sim_pernr LIKE pay_sim_pernr OCCURS 0 WITH HEADER LINE.
DATA: p_period TYPE t549q-pabrp, p_year TYPE t549q-pabrj.
DATA: p_fpper TYPE faper.
p_period = zperiod.
p_year = zyear.
CONCATENATE p_year p_period INTO p_fpper.
sim_pernr-pernr = p_pernr.
APPEND sim_pernr.
CALL FUNCTION 'HR_PAYROLL'
EXPORTING
payroll_area = p_abkrs
payroll_period = p_period
payroll_year = p_year
selection_variant = p_var
program_name = p_prog
* TST_ON = 'X'
TABLES
employee_numbers = sim_pernr
buffer = tbuff
buffer_directory = buffer_dir
delete_pclx = del_pclx_tab
EXCEPTIONS
program_not_exist = 1
variant_not_exist = 2
missing_parameter = 3
wrong_parameter = 4
wrong_country_group = 5
OTHERS = 6
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
buffer-tbuff[] = tbuff[].
buffer-buffer_dir[] = buffer_dir[].
buffer-del_pclx_tab[] = del_pclx_tab[].
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
persnr = sim_pernr-pernr
buffer = buffer
IMPORTING
molga = molga
TABLES
in_rgdir = trgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
* CALL FUNCTION 'CD_READ_LAST_RESULT_IN_RGDIR'
* IMPORTING
* ptx_rgdir_nv = rgdir_line
* TABLES
* pt_rgdir = rgdir.
CALL FUNCTION 'CD_EVALUATION_PERIODS'
EXPORTING
inper_modif = '01'
inper = p_fpper
TABLES
rgdir = trgdir
evpdir = rgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
* rx-key-pernr = sim_pernr-pernr.
* read table rgdir index 1.
* rx-key-seqno = rgdir-seqnr.
* rp-imp-c2-is.
* IF rp-imp-is-subrc = 0.
p_rgdir[] = rgdir[].
* p_rt[] = rt[].
* READ TABLE rgdir INDEX 1.
* WRITE: / 'fpper:', rgdir-fpper, 'inper:', rgdir-inper, 'srtza:',
*rgdir-srtza.
* WRITE: /.
* LOOP AT rt.
* WRITE: / rt-lgart, rt-betpe, rt-anzhl, rt-betrg.
* ENDLOOP.
* ENDIF.
ENDFORM.
INCLUDE zhr_gen_excel_ver1. "Excel function
****INCLUDE ZHR_GEN_EXCEL .
TYPE-POOLS: soi.
TYPES : type_doc(64),format_amount(18).
DATA: tranges TYPE soi_range_list,
tcontents TYPE soi_generic_table,
setranges TYPE soi_full_range_table,
rangesdef TYPE soi_dimension_table,
tformat TYPE soi_format_table,
tcell TYPE soi_cell_table.
DATA: struc_ranges TYPE soi_range_item,
struc_generic TYPE soi_generic_item,
struc_setrange TYPE soi_full_range_item,
struc_rangesdef TYPE soi_dimension_item,
struc_cell TYPE soi_cell_item.
*--- Object Instance Declaration ---
DATA: container TYPE REF TO cl_gui_custom_container.
DATA: control TYPE REF TO i_oi_container_control.
DATA: document TYPE REF TO i_oi_document_proxy.
DATA: sheet_interface TYPE REF TO i_oi_spreadsheet.
DATA: bds_doc TYPE REF TO cl_bds_document_set.
DATA: link_server TYPE REF TO i_oi_link_server,
is_created(1) TYPE c.
*--- Other Objects/Variable Declaration ---
DATA: no_flush,
error TYPE REF TO i_oi_error,
retcode(256) TYPE c,
version(64) TYPE c.
DATA: document_type(80) TYPE c VALUE soi_doctype_excel_sheet,
document_format(6) TYPE c,
doc_url TYPE bapiuri-uri, "MSDocument URL Address
pic_url TYPE bapiuri-uri. "Logo URL Address
* Error Handling after call a method
CLASS c_oi_errors DEFINITION LOAD.
*---------------------------------------------------------------------*
* FORM select_new_sheet *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> P_SHEET_NAME *
*---------------------------------------------------------------------*
FORM select_new_sheet USING p_sheet_name.
CALL METHOD sheet_interface->select_sheet
EXPORTING name = p_sheet_name
no_flush = no_flush
IMPORTING error = error
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
IF p_sheet_name <> 'COVER'.
CALL METHOD sheet_interface->set_selection
EXPORTING
left = 2
top = 2
rows = 4
columns = 1
no_flush = no_flush
updating = -1
IMPORTING error = error
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
ENDIF.
ENDFORM. " select_new_sheet
*---------------------------------------------------------------------*
* FORM select_document *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> NCLASS *
* --> OBJKEY *
* --> DOC_ID *
* --> ADR_URL *
*---------------------------------------------------------------------*
FORM select_document USING nclass TYPE type_doc
objkey TYPE type_doc
doc_id TYPE type_doc
CHANGING adr_url TYPE bapiuri-uri.
* Tables and WAs:
DATA: doc_signature TYPE sbdst_signature,
wa_doc_signature LIKE LINE OF doc_signature,
doc_components TYPE sbdst_components,
wa_doc_components LIKE LINE OF doc_components,
doc_uris TYPE sbdst_uri,
wa_doc_uris LIKE LINE OF doc_uris.
* IDs:
DATA: doc_classname TYPE sbdst_classname,
doc_classtype TYPE sbdst_classtype VALUE 'OT',
doc_object_key TYPE sbdst_object_key,
doc_mimetype LIKE bapicompon-mimetype.
*----------------------------------------------------------------------
CLEAR: wa_doc_signature, wa_doc_components, wa_doc_uris.
REFRESH: doc_signature, doc_components, doc_uris.
doc_classname = nclass.
doc_object_key = objkey.
wa_doc_signature-prop_name = 'DESCRIPTION'.
wa_doc_signature-prop_value = doc_id.
APPEND wa_doc_signature TO doc_signature.
* Availability of document checked
CALL METHOD bds_doc->get_info
EXPORTING classname = doc_classname
classtype = doc_classtype
object_key = doc_object_key
client = sy-mandt
CHANGING components = doc_components
signature = doc_signature
EXCEPTIONS nothing_found = 1
error_kpro = 2
internal_error = 3
parameter_error = 4
not_authorized = 5
not_allowed = 6.
IF sy-subrc NE 0 AND sy-subrc NE 1.
MESSAGE e016. "Error in the Business Document Service (BDS)
ENDIF.
IF sy-subrc = 1.
MESSAGE e017. "There are no documents that meet the search criteria
ENDIF.
* Get URL address
CALL METHOD bds_doc->get_with_url
EXPORTING classname = doc_classname
classtype = doc_classtype
object_key = doc_object_key
CHANGING uris = doc_uris
signature = doc_signature
EXCEPTIONS nothing_found = 1
error_kpro = 2
internal_error = 3
parameter_error = 4
not_authorized = 5
not_allowed = 6.
IF sy-subrc NE 0 AND sy-subrc NE 1.
MESSAGE e016.
ENDIF.
IF sy-subrc = 1.
MESSAGE e017.
ENDIF.
READ TABLE doc_components INTO wa_doc_components INDEX 1.
READ TABLE doc_uris INTO wa_doc_uris INDEX 1.
doc_mimetype = wa_doc_components-mimetype.
adr_url = wa_doc_uris-uri.
CASE doc_mimetype.
WHEN 'application/x-rtf' OR 'text/rtf'.
document_format = soi_docformat_rtf.
WHEN 'application/x-oleobject'.
document_format = soi_docformat_compound.
WHEN 'text/plain'.
document_format = soi_docformat_text.
WHEN OTHERS.
document_format = soi_docformat_native.
ENDCASE.
ENDFORM. " select_document
*---------------------------------------------------------------------*
* FORM formatting_rangesdef_tab *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM formatting_rangesdef_tab.
LOOP AT tcontents INTO struc_generic.
struc_rangesdef-rows = 1.
struc_rangesdef-columns = 1.
struc_rangesdef-row = struc_generic-row.
struc_rangesdef-column = struc_generic-column.
struc_generic-row = '1'.
struc_generic-column = '1'.
MODIFY tcontents FROM struc_generic INDEX sy-tabix.
APPEND struc_rangesdef TO rangesdef.
ENDLOOP.
ENDFORM.
*---------------------------------------------------------------------*
* FORM set_data *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM set_data.
CALL METHOD sheet_interface->set_ranges_data
EXPORTING
ranges = tranges
contents = tcontents
rangesdef = rangesdef
updating = -1
no_flush = no_flush
IMPORTING error = error
retcode = retcode.
CALL METHOD sheet_interface->screen_update
EXPORTING updating = 'X'
no_flush = no_flush
IMPORTING error = error
retcode = retcode.
CLEAR : tcontents, rangesdef.
REFRESH : tcontents, rangesdef.
ENDFORM.
*---------------------------------------------------------------------*
* FORM prog_indicator_excel *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> T_PERS *
* --> T_TEXT *
*---------------------------------------------------------------------*
FORM prog_indicator_excel USING t_pers t_text.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = t_pers
text = t_text.
ENDFORM.
*---------------------------------------------------------------------*
* FORM xlformat_amount *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> P_DECIMALS *
* --> P_AMOUNT *
* --> P_FORMAT *
*---------------------------------------------------------------------*
FORM xlformat_amount
USING p_decimals p_amount
CHANGING p_format TYPE format_amount.
DATA: zcnt TYPE i, zvalue TYPE p DECIMALS 2.
zvalue = p_amount. "selalu dijadikan 2 decimals dulu
WRITE zvalue TO p_format DECIMALS 2.
zcnt = 3 - p_decimals.
SHIFT p_format RIGHT BY zcnt PLACES.
IF p_decimals EQ 0.
REPLACE ',' WITH '' INTO p_format.
ENDIF.
CONDENSE p_format NO-GAPS.
IF p_amount LT 0.
CONCATENATE '-' p_format INTO p_format.
ENDIF.
IF p_amount EQ 0.
p_format = ''.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
* FORM format_amount *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> FCURR *
* --> P_AMOUNT *
* --> AXX *
*---------------------------------------------------------------------*
FORM format_amount USING fcurr p_amount
CHANGING axx TYPE format_amount.
DATA : p_val1 TYPE p DECIMALS 2.
DATA : p_val0 TYPE p DECIMALS 0.
p_val1 = p_amount.
p_val0 = p_amount.
IF p_val1 < 0. p_val1 = p_val1 * -1. p_val0 = p_val0 * -1. IF fcurr = 1. WRITE p_val1 TO axx CURRENCY 'IDR'. * ELSEIF fcurr = 2. * "dua decimal * WRITE p_val1 TO axx. ELSE. WRITE p_val0 TO axx. ENDIF. CONCATENATE '-' axx INTO axx. ELSE. IF fcurr = 1. WRITE p_val1 TO axx CURRENCY 'IDR'. * ELSEIF fcurr = 2. * "dua decimal * WRITE p_val1 TO axx. ELSE. WRITE p_val0 TO axx. ENDIF. ENDIF. CONDENSE axx NO-GAPS. DO 5 TIMES. REPLACE '.' WITH '' INTO axx. ENDDO. CONDENSE axx NO-GAPS. IF p_amount EQ 0. axx = ''. ENDIF. ENDFORM. *---------------------------------------------------------------------* * FORM modify_to_cell * *---------------------------------------------------------------------* * ........ * *---------------------------------------------------------------------* * --> P_COLS *
* --> P_ROWS *
* --> P_VALUE *
*---------------------------------------------------------------------*
FORM modify_to_cell USING p_cols p_rows
p_value.
struc_generic-column = p_cols.
struc_generic-row = p_rows.
struc_generic-value = p_value.
APPEND struc_generic TO tcontents.
ENDFORM. " MODIFY_to_cell
*---------------------------------------------------------------------*
* FORM insert_logo *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM insert_logo.
CALL METHOD document->paste_clipboard
EXPORTING
no_flush = no_flush
IMPORTING
error = error
retcode = retcode.
ENDFORM. " insert_logo
*---------------------------------------------------------------------*
* FORM connect_to_excel *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> P_PLACE *
* --> P_CLASS *
* --> P_OBJ *
* --> P_DOC *
* --> P_LOGO *
* --> P_NLOGO *
*---------------------------------------------------------------------*
FORM connect_to_excel USING p_place p_class p_obj p_doc
p_logo p_nlogo.
IF bds_doc IS INITIAL.
CREATE OBJECT bds_doc.
ENDIF.
IF container IS INITIAL.
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING control = control
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
CREATE OBJECT container
EXPORTING
container_name = 'CONTAINER'.
CALL METHOD control->init_control
EXPORTING r3_application_name = p_doc
inplace_enabled = 'X'
inplace_scroll_documents = 'X' "tambahan
parent = container
register_on_close_event = 'X' "tambahan
register_on_custom_event = 'X' "tambahan
no_flush = 'X' "tambahan
IMPORTING retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
* Excel
PERFORM select_document USING p_class p_obj p_doc
CHANGING doc_url.
** logo
* IF p_logo = 'X'.
* PERFORM select_document USING p_class p_obj p_nlogo
* CHANGING pic_url.
* ENDIF.
CALL METHOD control->get_document_proxy
EXPORTING
document_format = document_format
document_type = document_type
no_flush = no_flush
IMPORTING
document_proxy = document
error = error
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
* Open link server
CALL METHOD control->get_link_server
EXPORTING
no_flush = no_flush
IMPORTING
error = error
link_server = link_server
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
* IF is_created IS INITIAL.
CALL METHOD link_server->start_link_server
EXPORTING
link_server_mode = link_server->link_server_customname
no_flush = no_flush
server_name_suffix = 'SERVER_LINK'
IMPORTING
error = error
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
* is_created = 'X'.
* ENDIF.
* IF P_LOGO = 'X'.
** Open logo to buffer
* CALL METHOD LINK_SERVER->ADD_BINARY_ITEM
* EXPORTING
* ITEM_NAME = P_NLOGO
* NO_FLUSH = NO_FLUSH
* TABLE_URL = PIC_URL
* IMPORTING
* ERROR = ERROR
* RETCODE = RETCODE.
* CALL METHOD C_OI_ERRORS=>SHOW_MESSAGE EXPORTING TYPE = 'E'.
** Copy logo to buffer
* CALL METHOD LINK_SERVER->COPY_LINK_ITEM_TO_CLIPBOARD
* EXPORTING
* ITEM_NAME = P_NLOGO
* NO_FLUSH = NO_FLUSH
* IMPORTING
* ERROR = ERROR
* RETCODE = RETCODE.
* CALL METHOD C_OI_ERRORS=>SHOW_MESSAGE EXPORTING TYPE = 'E'.
* ENDIF.
* Open the Office document
* ‘X’ : MS Word will displayed in a custom container area
* Blank : MS Word will displayed in a new window.
CALL METHOD document->open_document
EXPORTING document_url = doc_url
open_inplace = p_place
IMPORTING retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
CALL METHOD document->get_spreadsheet_interface
EXPORTING no_flush = no_flush
IMPORTING sheet_interface = sheet_interface
error = error
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
* PERFORM prog_indicator_excel USING 100 'Link Complate!'.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
* FORM close_excel_link *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM close_excel_link.
* Close/release link server object
CALL METHOD link_server->stop_link_server
EXPORTING
no_flush = no_flush
IMPORTING
error = error
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
* CLEAR bds_doc.
free: container, bds_doc.
ENDFORM.
*---------------------------------------------------------------------*
* FORM run_macro *
*---------------------------------------------------------------------*
FORM run_macro USING p_macro_string.
CALL METHOD document->execute_macro
EXPORTING macro_string = p_macro_string
no_flush = no_flush
script_name = ''
IMPORTING error = error
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
ENDFORM.
*---------------------------------------------------------------------*
* FORM print_document *
*---------------------------------------------------------------------*
FORM print_document USING p_li_nbr_of_sheet.
DATA: lc_sheet_name(10) TYPE c,
lc_sheet_num(2) TYPE c,
lc_indicator_text(20).
DO p_li_nbr_of_sheet TIMES.
lc_sheet_num = sy-index.
CONCATENATE 'Sheet' lc_sheet_num INTO lc_sheet_name.
CONDENSE lc_sheet_name NO-GAPS.
CONCATENATE 'Printing' lc_sheet_name '...' INTO lc_indicator_text
SEPARATED BY space.
PERFORM prog_indicator_excel USING '' lc_indicator_text.
CALL METHOD sheet_interface->print
EXPORTING name = lc_sheet_name
no_flush = no_flush
IMPORTING error = error
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
ENDDO.
ENDFORM. " print_document
*---------------------------------------------------------------------*
* FORM delete_sheet *
*---------------------------------------------------------------------*
FORM delete_sheet USING p_sheet_name.
CALL METHOD sheet_interface->delete_sheet
EXPORTING name = p_sheet_name
no_flush = no_flush
IMPORTING error = error
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
ENDFORM. " delete_sheet
*---------------------------------------------------------------------*
* FORM CLEARING_KILL_OBJECT *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM clearing_kill_object.
CALL METHOD document->close_document.
* Clearing object instance
IF NOT document IS INITIAL.
DATA: has_changed TYPE i.
CALL METHOD document->close_document
EXPORTING no_flush = no_flush
IMPORTING error = error
has_changed = has_changed
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
FREE document.
ENDIF.
* CALL METHOD document->release_document
* EXPORTING no_flush = no_flush
* IMPORTING error = error
* retcode = retcode.
* CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
IF NOT bds_doc IS INITIAL.
FREE bds_doc.
ENDIF.
CALL METHOD control->release_all_documents
EXPORTING no_flush = no_flush
IMPORTING error = error
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
IF NOT control IS INITIAL.
CALL METHOD control->destroy_control
EXPORTING no_flush = no_flush
IMPORTING retcode = retcode
error = error.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
FREE control.
ENDIF.
IF NOT container IS INITIAL.
FREE container.
ENDIF.
IF NOT sheet_interface IS INITIAL.
FREE sheet_interface.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
* FORM reopen_document *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM reopen_document USING p_type p_class p_obj p_doc.
PERFORM select_document USING p_class p_obj p_doc
CHANGING doc_url.
CALL METHOD control->get_document_proxy
EXPORTING
document_format = document_format
document_type = document_type
no_flush = no_flush
IMPORTING
document_proxy = document
error = error
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
* Open link server
CALL METHOD control->get_link_server
EXPORTING
no_flush = no_flush
IMPORTING
error = error
link_server = link_server
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
* IF is_created IS INITIAL.
CALL METHOD link_server->start_link_server
EXPORTING
link_server_mode = link_server->link_server_customname
no_flush = no_flush
server_name_suffix = 'SERVER_LINK'
IMPORTING
error = error
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
CALL METHOD document->open_document
EXPORTING document_url = doc_url
open_inplace = 'X'
IMPORTING retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
CALL METHOD document->get_spreadsheet_interface
EXPORTING no_flush = no_flush
IMPORTING sheet_interface = sheet_interface
error = error
retcode = retcode.
CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
ENDFORM.
INCLUDE zhidcbmr0_alv. "Popup ALV
*----------------------------------------------------------------------*
* INCLUDE ZHIDCBMR0_F03 *
*----------------------------------------------------------------------*
*Structure declaration for nonprocess employee
TYPES : BEGIN OF it_enonp,
werks TYPE werks,
pernr TYPE pernr_d,
cname TYPE pad_cname,
itext TYPE string,
END OF it_enonp.
*Internal table and work area declaration for output in pop up
DATA : it_output TYPE STANDARD TABLE OF it_enonp INITIAL SIZE 0,
wa_output TYPE it_enonp.
*---------------------------------------------------------------------*
* Standard ALV declaration
*---------------------------------------------------------------------*
TYPE-POOLS : slis.
DATA:ls_fieldcat TYPE slis_fieldcat_alv.
DATA:lt_fieldcat TYPE slis_t_fieldcat_alv.
DATA:lt_layout TYPE slis_layout_alv.
*---------------------------------------------------------------------*
* FORM popup_display *
*---------------------------------------------------------------------*
FORM popup_display using p_xoutput.
CHECK NOT ( it_output IS INITIAL ).
IF p_xoutput IS INITIAL.
*field catalogue for pop up
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = '1'.
ls_fieldcat-fieldname = 'WERKS'.
ls_fieldcat-tabname = 'IT_OUTPUT'.
ls_fieldcat-seltext_m = 'PERSA'.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = '2'.
ls_fieldcat-fieldname = 'PERNR'.
ls_fieldcat-tabname = 'IT_OUTPUT'.
ls_fieldcat-seltext_m = 'PERNR'.
ls_fieldcat-outputlen = 50.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = '3'.
ls_fieldcat-fieldname = 'CNAME'.
ls_fieldcat-tabname = 'IT_OUTPUT'.
ls_fieldcat-seltext_m = 'NAME'.
ls_fieldcat-outputlen = 50.
APPEND ls_fieldcat TO lt_fieldcat.
CLEAR ls_fieldcat.
ls_fieldcat-row_pos = '1'.
ls_fieldcat-col_pos = '3'.
ls_fieldcat-fieldname = 'ITEXT'.
ls_fieldcat-tabname = 'IT_OUTPUT'.
ls_fieldcat-seltext_m = 'MESSAGE'.
ls_fieldcat-outputlen = 100.
APPEND ls_fieldcat TO lt_fieldcat.
lt_layout-zebra = 'X'.
lt_layout-colwidth_optimize = 'X'.
ENDIF.
* Display data in a POPUP
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZHIDCBMR0'
i_grid_title = 'Message'
is_layout = lt_layout
it_fieldcat = lt_fieldcat
i_screen_start_column = 10
i_screen_start_line = 5
i_screen_end_column = 100
i_screen_end_line = 15
TABLES
t_outtab = it_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " popup_display
INCLUDE zhidchcr0_sel. "Selection Screen
*----------------------------------------------------------------------*
* INCLUDE ZHIDCHCR0_SEL *
*----------------------------------------------------------------------*
* Download Options
*SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
* SELECTION-SCREEN: BEGIN OF LINE.
* PARAMETERS p_soft TYPE c AS CHECKBOX DEFAULT 'X' MODIF ID c1.
* SELECTION-SCREEN:
* COMMENT 5(12) text-002 FOR FIELD p_soft MODIF ID c1, POSITION 33
*.
* PARAMETERS: p_disk TYPE c AS CHECKBOX DEFAULT '' MODIF ID c1.
* SELECTION-SCREEN COMMENT 37(12) text-003 FOR FIELD p_disk MODIF ID c1
*.
*SELECTION-SCREEN: END OF LINE.
*SELECTION-SCREEN: BEGIN OF LINE.
* SELECTION-SCREEN:
* COMMENT 1(23) text-004 FOR FIELD p_path MODIF ID c1, POSITION 33
*.
* PARAMETERS: p_path(108) TYPE c DEFAULT 'C:\HCP_FORMS\' MODIF ID c1.
* SELECTION-SCREEN: END OF LINE.
*SELECTION-SCREEN: END OF BLOCK b1.
INCLUDE zhidchcr0_f01. "Main Functions
*----------------------------------------------------------------------*
* INCLUDE ZHIDCHCR0_F01 *
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form INITIAL_NATIONALITY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM initial_nationality .
DATA: ls_t500l TYPE t500l.
* ls_t500l = cl_hr_t500l=>read( molga = gc_molga ).
SELECT SINGLE land1 FROM t005 INTO gv_natio
WHERE intca = ls_t500l-intca.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form INITIAL_RESULT_TABLE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM initial_result_table .
CLEAR: gv_fname, xnotpassed.
gv_abkrs = pnpxabkr.
CONCATENATE pn-pabrj pn-pabrp INTO gv_fpper.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form CHECK_PERSONAL_INFO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM check_personal_info CHANGING xpass.
rp_provide_from_last p0000 space pn-begda pn-endda.
rp_provide_from_last p0001 space pn-begda pn-endda.
rp_provide_from_last p0002 space pn-begda pn-endda.
rp_provide_from_last p3385 space pn-begda pn-endda.
xpass = 0.
gv_total_ee = gv_total_ee + 1.
CONCATENATE p0002-vorna p0002-nachn INTO gv_fname SEPARATED BY space.
IF p3385 IS INITIAL .
gv_noprocess_ee = gv_noprocess_ee + 1.
CLEAR: wa_output.
wa_output-werks = p0001-werks.
wa_output-pernr = pernr-pernr.
wa_output-cname = gv_fname.
wa_output-itext = 'Infotype 3385-BPJS Not Found'.
APPEND wa_output TO it_output.
xpass = 1.
* CALL METHOD cl_hrpayid_alv_msg=>load
* EXPORTING
* iv_pernr = peras-pernr
* iv_fname = gv_fname
* iv_msgty = 'E'
* iv_msgid = '3D'
* iv_msgno = '060'
* CHANGING
* ct_messages = gt_msg_data.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form PROCESS_PERNR
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM process_pernr.
DATA: lt_pernr_data TYPE STANDARD TABLE OF tt_pernr_data.
DATA: maxbpjs LIKE t7id2l-amont.
* lt_msg_data TYPE hrpayid_message.
** Constructor
* CREATE OBJECT gref_report_logic
* EXPORTING
* iv_pernr = pernr-pernr
* iv_fname = gv_fname
* is_p0001 = p0001
* is_p0002 = p0002
* is_p3385 = p3385
* is_fpper = gv_fpper.
*
* CLEAR: lt_pernr_data,lt_msg_data.
* REFRESH lt_pernr_data.
* REFRESH lt_msg_data.
* CALL METHOD gref_report_logic->get_output_alv_data(
* IMPORTING
* et_pernr_data = lt_pernr_data
* et_message = lt_msg_data
* ).
CLEAR: lt_pernr_data, lt_wa.
REFRESH lt_pernr_data.
lt_wa-werks = p0001-werks.
lt_wa-seqno = lt_wa-seqno + 1.
lt_wa-pernr = pernr-pernr.
lt_wa-eenam = p0002-cname.
lt_wa-relty = 'Employee'.
lt_wa-bpjsi = p3385-bpjsi.
lt_wa-bencl = p3385-becls.
PERFORM get_bpjs_result USING lt_wa-pernr pn-begda pn-endda
CHANGING lt_wa-salar lt_wa-allow lt_wa-bpjsb
lt_wa-eecon lt_wa-ercon.
lt_wa-totin = lt_wa-bpjsb.
lt_wa-tocon = lt_wa-eecon + lt_wa-ercon.
PERFORM get_max_bpjs USING p3385-becls CHANGING maxbpjs.
IF lt_wa-bpjsb GT maxbpjs.
lt_wa-bpjsb = maxbpjs.
ENDIF.
IF lt_wa-bpjsb IS INITIAL.
CLEAR: wa_output.
wa_output-werks = p0001-werks.
wa_output-pernr = pernr-pernr.
wa_output-cname = gv_fname.
wa_output-itext = 'Error on Payroll Result or Not Found'.
APPEND wa_output TO it_output.
EXIT.
ENDIF.
* APPEND LINES OF lt_msg_data TO gt_msg_data.
lt_wa-waers = 'IDR'.
APPEND lt_wa TO lt_pernr_data.
DESCRIBE TABLE lt_pernr_data.
IF sy-tfill > 0.
gv_valid_ee = gv_valid_ee + 1.
APPEND LINES OF lt_pernr_data TO gt_pernr_data.
PERFORM read_dependents_info.
ELSE.
gv_noprocess_ee = gv_noprocess_ee + 1.
ENDIF.
ENDFORM.
*---------------------------------------------------------------------*
* FORM get_bpjs_result *
*---------------------------------------------------------------------*
FORM get_bpjs_result USING p_pernr p_begda p_endda
CHANGING p_salar p_allow p_bpjsb
p_eecon p_ercon.
DATA: cmolga TYPE t001p-molga.
DATA: nitems TYPE i.
DATA: BEGIN OF ztmp_rgdir OCCURS 0.
INCLUDE STRUCTURE pc261.
DATA: END OF ztmp_rgdir.
DATA: zrgdir LIKE ztmp_rgdir OCCURS 0 WITH HEADER LINE.
DATA: rgdir_line LIKE pc261.
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
persnr = p_pernr
IMPORTING
molga = cmolga
TABLES
in_rgdir = ztmp_rgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
CALL FUNCTION 'CD_EVALUATION_PERIODS'
EXPORTING
inper_modif = '01'
inper = gv_fpper
TABLES
rgdir = ztmp_rgdir
evpdir = zrgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
DESCRIBE TABLE zrgdir LINES nitems.
IF nitems EQ 0.
PERFORM zpy_payroll_simulation
TABLES zrgdir
USING gv_abkrs gv_fpper+4(2) gv_fpper(4) p_pernr.
ENDIF.
* ambil yang current period saja
* tidak perlu di loop ( kasus late hiring )
CALL FUNCTION 'CD_READ_LAST_RESULT_IN_RGDIR'
IMPORTING
ptx_rgdir_nv = rgdir_line
TABLES
pt_rgdir = zrgdir.
* LOOP AT zrgdir.
REFRESH rt.
rx-key-pernr = p_pernr.
* rx-key-seqno = zrgdir-seqnr.
rx-key-seqno = rgdir_line-seqnr.
rp-imp-c2-is.
PERFORM zread_wtype TABLES rt USING 'BP01' CHANGING p_salar.
PERFORM zread_wtype TABLES rt USING 'AR01' CHANGING p_allow.
PERFORM zread_wtype TABLES rt USING 'AR31' CHANGING p_allow.
PERFORM zread_wtype TABLES rt USING '/118' CHANGING p_bpjsb.
PERFORM zread_wtype TABLES rt USING '/3E6' CHANGING p_eecon.
PERFORM zread_wtype TABLES rt USING '/3E7' CHANGING p_eecon.
PERFORM zread_wtype TABLES rt USING '/3R6' CHANGING p_ercon.
PERFORM zread_wtype TABLES rt USING '/3R7' CHANGING p_ercon.
* ENDLOOP.
** get max gapok
* PERFORM get_maxgapok USING lt_wa-pernr pn-begda pn-endda
* CHANGING lt_wa-bpjsb.
ENDFORM.
*---------------------------------------------------------------------*
* FORM zread_wtype *
*---------------------------------------------------------------------*
FORM zread_wtype TABLES wa_rt STRUCTURE rt USING p_wtype CHANGING p_amt.
LOOP AT wa_rt WHERE lgart = p_wtype.
p_amt = p_amt + wa_rt-betrg.
ENDLOOP.
ENDFORM.
*---------------------------------------------------------------------*
* FORM get_maxgapok *
*---------------------------------------------------------------------*
*FORM get_maxgapok USING p_pernr p_begda p_endda
* CHANGING p_betrg.
* DATA: p_p0008 LIKE p0008 OCCURS 0 WITH HEADER LINE.
* DATA: p_p0014 LIKE p0014 OCCURS 0 WITH HEADER LINE.
* DATA: tgapok TYPE p DECIMALS 2, gapok TYPE p DECIMALS 2,
* tmakan TYPE p DECIMALS 2.
* DATA: iz9169brkt LIKE z9169brkt OCCURS 0 WITH HEADER LINE.
*
* REFRESH: p_p0008. CLEAR: p_p0008.
* CALL FUNCTION 'HR_READ_INFOTYPE_AUTHC_DISABLE'.
*
* CALL FUNCTION 'HR_READ_INFOTYPE'
* EXPORTING
* pernr = p_pernr
* infty = '0008'
* begda = p_begda
* endda = p_begda
* TABLES
* infty_tab = p_p0008
* EXCEPTIONS
* infty_not_found = 1
* OTHERS = 2.
* PROVIDE * FROM p_p0008 BETWEEN p_begda AND p_endda.
* ENDPROVIDE.
* PERFORM get_payment_amt TABLES p_p0008 USING '010'
* CHANGING gapok.
*
* CALL FUNCTION 'HR_READ_INFOTYPE'
* EXPORTING
* pernr = p_pernr
* infty = '0014'
* begda = p_begda
* endda = p_begda
* TABLES
* infty_tab = p_p0014
* EXCEPTIONS
* infty_not_found = 1
* OTHERS = 2.
* PERFORM get_payment_rec TABLES p_p0014 USING '020'
* CHANGING tmakan.
*
* tgapok = gapok + tmakan.
* CHECK gapok GT 0.
*
*
* SELECT * FROM z9169brkt INTO TABLE iz9169brkt.
* LOOP AT iz9169brkt.
* IF iz9169brkt-endda GE p_begda AND iz9169brkt-begda LE p_begda.
* ELSE.
* DELETE iz9169brkt.
* ENDIF.
* ENDLOOP.
* SORT iz9169brkt BY hirge DESCENDING.
* LOOP AT iz9169brkt.
* IF iz9169brkt-hirge GT tgapok.
* p_betrg = tgapok .
* ELSE.
* p_betrg = iz9169brkt-hirge .
* ENDIF.
* ENDLOOP.
*
*
*ENDFORM. " get_maxgapok
*---------------------------------------------------------------------*
* FORM get_payment_amt *
*---------------------------------------------------------------------*
FORM get_payment_amt TABLES p_p0008 STRUCTURE p0008
USING pgrp CHANGING pamount.
DATA: ipydt LIKE zhr_py_dt OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF rp08,
lga LIKE p0008-lga01,
bet LIKE p0008-bet01,
END OF rp08.
SELECT * INTO TABLE ipydt FROM zhr_py_dt WHERE zcode = pgrp.
LOOP AT ipydt.
DO 20 TIMES VARYING rp08 FROM p_p0008-lga01 NEXT p_p0008-lga02.
IF rp08-lga EQ ipydt-zwtype.
IF ipydt-zsign EQ '-'.
pamount = pamount + ( rp08-bet * -1 ).
ELSE.
pamount = pamount + rp08-bet.
ENDIF.
ENDIF.
ENDDO.
ENDLOOP.
ENDFORM.
*---------------------------------------------------------------------*
* FORM get_payment_rec *
*---------------------------------------------------------------------*
FORM get_payment_rec TABLES p_p0014 STRUCTURE p0014
USING pgrp CHANGING pamount.
DATA: ipydt LIKE zhr_py_dt OCCURS 0 WITH HEADER LINE.
SELECT * INTO TABLE ipydt FROM zhr_py_dt WHERE zcode = pgrp.
LOOP AT ipydt.
LOOP AT p_p0014 WHERE lgart = ipydt-zwtype.
IF ipydt-zsign EQ '-'.
pamount = pamount + ( p_p0014-betrg * -1 ).
ELSE.
pamount = pamount + p_p0014-betrg.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form READ_DEPENDENTS_INFO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM read_dependents_info .
DATA: ls_p0021 TYPE p0021,
lt_p0021 TYPE STANDARD TABLE OF p0021,
ls_p0318 TYPE p0318,
lt_p0318 TYPE STANDARD TABLE OF p0318.
DATA: ls_pernr_data TYPE tt_pernr_data,
lt_pernr_data TYPE STANDARD TABLE OF tt_pernr_data.
DATA: ls_t591s TYPE t591s.
DATA: n TYPE i.
* Read Dependents Information
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = pernr-pernr
infty = '0021'
begda = pn-begda
endda = pn-endda
TABLES
infty_tab = lt_p0021
EXCEPTIONS
infty_not_found = 1.
CHECK NOT lt_p0021 IS INITIAL.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = pernr-pernr
infty = '0318'
begda = pn-begda
endda = pn-endda
TABLES
infty_tab = lt_p0318
EXCEPTIONS
infty_not_found = 1.
DESCRIBE TABLE lt_p0318 LINES n.
CHECK n GT 0.
IF sy-subrc EQ 0 AND n GT 0.
* IF sy-subrc EQ 0 AND lt_p0318 IS NOT INITIAL.
LOOP AT lt_p0318 INTO ls_p0318.
CLEAR ls_pernr_data.
IF ls_p0318-depdp NE 'A' AND ls_p0318-depdp NE 'S'.
CONTINUE.
ELSE.
LOOP AT lt_p0021 INTO ls_p0021 WHERE pernr = ls_p0318-pernr
AND infty = '0021'
AND subty = ls_p0318-subty
AND objps = ls_p0318-objps
AND endda = ls_p0318-endda
AND begda = ls_p0318-begda.
EXIT.
ENDLOOP.
IF ls_p0318-bpjsi IS INITIAL.
CLEAR: wa_output.
wa_output-werks = p0001-werks.
wa_output-pernr = pernr-pernr.
wa_output-cname = ls_p0021-fcnam.
wa_output-itext = 'BPJS ID is empty'.
APPEND wa_output TO it_output.
* CALL METHOD cl_hrpayid_alv_msg=>load
* EXPORTING
* iv_pernr = peras-pernr
* iv_fname = ls_p0021-fcnam
* iv_msgty = 'E'
* iv_msgid = '3D'
* iv_msgno = '068'
* CHANGING
* ct_messages = gt_msg_data.
CONTINUE.
ENDIF.
ls_pernr_data-werks = p0001-werks.
ls_pernr_data-eenam = ls_p0021-fcnam.
ls_pernr_data-bpjsi = ls_p0318-bpjsi.
ls_pernr_data-bencl = ls_p0318-becls.
SELECT SINGLE * FROM t591s INTO ls_t591s
WHERE sprsl = sy-langu
AND infty = '0021'
AND subty = ls_p0021-subty.
IF NOT ls_t591s IS INITIAL.
ls_pernr_data-relty = ls_t591s-stext.
ENDIF.
APPEND ls_pernr_data TO lt_pernr_data.
ENDIF.
ENDLOOP.
ENDIF.
DESCRIBE TABLE lt_pernr_data.
IF sy-tfill > 0.
APPEND LINES OF lt_pernr_data TO gt_pernr_data.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form GENERATE_SEQNO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM generate_seqno .
DATA: lv_seqno TYPE int4.
DATA: ls_pernr_data TYPE tt_pernr_data.
lv_seqno = 1.
LOOP AT gt_pernr_data INTO ls_pernr_data.
ls_pernr_data-seqno = lv_seqno.
lv_seqno = lv_seqno + 1.
MODIFY gt_pernr_data FROM ls_pernr_data.
ENDLOOP.
ENDFORM.
*& Form DISPLAY_ALV_RESULT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*FORM display_alv_result
* USING pv_count_pernr TYPE i
* pv_count_success TYPE i
* pv_count_noprocess TYPE i
* pv_disp_node_index TYPE i.
*
* DATA:
* ls_message TYPE p34_message,
* ls_but TYPE hrpad_pal_s_pushbuttons,
* lv_categ TYPE hrpad_pal_categ_id VALUE 'SEL',
* lv_node TYPE hrpad_pal_node_key,
* lv_node_msg TYPE hrpad_pal_node_key,
* lv_node_err TYPE hrpad_pal_node_key,
* lv_node_alv TYPE hrpad_pal_node_key,
* lv_select_info TYPE p34_log_sel,
* lt_select_info TYPE STANDARD TABLE OF p34_log_sel.
*
* DATA: ls_pernr_data TYPE tt_pernr_data,
* ls_alv_data TYPE p34_hidchcr0_alv.
*
* FIELD-SYMBOLS: LIKE LINE OF gt_alv_data,
* TYPE p34_log_sel.
*
* " Statistics Node
* PERFORM create_catelog_sel.
* PERFORM create_node
* USING text-n01
* 'ROOT'
* gc_cate_sel
* CHANGING lv_node.
*
* " sub node for warning message
* PERFORM create_message_subnode
* USING text-n03
* lv_node
* gc_cate_sel
* 'W'
* CHANGING lv_node_msg.
*
* PERFORM create_message_subnode
* USING text-n04
* lv_node
* gc_cate_sel
* 'E'
* CHANGING lv_node_err.
*
* REFRESH lt_select_info.
* lv_select_info-ficon = icon_employee.
* lv_select_info-fname = text-014.
* lv_select_info-fvale = gv_total_ee.
* APPEND lv_select_info TO lt_select_info.
*
* lv_select_info-ficon = icon_green_light.
* lv_select_info-fname = text-016.
* lv_select_info-fvale = gv_valid_ee.
* APPEND lv_select_info TO lt_select_info.
*
** lv_select_info-ficon = icon_red_light.
** lv_select_info-fname = text-020.
** lv_select_info-fvale = gv_exclud_ee.
** APPEND lv_select_info TO lt_select_info.
*
* lv_select_info-ficon = icon_red_light.
* lv_select_info-fname = text-022.
* lv_select_info-fvale = pv_count_noprocess.
* APPEND lv_select_info TO lt_select_info.
*
* LOOP AT lt_select_info ASSIGNING .
* PERFORM node_add_rows
* USING
* lv_node.
* ENDLOOP.
*
* " Detail Node
* PERFORM create_catelog_alv.
* PERFORM create_node
* USING text-n02
* 'ROOT'
* gc_cate_alv
* CHANGING lv_node_alv.
*
* REFRESH gt_alv_data.
* LOOP AT gt_pernr_data INTO ls_pernr_data.
* MOVE-CORRESPONDING ls_pernr_data TO ls_alv_data.
* APPEND ls_alv_data TO gt_alv_data.
* ENDLOOP.
*
* LOOP AT gt_alv_data ASSIGNING .
* PERFORM node_add_rows
* USING
* lv_node_alv.
* ENDLOOP.
* IF pv_disp_node_index = 1.
* PERFORM display_app_log USING lv_node_alv.
* ELSEIF pv_disp_node_index = 2.
* PERFORM display_app_log USING lv_node_err.
* ELSE.
* PERFORM display_app_log USING lv_node.
* ENDIF.
*ENDFORM. " diplay_result
*&---------------------------------------------------------------------*
*& Form CREATE_CATELOG_SEL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*FORM create_catelog_sel .
* DATA:
* lv_node_key TYPE hrpad_pal_node_key,
* lt_fieldcat TYPE slis_t_fieldcat_alv,
* lv_alv_layout TYPE slis_layout_alv.
*
* FIELD-SYMBOLS:
* TYPE slis_fieldcat_alv.
* lv_alv_layout-colwidth_optimize = 'X'.
* lv_alv_layout-zebra = 'X'.
*
* CREATE OBJECT obj_pal_log
* EXPORTING
* p_alv_structure_names = c_alv_structures_sel
* p_pal_categ_ids = c_pal_categids_sel.
*
* CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
* EXPORTING
* i_structure_name = 'P34_LOG_SEL'
* CHANGING
* ct_fieldcat = lt_fieldcat
* EXCEPTIONS
* inconsistent_interface = 1
* program_error = 2
* OTHERS = 3.
*
* PERFORM align_field_cat
* CHANGING lt_fieldcat.
*
* CALL FUNCTION 'HR_PAL_CREATE_NODE_CATEG'
* EXPORTING
* i_categ_id = gc_cate_sel
* it_fieldcat = lt_fieldcat
* is_layout = lv_alv_layout
* i_save = 'A'
* i_rowmark = 'X'
* EXCEPTIONS
* program_error = 1
* OTHERS = 2.
*
* obj_pal_log->set_category_push_button(
* p_categ_id = c_pal_categids_sel-ae_headline
* p_rowmark = 'X'
* p_i_fieldcat = lt_fieldcat
* ).
*
* obj_pal_log->create_all_categories( ).
*ENDFORM.
*&---------------------------------------------------------------------*
*& Form create_catelog_alv
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*FORM create_catelog_alv.
* DATA:
* lt_fieldcat TYPE slis_t_fieldcat_alv,
* lv_alv_layout TYPE slis_layout_alv,
* lt_sort TYPE slis_t_sortinfo_alv,
* ls_but TYPE hrpad_pal_s_pushbuttons.
*
* FIELD-SYMBOLS:
* TYPE slis_fieldcat_alv.
* lv_alv_layout-colwidth_optimize = 'X'.
*
* lv_alv_layout-zebra = 'X'.
* IF p_soft EQ 'X' AND p_disk EQ 'X'.
* PERFORM create_button
* USING text-b03
* 'USER_COMMAND'
* CHANGING ls_but.
* ELSEIF p_soft EQ 'X' AND p_disk EQ space.
* PERFORM create_button
* USING text-b01
* 'USER_COMMAND'
* CHANGING ls_but.
* ELSEIF p_soft EQ space AND p_disk EQ 'X'.
* PERFORM create_button
* USING text-b02
* 'USER_COMMAND'
* CHANGING ls_but.
* ENDIF.
*
* CREATE OBJECT obj_pal_log
* EXPORTING
* p_alv_structure_names = c_alv_structures_alv
* p_pal_categ_ids = c_pal_categids_alv.
*
* CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
* EXPORTING
* i_structure_name = 'P34_HIDCHCR0_ALV'
* CHANGING
* ct_fieldcat = lt_fieldcat
* EXCEPTIONS
* inconsistent_interface = 1
* program_error = 2
* OTHERS = 3.
* PERFORM align_alv_field_cat
* CHANGING lt_fieldcat.
*
* CALL FUNCTION 'HR_PAL_CREATE_NODE_CATEG'
* EXPORTING
* i_categ_id = gc_cate_alv
* it_fieldcat = lt_fieldcat
* it_sort = lt_sort
* is_pushbuttons = ls_but
* is_layout = lv_alv_layout
* i_save = 'A'
* i_rowmark = 'X'
* EXCEPTIONS
* program_error = 1
* OTHERS = 2.
* obj_pal_log->set_category_push_button(
* p_categ_id = c_pal_categids_sel-ae_headline
* p_rowmark = 'X'
* p_i_fieldcat = lt_fieldcat
* ).
*
* obj_pal_log->create_all_categories( ).
*ENDFORM. "create_catelog_alv
*&---------------------------------------------------------------------*
*& Form create_node
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->IV_NODE_TEXT text
* -->VALUE text
* -->(IV_FATHERNODE) text
* -->VALUE text
* -->(IV_CATEG) text
* -->CV_NODE text
*----------------------------------------------------------------------*
*FORM create_node
* USING iv_node_text TYPE string
* value(iv_fathernode) TYPE hrpad_pal_node_key
* value(iv_categ) TYPE hrpad_pal_categ_id
* CHANGING cv_node TYPE hrpad_pal_node_key.
*
* CALL FUNCTION 'HR_PAL_NODE_ADD'
* EXPORTING
* i_relatkey = iv_fathernode
* i_node_txt = iv_node_text
* i_categ_id = iv_categ
* i_icon = icon_list
* IMPORTING
* e_node_key = cv_node
* EXCEPTIONS
* program_error = 1
* OTHERS = 2.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
*ENDFORM. " create_node
*&---------------------------------------------------------------------*
*& Form create_message_subnode
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->IV_NODE_TEXT text
* -->VALUE text
* -->(IV_FATHERNODE) text
* -->VALUE text
* -->(IV_CATEG) text
* -->VALUE text
* -->(IV_MSGTYPE) text
* -->CV_NODE text
*----------------------------------------------------------------------*
*FORM create_message_subnode USING iv_node_text TYPE string
* value(iv_fathernode) TYPE hrpad_pal_node_key
* value(iv_categ) TYPE hrpad_pal_categ_id
* value(iv_msgtype) TYPE c
* CHANGING
* cv_node TYPE hrpad_pal_node_key.
*
* DATA:
* ls_message TYPE p34_message,
* lv_select_info TYPE p34_log_sel,
* lt_select_info TYPE STANDARD TABLE OF p34_log_sel,
* lv_icon TYPE icon_d.
*
* FIELD-SYMBOLS: TYPE p34_log_sel.
* IF iv_msgtype = 'W'.
* lv_icon = icon_yellow_light.
* ELSEIF iv_msgtype = 'E'.
* lv_icon = icon_red_light.
* ENDIF.
*
* CALL FUNCTION 'HR_PAL_NODE_ADD'
* EXPORTING
* i_relatkey = iv_fathernode
* i_node_txt = iv_node_text
* i_categ_id = iv_categ
* i_icon = lv_icon
* IMPORTING
* e_node_key = cv_node
* EXCEPTIONS
* program_error = 1
* OTHERS = 2.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
*
* REFRESH lt_select_info.
* LOOP AT gt_msg_data INTO ls_message
* WHERE messt-msgty = iv_msgtype.
*
* lv_select_info-ficon = lv_icon.
*
* CONCATENATE ls_message-pernr ls_message-eenam
* INTO lv_select_info-fname
* SEPARATED BY space.
*
* MESSAGE ID ls_message-messt-msgid
* TYPE ls_message-messt-msgty
* NUMBER ls_message-messt-msgno
* WITH ls_message-messt-msgv1 ls_message-messt-msgv2
* ls_message-messt-msgv3 ls_message-messt-msgv4
* INTO lv_select_info-fvale.
*
* APPEND lv_select_info TO lt_select_info.
* ENDLOOP.
* LOOP AT lt_select_info ASSIGNING .
* PERFORM node_add_rows
* USING cv_node.
* ENDLOOP.
*ENDFORM. " create_node
*& Form node_add_rows
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->IS_RECORD_DATA text
* -->VALUE text
* -->(LV_NODE) text
*----------------------------------------------------------------------*
*FORM node_add_rows USING is_record_data TYPE any
* value(lv_node) TYPE hrpad_pal_node_key.
*
* CALL FUNCTION 'HR_PAL_NODE_ADD_ROW'
* EXPORTING
* i_node_key = lv_node
* i_row_data = is_record_data
* EXCEPTIONS
* program_error = 1
* OTHERS = 2.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
*ENDFORM. " record_node_add_rows
*&---------------------------------------------------------------------*
*& Form node_add_rows_message
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->IS_RECORD_DATA text
* -->VALUE text
* -->(LV_NODE) text
*----------------------------------------------------------------------*
*FORM node_add_rows_message USING is_record_data TYPE any
* value(lv_node) TYPE hrpad_pal_node_key
*.
* CALL FUNCTION 'HR_PAL_NODE_ADD_ROW'
* EXPORTING
* i_node_key = lv_node
* i_row_data = is_record_data
* EXCEPTIONS
* program_error = 1
* OTHERS = 2.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
*ENDFORM. " record_node_add_rows
*&---------------------------------------------------------------------*
*& Form pal_display
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PV_LOG_CAPTION text
*----------------------------------------------------------------------*
* FORM pal_display USING pv_log_caption TYPE c.
* DATA: ls_display_profile TYPE hrpad_pal_disp_prof,
* lv_repid TYPE sy-repid.
* lv_repid = sy-repid.
* ls_display_profile-title = pv_log_caption.
* ls_display_profile-tree_size = 10.
* ls_display_profile-tree_ontop = 'Y'.
* * Set callback for for spool number hotspot
* ls_display_profile-clbk_ucom-userexitp = lv_repid.
* ls_display_profile-clbk_ucom-userexitf = 'USER_COMMAND'.
* CALL FUNCTION 'HR_PAL_LOG_DISPLAY'
* EXPORTING
* i_s_display_profile = ls_display_profile
* * I_S_FLAT_PROFILE =
* EXCEPTIONS
* program_error = 1
* no_logs = 2
* OTHERS = 3.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
* ENDFORM. "pal_display
*&---------------------------------------------------------------------*
*& Form display_app_log
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->IV_NODE_SAVE text
*----------------------------------------------------------------------*
*FORM display_app_log USING iv_node_save TYPE hrpad_pal_node_key.
*
* DATA ls_display_profile TYPE hrpad_pal_disp_prof.
*
* ls_display_profile-title = sy-title.
* ls_display_profile-selected_node = iv_node_save.
* ls_display_profile-head_text = text-l02.
* ls_display_profile-tree_size = 8.
* APPEND iv_node_save TO ls_display_profile-expanded_nodes.
*
* CALL FUNCTION 'HR_PAL_LOG_DISPLAY'
* EXPORTING
* i_s_display_profile = ls_display_profile
* EXCEPTIONS
* program_error = 1
* no_logs = 2
* OTHERS = 3.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
*ENDFORM. " display_app_log
*&---------------------------------------------------------------------*
*& Form create_button
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->IV_BUTTONTXT text
* -->IV_EXIT_NAME text
* -->CS_BUT text
*----------------------------------------------------------------------*
*FORM create_button USING iv_buttontxt TYPE gui_text
* iv_exit_name TYPE baluep
* CHANGING cs_but TYPE hrpad_pal_s_pushbuttons.
* DATA:
* lv_button TYPE bal_s_push,
* lv_but_def TYPE smp_dyntxt,
* ls_routine TYPE bal_s_clbk.
* ls_routine-userexitp = sy-repid.
* ls_routine-userexitf = iv_exit_name.
* ls_routine-userexitt = space .
* lv_but_def-text = iv_buttontxt.
* lv_but_def-icon_id = icon_pdf.
* lv_but_def-icon_text = iv_buttontxt.
* lv_but_def-quickinfo = iv_buttontxt.
* lv_button-active = 'X'.
* lv_button-position = '1'.
* lv_button-def = lv_but_def.
* cs_but-cat_push1 = lv_button.
* cs_but-cat_push1-clbk = ls_routine.
*ENDFORM. " create_button
*&---------------------------------------------------------------------*
*& Form ALIGN_ALV_FIELD_CAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*FORM align_alv_field_cat CHANGING it_fieldcat TYPE slis_t_fieldcat_alv.
* FIELD-SYMBOLS:
* TYPE slis_fieldcat_alv.
*
* IF sy-cprog = ''. " Special process for alignment
* ELSE. " default: based on logon language
* LOOP AT it_fieldcat ASSIGNING .
* "Do Summary
* IF -fieldname = 'EECON' OR
* -fieldname = 'ERCON' OR
* -fieldname = 'TOCON'.
* -do_sum = 'X'.
* ENDIF.
* ENDLOOP.
* ENDIF.
*ENDFORM. " ALIGN_ALV_FIELD_CAT
*&---------------------------------------------------------------------*
*& Form align_field_cat
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*FORM align_field_cat CHANGING it_fieldcat TYPE slis_t_fieldcat_alv.
* FIELD-SYMBOLS:
* TYPE slis_fieldcat_alv.
*
* IF sy-cprog = ''. " Special process for alignment
* ELSE. " default: based on logon language
* IF sy-langu = 'E'.
* LOOP AT it_fieldcat ASSIGNING .
** IF -fieldname = 'FICON'.
** -just = 'C'.
** ELSE.
** " defaul alignment based on character or numbric
** ENDIF.
* ENDLOOP.
* ENDIF.
* ENDIF.
*ENDFORM. "align_field_cat
INCLUDE zhidchcr0_f02. "Other Functions
*----------------------------------------------------------------------*
* INCLUDE ZHIDCHCR0_F02 *
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Include HIDCHCR0_F02
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form user_command
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*FORM user_command USING is_line TYPE any
* CHANGING cs_state TYPE bal_s_cbuc.
* DATA: lv_count TYPE i.
* FIELD-SYMBOLS: TYPE table.
* ASSIGN is_line TO .
*
** at least one line is selected
* DESCRIBE TABLE LINES lv_count.
* IF lv_count EQ 0.
* MESSAGE text-021 type 'I'.
* EXIT.
* ENDIF.
*
* CASE cs_state-ucomm.
* WHEN '%CAT_PUSH1'.
* PERFORM prepare_form_data USING is_line.
* IF p_soft EQ 'X'.
* PERFORM pdf_print.
* ENDIF.
* IF p_disk EQ 'X'.
* PERFORM pdf_download.
* ENDIF.
* WHEN OTHERS.
* ENDCASE.
*
** Display the adjusted content table again
* PERFORM refresh_catalog.
* PERFORM display_alv_result USING gv_total_ee
* gv_valid_ee
* gv_noprocess_ee
* gv_node_index.
* UNASSIGN .
*
** Deal with user command, the screen sequence is out of control
* CLEAR cs_state-ucomm.
* IF sy-ucomm EQ '&F03'
* OR sy-ucomm EQ '&F12'
* OR sy-ucomm EQ '&F15'.
* LEAVE TO SCREEN 0.
* ENDIF.
*ENDFORM. "user_command_update
*&---------------------------------------------------------------------*
*& Form PREPARE_FORM_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*FORM prepare_form_data USING is_line TYPE any.
* CONSTANTS: lc_lines TYPE i VALUE 13.
* FIELD-SYMBOLS: TYPE table,
* TYPE ANY,
* TYPE tt_pernr_data,
* TYPE p34_hidchcr0_data,
* TYPE p34_hidchcr0_tbl.
*
* DATA: ls_alv_data TYPE p34_hidchcr0_alv,
* ls_pdf_data TYPE p34_hidchcr0_data.
* DATA: ls_download_data TYPE tt_pernr_data.
* DATA: lv_mod TYPE i, lv_pageno TYPE i.
* DATA: lv_seqno TYPE i VALUE 0.
* DATA: lv_bukrs TYPE bukrs, lv_btrtl TYPE btrtl.
* ASSIGN is_line TO .
*
* CLEAR: gt_pdf_data, gs_pdf_data.
* REFRESH: gt_download_data, gt_pdf_data.
* LOOP AT ASSIGNING .
* MOVE-CORRESPONDING TO ls_alv_data.
* READ TABLE gt_pernr_data ASSIGNING WITH KEY seqno =
* ls_alv_data-seqno.
* IF sy-subrc EQ 0.
* APPEND TO gt_download_data.
* ENDIF.
* ENDLOOP.
*
* SORT gt_download_data BY seqno bukrs.
* LOOP AT gt_download_data INTO ls_download_data.
* lv_mod = sy-tabix MOD lc_lines.
*
* IF lv_mod EQ 1.
* lv_pageno = lv_pageno + 1.
* ENDIF.
*
* IF ls_download_data-pernr IS NOT INITIAL.
* lv_seqno = lv_seqno + 1.
* ENDIF.
*
* READ TABLE gt_pdf_data ASSIGNING WITH KEY bukrs =
* ls_download_data-bukrs
* pagno = lv_pageno.
* IF sy-subrc EQ 0.
* PERFORM add_sub_pdf_it USING ls_download_data lv_seqno
* CHANGING .
* ELSE. "New Company Code or New Page
* CLEAR ls_pdf_data.
* ls_pdf_data-pagno = lv_pageno.
*
* IF lv_bukrs IS INITIAL.
* lv_bukrs = ls_download_data-bukrs.
* ELSE.
* IF lv_bukrs NE ls_download_data-bukrs AND
* ls_download_data-bukrs IS NOT INITIAL.
* lv_bukrs = ls_download_data-bukrs.
* ENDIF.
* ENDIF.
*
* IF lv_btrtl IS INITIAL.
* lv_btrtl = ls_download_data-btrtl.
* ELSE.
* IF lv_btrtl NE ls_download_data-btrtl AND
* ls_download_data-btrtl IS NOT INITIAL.
* lv_btrtl = ls_download_data-btrtl.
* ENDIF.
* ENDIF.
*
* ls_pdf_data-bukrs = ls_download_data-bukrs.
* PERFORM read_company_name USING lv_bukrs
* CHANGING ls_pdf_data-comna.
*
* PERFORM read_company_addr USING lv_bukrs
* CHANGING ls_pdf_data-comla.
*
* PERFORM read_mini_regional USING lv_bukrs lv_btrtl
* CHANGING ls_pdf_data-minrw.
*
* PERFORM read_max_bpjsb CHANGING ls_pdf_data-maxb1
* ls_pdf_data-maxb2
* ls_pdf_data-maxb3.
*
* PERFORM add_sub_pdf_it USING ls_download_data
* lv_seqno
* CHANGING ls_pdf_data.
*
* APPEND ls_pdf_data TO gt_pdf_data.
* ENDIF.
*
* ENDLOOP.
*ENDFORM.
*
*&---------------------------------------------------------------------*
*& Form READ_COMPANY_NAME
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM read_company_name USING p_bukrs
CHANGING p_comna.
DATA: ls_t001 TYPE t001.
SELECT SINGLE * FROM t001 INTO ls_t001
WHERE bukrs = p_bukrs.
IF NOT ls_t001 IS INITIAL.
p_comna = ls_t001-butxt.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form READ_COMPANY_ADDR
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM read_company_addr USING p_werks
CHANGING p_comla.
SELECT SINGLE * FROM t500p WHERE persa EQ p_werks.
IF sy-subrc EQ 0.
SELECT SINGLE * FROM t005u WHERE spras = sy-langu
AND land1 = t500p-land1
AND bland = t500p-regio.
SELECT SINGLE * FROM t005f WHERE spras = sy-langu
AND land1 = t500p-land1
AND counc = t500p-counc
AND regio = t500p-regio.
SELECT SINGLE * FROM t005t WHERE spras = sy-langu
AND land1 = t500p-land1.
CONCATENATE t500p-stras t500p-ort01 t500p-pfach t005f-bezei
t005u-bezei t005t-landx t500p-pstlz INTO p_comla
SEPARATED BY space.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form READ_MINI_REGIONAL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*FORM read_mini_regional USING p_werks p_btrtl
* CHANGING p_minrw.
* DATA: ls_t7id0p TYPE t7id0p,
* ls_t7idrm TYPE t7idrm,
* ls_t7idrw TYPE t7idrw.
*
* SELECT SINGLE * FROM t7id0p INTO ls_t7id0p
* WHERE werks = p_werks
* AND btrtl = p_btrtl.
*
* IF ls_t7id0p IS NOT INITIAL.
* SELECT SINGLE * FROM t7idrm INTO ls_t7idrm
* WHERE taxmo = ls_t7id0p-taxmo.
* IF sy-subrc EQ 0.
* SELECT SINGLE * FROM t7idrw INTO ls_t7idrw
* WHERE region_code = ls_t7idrm-region_code.
* IF sy-subrc EQ 0.
* MOVE ls_t7idrw-region_min_wage TO p_minrw.
* ENDIF.
* ENDIF.
* ENDIF.
*
*ENDFORM.
*&---------------------------------------------------------------------*
*& Form READ_MAX_BPJSB
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM read_max_bpjsb CHANGING p_maxb1 p_maxb2 p_maxb3.
DATA: lv_ptkp_self LIKE t7id2l-amont,
lv_ptkp_spouse LIKE t7id2l-amont,
lv_ptkp_one_dep LIKE t7id2l-amont.
DATA: ls_t7id2l TYPE t7id2l.
SELECT * FROM t7id2l INTO ls_t7id2l
WHERE zeinh EQ '06' AND endda GE pn-begda. " and begda GT pn-begda.
CASE ls_t7id2l-const.
WHEN '01'.
lv_ptkp_self = ls_t7id2l-amont.
WHEN '02'.
lv_ptkp_spouse = ls_t7id2l-amont.
WHEN '03'.
IF ls_t7id2l-tlevl = '01'.
lv_ptkp_one_dep = ls_t7id2l-amont.
ENDIF.
WHEN OTHERS.
ENDCASE.
ENDSELECT.
p_maxb1 =
( ( lv_ptkp_self + lv_ptkp_spouse + lv_ptkp_one_dep ) / 6 ) * 100.
p_maxb2 =
( ( lv_ptkp_self + lv_ptkp_spouse + lv_ptkp_one_dep ) / 8 ) * 100.
p_maxb3 =
( ( lv_ptkp_self + lv_ptkp_spouse + lv_ptkp_one_dep ) / 12 ) * 100.
ENDFORM.
*---------------------------------------------------------------------*
* FORM get_max_bpjs *
*---------------------------------------------------------------------*
FORM get_max_bpjs USING p_becls CHANGING p_maxbpjs.
DATA: maxb1 LIKE t7id2l-amont, maxb2 LIKE t7id2l-amont,
maxb3 LIKE t7id2l-amont.
CLEAR p_maxbpjs.
PERFORM read_max_bpjsb CHANGING maxb1 maxb2 maxb3.
CASE p_becls.
WHEN '1'.
p_maxbpjs = maxb1 / 100.
WHEN '2'.
p_maxbpjs = maxb2 / 100.
WHEN '3'.
p_maxbpjs = maxb3 / 100.
WHEN OTHERS.
ENDCASE.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form ADD_SUB_PDF_IT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*FORM add_sub_pdf_it USING p_download_data TYPE tt_pernr_data
* p_seqno TYPE i
* CHANGING p_pdf_data TYPE p34_hidchcr0_data.
* DATA: lv_temp_amt TYPE p34_salar.
* DATA: ls_ee_tbl TYPE p34_hidchcr0_tbl.
*
* IF p_download_data-pernr IS NOT INITIAL. "Sequnce No.
* ls_ee_tbl-seqno = p_seqno.
* ELSE.
* CLEAR ls_ee_tbl-seqno.
* ENDIF.
*
* ls_ee_tbl-pernr = p_download_data-pernr. "Pernr
* ls_ee_tbl-eenam = p_download_data-eenam. "Employee Name
* ls_ee_tbl-bpjsi = p_download_data-bpjsi. "BPJS ID
* ls_ee_tbl-relty = p_download_data-relty. "Relation Type
*
* CLEAR lv_temp_amt.
* IF p_download_data-salar IS NOT INITIAL. "Salary
* lv_temp_amt = p_download_data-salar * 100.
* ls_ee_tbl-salar = lv_temp_amt.
* ENDIF.
*
* CLEAR lv_temp_amt.
* IF p_download_data-allow IS NOT INITIAL. "Regular Allowance
* lv_temp_amt = p_download_data-allow * 100.
* ls_ee_tbl-allow = lv_temp_amt.
* ENDIF.
*
* CLEAR lv_temp_amt.
* IF p_download_data-totin IS NOT INITIAL. "Total Income
* lv_temp_amt = p_download_data-totin * 100.
* ls_ee_tbl-totin = lv_temp_amt.
* ENDIF.
*
* CLEAR lv_temp_amt.
* IF p_download_data-bpjsb IS NOT INITIAL. "BPJS Base
* lv_temp_amt = p_download_data-bpjsb * 100.
* ls_ee_tbl-bpjsb = lv_temp_amt.
* ENDIF.
*
* CLEAR lv_temp_amt.
* IF p_download_data-eecon IS NOT INITIAL. "Employee Contribution
* lv_temp_amt = p_download_data-eecon * 100.
* ls_ee_tbl-eecon = lv_temp_amt.
* p_pdf_data-teeco = p_pdf_data-teeco + lv_temp_amt.
* ENDIF.
*
* CLEAR lv_temp_amt.
* IF p_download_data-ercon IS NOT INITIAL. "Employer Contribution
* lv_temp_amt = p_download_data-ercon * 100.
* ls_ee_tbl-ercon = lv_temp_amt.
* p_pdf_data-terco = p_pdf_data-terco + lv_temp_amt.
* ENDIF.
*
* CLEAR lv_temp_amt.
* IF p_download_data-tocon IS NOT INITIAL. "Total Contribution
* lv_temp_amt = p_download_data-tocon * 100.
* ls_ee_tbl-tocon = lv_temp_amt.
* p_pdf_data-totco = p_pdf_data-totco + lv_temp_amt.
* ENDIF.
*
* ls_ee_tbl-bencl = p_download_data-bencl. "Benefit Clas
* APPEND ls_ee_tbl TO p_pdf_data-ee_tbl.
*ENDFORM.
*&---------------------------------------------------------------------*
*& Form pdf_print
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*FORM pdf_print .
* DATA: hr99b_form_sel TYPE hr99b_form_sel,
* l_options TYPE itcpo.
*
* hr99b_form_sel-molga = gc_molga.
* hr99b_form_sel-folname = gc_form_logic_name.
* hr99b_form_sel-fogroup = gc_form_group.
*
* l_options = cl_hr99b_form=>get_print_parameters( ).
*
* CALL FUNCTION 'H99B_OPEN_LFORM_JOB'
* EXPORTING
* i_molga = hr99b_form_sel-molga
* i_fogroup = hr99b_form_sel-fogroup
* i_folname = hr99b_form_sel-folname
* options = l_options
* EXCEPTIONS
* OTHERS = 99.
* IF sy-subrc NE 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* STOP.
* ENDIF.
*
* LOOP AT gt_pdf_data INTO gs_pdf_data.
* CALL FUNCTION 'H99B_OUTPUT_LFORM'
* EXPORTING
* i_molga = gc_molga
* i_fogroup = hr99b_form_sel-fogroup
* i_folname = hr99b_form_sel-folname
* i_fovariant = hr99b_form_sel-fovariant
* i_data_struc = gs_pdf_data
* EXCEPTIONS
* error = 1
* OTHERS = 99.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
* ENDLOOP.
*
** close PDF Form
* CALL FUNCTION 'H99B_CLOSE_LFORM_JOB'
* EXCEPTIONS
* OTHERS = 99.
* IF sy-subrc NE 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
*
*ENDFORM. "pdf_print
*&---------------------------------------------------------------------*
*& Form refresh_catalog
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*FORM refresh_catalog .
* CALL FUNCTION 'HR_PAL_LOG_REFRESH'
* EXCEPTIONS
* program_error = 1
* OTHERS = 2.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
*ENDFORM. " refresh_catalog
*&---------------------------------------------------------------------*
*& Form PDF_DOWNLOAD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*FORM pdf_download .
* CONSTANTS : lc_fname(4) TYPE c VALUE 'FORM', " Form Name
* lc_suffix(4) TYPE c VALUE '.PDF'. " Suffix for PDF
*
* DATA: lv_disk_file TYPE string. " Disk File Path
* DATA: lv_pernr TYPE pernr_d, lv_sequnce TYPE c.
* DATA: lv_fname(20) TYPE c.
*
**Generate file name
* CLEAR: gs_pdf_data,
* lv_sequnce.
* LOOP AT gt_pdf_data INTO gs_pdf_data.
* lv_sequnce = lv_sequnce + 1.
* CONCATENATE p_path lc_fname lv_sequnce lc_suffix INTO lv_disk_file.
* CONDENSE lv_disk_file.
* PERFORM file_download USING gs_pdf_data lv_disk_file.
* ENDLOOP.
*ENDFORM.
*&---------------------------------------------------------------------*
*& Form FILE_DOWNLOAD
*&---------------------------------------------------------------------*
*& text
*----------------------------------------------------------------------*
*FORM file_download USING pdf_data disk_file.
* DATA: fm_name TYPE rs38l_fnam, " Name of Function Module
* fp_outputparams TYPE sfpoutputparams,
* " Form Processing Outout parameters
* pri_params TYPE pri_params, " Print Parameters
* fp_docparams TYPE sfpdocparams,
* " Form Parameters for Form Processing
* formoutput TYPE fpformoutput, " Form Output(PDF, PDL)
* binartfile TYPE solix_tab.
* " Storing PDF to Binary Format of Form
*Output
*
* DATA: document TYPE REF TO cl_document_bcs,
* gui_frontend TYPE REF TO cl_gui_frontend_services.
* DATA: lv_folname TYPE fpname.
*
** Sets the output parameters and opens the spool job
* fp_outputparams-nodialog = 'X'.
* fp_outputparams-getpdf = 'X'.
* CALL FUNCTION 'FP_JOB_OPEN'
* CHANGING
* ie_outputparams = fp_outputparams
* EXCEPTIONS
* cancel = 1
* usage_error = 2
* system_error = 3
* internal_error = 4
* OTHERS = 5.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* STOP.
* ENDIF.
*
**Get the name of the generated function module
* try .
* CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
* EXPORTING
* i_name = gc_form_logic_name
* IMPORTING
* e_funcname = fm_name.
*
* catch cx_fp_api_repository
* cx_fp_api_usage
* cx_fp_api_internal.
* CLEAR fm_name.
* endtry.
*
**Language and country setting
* fp_docparams-langu = sy-langu.
* fp_docparams-country = 'ID'.
*
* CALL FUNCTION fm_name
* EXPORTING
* /1bcdwb/docparams = fp_docparams
** IM_TABLE = gt_pdf_data
* is_data = pdf_data
* IMPORTING
* /1bcdwb/formoutput = formoutput
* EXCEPTIONS
* usage_error = 1
* system_error = 2
* internal_error = 3
* cx_fp_api_usage = 4
* OTHERS = 5.
*
**Close the spool job
* CALL FUNCTION 'FP_JOB_CLOSE'
* EXCEPTIONS
* usage_error = 1
* system_error = 2
* internal_error = 3
* OTHERS = 4.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* STOP.
* ENDIF.
*
**Convert PDF into Binary Table
* CHECK NOT formoutput-pdf IS INITIAL.
* binartfile = cl_document_bcs=>xstring_to_solix( ip_xstring =
* formoutput-pdf ).
* cl_gui_frontend_services=>gui_download(
* exporting
* filename = disk_file
* filetype = 'BIN'
* changing
* data_tab = binartfile
* exceptions
* file_write_error = 1
* no_authority = 2
* unknown_error = 3
* access_denied = 4
* file_not_found = 5
* others = 6 ).
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
* ENDFORM. " FILE_DOWNLOAD
FORM display_xls.
CALL SCREEN 9000.
ENDFORM.
*---------------------------------------------------------------------*
* MODULE create_spreadsheet_interface OUTPUT *
*---------------------------------------------------------------------*
MODULE create_spreadsheet_interface OUTPUT.
CHECK xoutput IS INITIAL.
PERFORM connect_to_excel
USING 'X' 'ZPYLIST' 'EE' 'BPJS_PCR' '' ''.
ENDMODULE. " create_spreadsheet_interface OUTPUT
*---------------------------------------------------------------------*
* MODULE formatting_output OUTPUT *
*---------------------------------------------------------------------*
MODULE formatting_output OUTPUT.
CHECK xoutput IS INITIAL.
* Display to excel
PERFORM write_to_excel.
PERFORM f_display_indicator USING 'Loading Excel...' 90.
* Close Excel Link
PERFORM close_excel_link.
PERFORM popup_display USING xoutput.
xoutput = 1.
ENDMODULE. " formatting_output OUTPUT
*---------------------------------------------------------------------*
* MODULE STATUS_9000 OUTPUT *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
MODULE status_9000 OUTPUT.
SET PF-STATUS 'S9000'.
SET TITLEBAR 'T9000'.
ENDMODULE. " STATUS_9000 OUTPUT
*---------------------------------------------------------------------*
* MODULE USER_COMMAND_9000 INPUT *
*---------------------------------------------------------------------*
MODULE user_command_9000 INPUT.
CASE sy-ucomm.
WHEN 'MESSAGE'.
PERFORM popup_display USING xoutput.
WHEN 'SAVE'.
PERFORM run_macro USING 'MacroSaveAs'.
WHEN 'PRINT'.
IF NOT container IS INITIAL.
PERFORM print_document USING 1.
ENDIF.
* IF retcode NE 'OK'.
* ELSE.
* PERFORM updata_database.
* IF sy-subrc = 0.
* LEAVE TO SCREEN 0.
* ENDIF.
* ENDIF.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
IF NOT container IS INITIAL.
PERFORM clearing_kill_object.
ENDIF.
IF sy-ucomm = 'EXIT' OR sy-ucomm = 'CANCEL'.
LEAVE PROGRAM.
ELSE.
LEAVE TO SCREEN 0.
ENDIF.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*---------------------------------------------------------------------*
* FORM frm_write_header *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM frm_write_header.
DATA: lv_amt(15).
DATA: maxb1 LIKE t7id2l-amont, maxb2 LIKE t7id2l-amont,
maxb3 LIKE t7id2l-amont.
PERFORM modify_to_cell USING 4 4 gv_company_name.
PERFORM modify_to_cell USING 4 5 gv_location.
PERFORM read_max_bpjsb CHANGING maxb1 maxb2 maxb3.
CLEAR lv_amt.
WRITE maxb3 TO lv_amt CURRENCY lt_wa-waers.
PERFORM modify_to_cell USING 4 6 lv_amt.
CLEAR lv_amt.
WRITE maxb2 TO lv_amt CURRENCY lt_wa-waers.
PERFORM modify_to_cell USING 4 7 lv_amt.
CLEAR lv_amt.
WRITE maxb1 TO lv_amt CURRENCY lt_wa-waers.
PERFORM modify_to_cell USING 4 8 lv_amt.
PERFORM formatting_rangesdef_tab.
PERFORM set_data.
ENDFORM.
*---------------------------------------------------------------------*
* FORM write_to_excel *
*---------------------------------------------------------------------*
FORM write_to_excel.
DATA: zbrs TYPE i.
DATA: lv_date(10) TYPE c, lv_text(80) TYPE c, lv_amt(15).
DATA: ztotal1 TYPE p, ztotal2 TYPE p, ztotal3 TYPE p.
zbrs = 12.
LOOP AT gt_pernr_data INTO lt_wa.
AT NEW werks.
PERFORM run_macro USING 'MacroCopySheet'.
CLEAR: gv_company_name.
* Prepare Employer Data
SELECT SINGLE name1 FROM t500p INTO gv_company_name
WHERE persa = lt_wa-werks AND molga = '34'.
IF sy-subrc NE 0.
gv_company_name = ''.
ENDIF.
PERFORM read_company_addr USING lt_wa-werks
CHANGING gv_location.
* Write Excel Header Data
PERFORM frm_write_header.
ENDAT.
PERFORM modify_to_cell USING 2 zbrs lt_wa-seqno.
IF NOT lt_wa-pernr IS INITIAL.
PERFORM modify_to_cell USING 3 zbrs lt_wa-pernr.
ENDIF.
PERFORM modify_to_cell USING 4 zbrs lt_wa-eenam.
PERFORM modify_to_cell USING 5 zbrs lt_wa-bpjsi.
PERFORM modify_to_cell USING 6 zbrs lt_wa-relty.
IF lt_wa-salar GT 0 .
CLEAR lv_amt.
WRITE lt_wa-salar TO lv_amt CURRENCY lt_wa-waers.
PERFORM modify_to_cell USING 7 zbrs lv_amt.
ENDIF.
IF lt_wa-allow GT 0 .
CLEAR lv_amt.
WRITE lt_wa-allow TO lv_amt CURRENCY lt_wa-waers.
PERFORM modify_to_cell USING 8 zbrs lv_amt.
ENDIF.
IF lt_wa-totin GT 0 .
CLEAR lv_amt.
WRITE lt_wa-totin TO lv_amt CURRENCY lt_wa-waers.
PERFORM modify_to_cell USING 9 zbrs lv_amt.
ENDIF.
IF lt_wa-bpjsb GT 0 .
CLEAR lv_amt.
WRITE lt_wa-bpjsb TO lv_amt CURRENCY lt_wa-waers.
PERFORM modify_to_cell USING 10 zbrs lv_amt.
ENDIF.
IF lt_wa-ercon GT 0 .
CLEAR lv_amt.
WRITE lt_wa-ercon TO lv_amt CURRENCY lt_wa-waers.
PERFORM modify_to_cell USING 11 zbrs lv_amt.
ENDIF.
IF lt_wa-eecon GT 0 .
CLEAR lv_amt.
WRITE lt_wa-eecon TO lv_amt CURRENCY lt_wa-waers.
PERFORM modify_to_cell USING 12 zbrs lv_amt.
ENDIF.
IF lt_wa-tocon GT 0 .
CLEAR lv_amt.
WRITE lt_wa-tocon TO lv_amt CURRENCY lt_wa-waers.
PERFORM modify_to_cell USING 13 zbrs lv_amt.
ENDIF.
PERFORM modify_to_cell USING 14 zbrs lt_wa-bencl.
ztotal1 = ztotal1 + ( lt_wa-eecon * 100 ).
ztotal2 = ztotal2 + ( lt_wa-ercon * 100 ).
ztotal3 = ztotal3 + ( lt_wa-tocon * 100 ).
PERFORM formatting_rangesdef_tab.
PERFORM set_data.
zbrs = zbrs + 1.
AT END OF werks.
PERFORM modify_to_cell USING 4 zbrs 'Jumlah'.
CLEAR lv_amt.
WRITE ztotal2 TO lv_amt.
PERFORM modify_to_cell USING 11 zbrs lv_amt.
CLEAR lv_amt.
WRITE ztotal1 TO lv_amt.
PERFORM modify_to_cell USING 12 zbrs lv_amt.
CLEAR lv_amt.
WRITE ztotal3 TO lv_amt.
PERFORM modify_to_cell USING 13 zbrs lv_amt.
PERFORM formatting_rangesdef_tab.
PERFORM set_data.
ENDAT.
ENDLOOP.
ENDFORM. " write_to_excel
*---------------------------------------------------------------------*
* FORM f_display_indicator *
*---------------------------------------------------------------------*
FORM f_display_indicator USING fu_text fu_percentage.
DATA: lv_percentage TYPE i.
IF fu_percentage = space.
lv_percentage = 0.
ELSE.
MOVE fu_percentage TO lv_percentage.
ENDIF.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = lv_percentage
text = fu_text.
ENDFORM.
INCLUDE zhidchcr0_mai. "Main Include
*----------------------------------------------------------------------*
* INCLUDE ZHIDCHCR0_MAI *
*----------------------------------------------------------------------*
INITIALIZATION.
PERFORM initial_nationality.
START-OF-SELECTION.
GET pernr.
PERFORM f_display_indicator USING pernr-pernr 0.
PERFORM initial_result_table.
PERFORM check_personal_info CHANGING xnotpassed.
CHECK xnotpassed EQ 0.
PERFORM process_pernr.
PERFORM f_display_indicator USING pernr-pernr 90.
END-OF-SELECTION.
PERFORM f_display_indicator USING 'Loading Excel...' 10.
PERFORM generate_seqno.
PERFORM display_xls.
* PERFORM display_alv_result
* USING gv_total_ee gv_valid_ee gv_noprocess_ee
* gv_node_index.
No comments:
Post a Comment