Professional Documents
Culture Documents
*&---------------------------------------------------------------------*
*& form f_upload
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form f_upload .
wf_file = p_inpf.
call function 'gui_upload'
exporting
filename = wf_file
filetype = 'asc'
has_field_separator = 'x'
* header_length = 0
* read_by_line = 'x'
* dat_mode = ' '
* codepage = ' '
* ignore_cerr = abap_true
* replacement = '#'
* check_bom = ' '
* virus_scan_profile =
* no_auth_check = ' '
* importing
* filelength =
* header =
tables
data_tab = int_record
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17
.
if sy-subrc <> 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
*perform open_group.
.
*&---------------------------------------------------------------------*
*& form f_appl_ser
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form f_appl_ser .
if p_l_inpf eq '/cidata/conversion/pp/'.
message text-020 type 's'.
stop.
endif.
open dataset p_l_inpf for input in text mode encoding default.
if sy-subrc ne 0.
exit.
else.
do.
clear: wa_string, int_record_tmp.
read dataset p_l_inpf into wa_string.
if sy-subrc ne 0.
exit.
else.
split wa_string at con_tab into int_record_tmp-matnr
int_record_tmp-werks
int_record_tmp-profidnetz
int_record_tmp-statu
int_record_tmp-verwe
int_record_tmp-losvn
int_record_tmp-losbs
int_record_tmp-vornr
int_record_tmp-phflg
int_record_tmp-pvznr
int_record_tmp-phseq
int_record_tmp-arbpl
int_record_tmp-steus
int_record_tmp-ltxa1
int_record_tmp-bmsch
int_record_tmp-meinh
int_record_tmp-vgw01
int_record_tmp-vge01
int_record_tmp-vgw02
int_record_tmp-vge02
int_record_tmp-lar02
int_record_tmp-vgw03
int_record_tmp-vge03
int_record_tmp-lar03
int_record_tmp-costr_1
int_record_tmp-costr_2
int_record_tmp-costr_3.
move-corresponding int_record_tmp to int_record.
append int_record.
clear int_record.
endif.
enddo.
close dataset p_l_inpf.
endif.
* endif.
*&---------------------------------------------------------------------*
*& form f_c201_bdc
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form f_c201_bdc .
*------------------------------------------------------------------------*
* fm which takes the input as file name and collect the values in flatfile
* to internal table .
*------------------------------------------------------------------------*
loop at int_record. "moving item data into int_opr.
move-corresponding int_record to int_opr.
append int_opr.
clear int_opr.
wc_record = sy-tabix.
endloop.
data: l_mstring(480).
if session = 'x'.
call function 'bdc_open_group'
exporting client = sy-mandt
group = group
user = user
keep = keep
holddate = holddate.
endif
.
*****************************************************
perform bdc_dynpro using 'saplcpda' '4210'.
perform bdc_field using 'bdc_cursor'
'plkod-losvn'.
perform bdc_field using 'bdc_okcode'
'=voue'.
perform bdc_field using 'plkod-verwe'
int_record-verwe.
perform bdc_field using 'plkod-statu'
int_record-statu.
perform bdc_field using 'plkod-bmsch'
int_record-bmsch.
perform bdc_field using 'plkod-losvn'
int_record-losvn.
perform bdc_field using 'plkod-losbs'
int_record-losbs.
*****************************************************
perform bdc_dynpro using 'saplcpdi' '4400'.
perform bdc_field using 'bdc_cursor'
'plpod-vornr(02)'.
perform bdc_field using 'bdc_okcode'
'ent1'.
wc_idx = '1'.
wc_idx = wc_idx + 1.
wc_index = wc_index + 1.
clear int_opr.
endloop.
*****************************************************
wc_cntr1 = 1.
loop at int_opr where matnr = int_record-matnr
and werks = int_record-werks
and profidnetz = int_record-profidnetz.
"loopin to fill table control under process instructions tab.
if wc_cntr1 > 1.
wc_cntr2 = wc_cntr1 - 1.
concatenate 'rc27x-flg_sel(' wc_cntr2 ')' into wf_fnam.
perform bdc_field using wf_fnam
''.
endif.
if int_opr-phflg = 'x'.
perform bdc_field using 'bdc_okcode'
'=arbd'.
concatenate 'rc27x-flg_sel(' wc_cntr1 ')' into wf_fnam.
perform bdc_field using wf_fnam
'x'.
*****************************************************
perform bdc_dynpro using 'saplcpdo' '4410'.
perform bdc_field using 'bdc_cursor'
'plpod-vornr'.
perform bdc_field using 'bdc_okcode'
'=back'.
*****************************************************
perform bdc_dynpro using 'saplcpdi' '4400'.
perform bdc_field using 'bdc_cursor'
'plpod-vornr(01)'.
perform bdc_field using 'bdc_okcode'
'=ftue'.
perform bdc_field using 'rc27x-entry_act'
'1'.
*****************************************************
*****************************************************
wc_cntr1 = wc_cntr1 + 1.
continue.
endif.
clear int_opr.
endloop.
*************************************************************
perform bdc_dynpro using 'saplcpdi' '4400'.
perform bdc_field using 'bdc_cursor'
'plpod-vornr(01)'.
perform bdc_field using 'bdc_okcode'
'=end'.
perform bdc_field using 'rc27x-entry_act' '1'.
*************************************************************
perform bdc_dynpro using 'saplspo1' '0100'.
perform bdc_field using 'bdc_okcode'
'=yes'.
*************************************************************
perform f_bdc_transaction using 'c201' changing l_mstring.
.
if int_messtab-msgtyp = 's'.
int_audit-matnr = int_record-matnr.
int_audit-status = text-002.
int_audit-message = l_mstring.
wc_pro = wc_pro + wc_idx - 1.
append int_audit.
clear int_record.
endloop.
perform close_group.
endform. " f_c201_bdc
*&---------------------------------------------------------------------*
*& form f_alvdisplay
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form f_alvdisplay .
*&---------------------------------------------------------------------*
*& catalog building
*&---------------------------------------------------------------------*
tables
t_outtab = int_audit "name of
the internal table
exceptions
program_error = 1
others = 2
.
if sy-subrc <> 0.
else.
endif.
*&---------------------------------------------------------------------*
*& form for making header .
*&---------------------------------------------------------------------*
form top_of_page .
fs_line-typ = 'a'.
fs_line-info = wf_line.
append fs_line to int_header.
clear fs_line.
* f3000_build_header
endform. "top_of_page
*&---------------------------------------------------------------------*
*& form f_getserverfile
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form f_getserverfile .
call function '/sapdmc/lsm_f4_server_file'
exporting
directory = '/cidata/conversion/pp/ '
filemask = ' '
importing
serverfile = p_l_inpf
exceptions
canceled_by_user = 1
others = 2
.
if sy-subrc <> 0.
message text-030 type 'e'.
exit.
else.
p_l_inpf = p_l_inpf.
endif.
* data: l_mstring(480).
data: l_subrc like sy-subrc.
* batch input session
if session = 'x'.
call function 'bdc_insert'
exporting tcode = tcode
tables dynprotab = bdcdata.
if smalllog <> 'x'.
* write: / 'bdc_insert'(i03),
* tcode,
* 'returncode:'(i05),
* sy-subrc,
* 'record:',
* sy-index.
endif.
* call transaction using
else.
refresh int_messtab.
call transaction tcode using bdcdata
mode ctumode
update cupdate
messages into int_messtab.
l_subrc = sy-subrc.
if smalllog <> 'x'.
* write: / 'call_transaction',
* tcode,
* 'returncode:'(i05),
* l_subrc,
* 'record:',
* sy-index.
loop at int_messtab.
select single * from t100 where sprsl = int_messtab-msgspra
and arbgb = int_messtab-msgid
and msgnr = int_messtab-msgnr.
if sy-subrc = 0.
l_mstring = t100-text.
if l_mstring cs '&1'.
replace '&1' with int_messtab-msgv1 into l_mstring.
replace '&2' with int_messtab-msgv2 into l_mstring.
replace '&3' with int_messtab-msgv3 into l_mstring.
replace '&4' with int_messtab-msgv4 into l_mstring.
else.
replace '&' with int_messtab-msgv1 into l_mstring.
replace '&' with int_messtab-msgv2 into l_mstring.
replace '&' with int_messtab-msgv3 into l_mstring.
replace '&' with int_messtab-msgv4 into l_mstring.
endif.
condense l_mstring.
* write: / int_messtab-msgtyp, l_mstring(250).
else.
* write: / int_messtab.
endif.
endloop.
* skip.
endif.
** erzeugen fehlermappe ************************************************
if l_subrc <> 0 and e_group <> space.
if e_group_opened = ' '.
call function 'bdc_open_group'
exporting client = sy-mandt
group = e_group
user = e_user
keep = e_keep
holddate = e_hdate.
e_group_opened = 'x'.
endif.
call function 'bdc_insert'
exporting tcode = tcode
tables dynprotab = bdcdata.
endif.
endif.
refresh bdcdata.