<< Start-Of-Selection
*&---------------------------------------------------------------------*
*& Form TRANSFORM_EXCEL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form transform_excel .
data : lv_flag,
lv_input type string.
data: lv_moff1 type i,
lv_mlen1 type i,
lv_moff2 type i,
lv_mlen2 type i,
lv_len type i,
lv_rdate type sy-datum,
lv_adate type sy-datum,
lv_i type i,
lv_line type i,
lv_month(2) type c,
lv_day(2) type c,
lv_str type string.
data: result type p length 8 decimals 2,
l_oref type ref to cx_root,
p_text type string.
loop at gi_excel.
if gi_excel-line cp '*<Worksheet ss:Name="Page1">*'.
lv_flag = 'X'.
endif.
if lv_flag = 'X'.
* WRITE :/ gi_excel-line.
* TRANSFER response-line to file.
concatenate lv_input gi_excel-line into lv_input.
endif.
if gi_excel-line cp '*</Worksheet>*'.
clear lv_flag.
endif.
endloop.
split lv_input at '</Row>' into table gi_tab.
loop at gi_tab into gw_tab.
if gw_tab cp '*<Row><Cell ss:MergeAcross="4"*' or gw_tab cp '*<Row><Cellss:MergeAcross="4"*'..
if gw_tab cp '*Foreign Exchange Rates as of*' or
gw_tab cp '*ForeignExchange Rates as of*' or
gw_tab cp '*Foreign ExchangeRates as of*' or
gw_tab cp '*Foreign Exchange Ratesas of*' or
gw_tab cp '*Foreign Exchange Rates asof*'.
append gw_tab to gi_tab2.
endif.
endif.
if gw_tab cp '<Row><Cell ss:MergeAcross="4"*' or
gw_tab cp '<Row><Cellss:MergeAcross="4"*'.
if gw_tab cp '*Released on*' or
gw_tab cp '*Releasedon*'.
append gw_tab to gi_tab2.
endif.
endif.
if gw_tab cp '<Row><Cell ss:StyleID="StringLiteral" >*' or
gw_tab cp '<Row><Cellss:StyleID="StringLiteral" >*' or
gw_tab cp '<Row><Cellss:StyleID="StringLiteral" >*' or
gw_tab cp '<Row><Cell ss:StyleID="StringLiteral" >*'.
append gw_tab to gi_tab2.
endif.
endloop.
refresh gi_tab.
clear gi_tab.
perform get_mapping.
if not r_waers[] is initial.
loop at gi_tab2 into gw_tab.
split gw_tab at '><' into table gi_tab.
loop at gi_tab into gw_tab.
if gw_tab cp 'Data ss:Type=*' or gw_tab cp 'Datass:Type=*'.
if gw_tab cp '*Foreign Exchange Rates as of*'.
perform get_date using gw_tab
changing lv_adate.
gv_adate = lv_adate.
elseif gw_tab cp '*Released on*' or gw_tab cp '*Releasedon*'.
perform get_date using gw_tab
changing lv_rdate.
gv_rdate = lv_rdate.
else.
lv_i = lv_i + 1.
find
regex '>' in gw_tab
match offset lv_moff1
match length lv_mlen1.
find
regex '<' in gw_tab
match offset lv_moff2
match length lv_mlen2.
lv_len = lv_moff2 - lv_moff1 - 1.
lv_moff1 = lv_moff1 + 1.
try .
if lv_i = 1.
gi_rate-nation = gw_tab+lv_moff1(lv_len).
elseif lv_i = 2.
gi_rate-waers = gw_tab+lv_moff1(lv_len).
if not gi_rate-waers in r_waers.
lv_i = 0.
exit.
endif.
elseif lv_i = 3.
gi_rate-sb = gw_tab+lv_moff1(lv_len).
elseif lv_i = 4.
gi_rate-tt = gw_tab+lv_moff1(lv_len).
elseif lv_i = 5.
gi_rate-asr = gw_tab+lv_moff1(lv_len).
append gi_rate.
lv_i = 0.
if gi_rate-waers = 'USD'.
gi_rate-waers = 'USD4'.
append gi_rate.
endif.
endif.
catch cx_sy_conversion_no_number into l_oref. .
p_text = l_oref->get_text( ).
endtry.
endif.
endif.
endloop.
endloop.
endif.
if gi_rate[] is initial and gv_i <= 15.
gv_bdate = gv_bdate - 1.
gv_i = gv_i + 1.
perform get_uri.
perform get_http_excel.
perform transform_excel.
endif.
endform. " TRANSFORM_EXCEL
<< Start-Of-Selection
ไม่มีความคิดเห็น:
แสดงความคิดเห็น