CREDIT LIMIT SAP HANA
*&---------------------------------------------------------------------*
*& Report ZPRG_UPDATE_UKMBP
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zprg_update_ukmbp.
DATA : it_data TYPE ukmbp_cms_sgm.
DATA : it_data2 TYPE ukmbp_cms.
TYPES : BEGIN OF ty_s_error2,
msg_err1 TYPE string,
END OF ty_s_error2.
DATA hasil TYPE TABLE OF ty_s_error2 WITH HEADER LINE.
* Structure Decleration
DATA :BEGIN OF fs_field,
partner TYPE ukmbp_cms_sgm-partner,
credit_sgmnt TYPE ukmbp_cms_sgm-credit_sgmnt,
credit_limit TYPE ukmbp_cms_sgm-credit_limit,
rating_val_date TYPE ukmbp_cms-rating_val_date,
check_rule TYPE ukmbp_cms-check_rule,
limit_rule TYPE ukmbp_cms-limit_rule,
risk_class TYPE ukmbp_cms-risk_class,
END OF fs_field.
TYPES: fs_struct(4096) TYPE c OCCURS 0 .
DATA: w_struct TYPE fs_struct.
*Internal table decleration
DATA: t_field LIKE TABLE OF fs_field,
t_field_item LIKE TABLE OF fs_field.
*Input Path
SELECTION-SCREEN BEGIN OF BLOCK blck WITH FRAME TITLE TEXT-011.
PARAMETERS:
p_file TYPE rlgrap-filename OBLIGATORY. " File Path
SELECTION-SCREEN END OF BLOCK blck.
AT SELECTION-SCREEN.
* Opening window for path selection
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_file.
* Uploading excel file.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* i_field_seperator = 'X'
i_line_header = 'X'
i_tab_raw_data = w_struct
i_filename = p_file
TABLES
i_tab_converted_data = t_field
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
START-OF-SELECTION.
CLEAR :hasil,hasil[].
LOOP AT t_field INTO fs_field .
CLEAR :it_data,it_data2.
SELECT SINGLE * FROM ukmbp_cms_sgm INTO it_data WHERE partner = fs_field-partner AND credit_sgmnt = fs_field-credit_sgmnt.
it_data-credit_limit = fs_field-credit_limit.
IF it_data-partner IS NOT INITIAL.
MODIFY ukmbp_cms_sgm FROM it_data.
CONCATENATE it_data-partner ' ukmbp_cms_sgm SUCCESS' INTO hasil-msg_err1.
ELSE.
CONCATENATE 'BP' fs_field-partner ' ukmbp_cms_sgm FAILED' INTO hasil-msg_err1.
ENDIF.
SELECT SINGLE * FROM ukmbp_cms INTO it_data2 WHERE partner = fs_field-partner.
it_data2-check_rule = fs_field-check_rule.
it_data2-limit_rule = fs_field-limit_rule.
it_data2-risk_class = fs_field-risk_class.
it_data2-rating_val_date = fs_field-rating_val_date.
IF it_data2-partner is NOT INITIAL.
MODIFY ukmbp_cms FROM it_data2.
CONCATENATE hasil-msg_err1 ' ukmbp_cms SUCCESS' INTO hasil-msg_err1 SEPARATED BY space.
ELSE.
CONCATENATE hasil-msg_err1 ' ukmbp_cms FAILED, please check the BP number format in your excel file' INTO hasil-msg_err1 SEPARATED BY space.
ENDIF.
APPEND hasil.
CLEAR hasil.
ENDLOOP.
* IF sy-subrc = 0.
LOOP AT hasil.
WRITE :/ hasil-msg_err1.
ENDLOOP.
* ENDIF.
0 Response to "UPDATE TABLE UKMBP_CMS AND UKMBP_CMS_SGM CREDIT LIMIT SAP HANA"
Post a Comment