Академический Документы
Профессиональный Документы
Культура Документы
*----------------------------------------------------------------------*
* internal tables.
*----------------------------------------------------------------------*
*ata: ksadr like sadr occurs 0 with header line.
data: ksadr type sadr.
data: vbpa1 like vbpa occurs 10 with header line.
data: t_vbpa like vbpa occurs 10 with header line.
data: *zvs50 like zvs50 occurs 0 with header line.
data: *zvs1 like zvs13 occurs 0 with header line.
data: has_security(1).
data: retuencode(1) type c.
data: dd03d-fieldname(1) type c value 'x'.
data: rf02d-kunnr(10) type c.
data: debi-auswl(6) type c.
data: rf02d-d0110(1) type c.
data: rf02d-d0324(1) type c.
data: doc_type(9).
data: sold_to(7).
data: ship_to(22).
data: name1 like kna1-name1.
data: name2 like kna1-name2.
data: name3 like kna1-name3.
data: name4 like kna1-name4.
data: stras like kna1-stras.
data: ort01 like kna1-ort01.
data: regio like kna1-regio.
data: land like kna1-land1.
data: pstlz like kna1-pstlz.
data: telf1 like kna1-telf1.
data: telfx like kna1-telfx.
data: smtp_addr like adr6-smtp_addr.
data: ws_smtp_addr like adr6-smtp_addr.
data: stonr(5) type c.
data: dk(1) type c.
data line1 like sy-tabix.
data line2 like sy-tabix.
data: index like sy-index.
data: selline like sy-stepl.
data security(10) type c.
index type i,
selected,
vislength like icon-oleng,
invisable,
end of zcxta_column,
begin of zcxta_control,
fixed_cols type i,
lines type i,
top_line type i,
current_line type i,
left_col type i,
line_sel_mode type i,
col_sel_mode type i,
line_selector,
v_scroll,
h_grid,
v_grid,
cols type zcxta_column occurs 10,
end of zcxta_control.
data: input_entry.
data: wa type zcxta_column.
data: field-name like screen-name.
data: six type i value 6.
data: popup_text1(35).
data: popup_text2(35).
data: int_adr6 like adsmtp occurs 0 with header line. "$16
*data: w_prsnr like knvk-prsnr.
data: t_vbpa10 like vbpa occurs 10 with header line.
data: it_tab3 like adrc occurs 10 with header line.
data: t_vbpa2 like vbpa occurs 10 with header line.
data: t_knvk like knvk occurs 10 with header line.
data: t_adr6 like adr6 occurs 10 with header line.
data: t_adr61 like adr6 occurs 10 with header line.
data: t_vbpa4 like vbpa occurs 10 with header line.
data: it_vbpa002 like vbpa occurs 10 with header line.
data : begin of it_adr6 occurs 0,
smtp_addr like adr6-smtp_addr,
addrnumber like adr6-addrnumber,
end of it_adr6. "$16
tables: zvs24t.
* when 'ente'.
* set screen 100.
* move ok_code100 to ok_code1.
when 'exec' or 'ente'.
clear ok_code1.
perform check_stonr.
perform selection_of_table_zvs13.
loop at *zvs50.
delete itab where vbeln = *zvs50-vbeln.
endloop.
sigma-line_sel_mode = 2.
describe table itab lines sigma-lines.
if oldest = 'x'.
sort itab by erdat.
elseif newest = 'x'.
sort itab descending.
endif.
clear ok_code100.
when 'canc'.
clear ok_code100.
set screen 0.
leave screen.
when 'exit'.
clear ok_code100.
set screen 0.
leave screen.
when 'back'.
clear ok_code100.
set screen 0.
leave screen.
endcase.
endmodule. " user_command_0100 input
*&---------------------------------------------------------------------*
*& module user_command_0200 input
*&---------------------------------------------------------------------*
module user_command_0200 input.
case ok_code200.
*----------------------------------------------------------------------*
* this if for popbox which shows the total no of orders and records.
*----------------------------------------------------------------------*
when 'orde'.
clear total.
clear total1.
refresh itab10.
describe table itab lines lin_no.
move lin_no to total .
loop at itab.
describe table itab lines lin_no.
read table itab .
move itab-vbeln to itab10-vbeln.
append itab10.
endloop.
sort itab10 by vbeln.
delete adjacent duplicates from itab10.
describe table itab10 lines lin_no.
move lin_no to total1.
concatenate 'total no of records =' total into text
separated by ' '.
concatenate 'total no of orders =' total1 into text1
separated by ' '.
clear ok_code200.
if sy-ucomm = 'yes'.
clear ok_code200.
set screen 200. leave screen.
endif.
when 'canc' or 'f12'.
clear ok_code200.
set screen 100.
leave screen.
when 'exit'.
clear ok_code200.
set screen 0.
leave screen.
when 'more'.
refresh chk_tab.
refresh chk_tab1.
refresh *zvs50.
clear *zvs50.
loop at itab.
if itab-chekbox = 'x'.
move itab-vbeln to chk_tab-vbeln.
move 'x' to chk_tab-chekbox.
append chk_tab.
endif.
endloop.
sort chk_tab by vbeln.
delete adjacent duplicates from chk_tab.
loop at chk_tab.
select single * from zvs50 where vbeln = chk_tab-vbeln.
if sy-subrc = 0.
move 'order screening - queue management' to popup_title.
concatenate 'sales document' chk_tab-vbeln
'is being processed by' zvs50-ernam into field separated by ' '.
else.
move-corresponding chk_tab to *zvs50.
move sy-uname to *zvs50-ernam.
move sy-datum to *zvs50-erdat.
move sy-uzeit to *zvs50-uzeit.
append *zvs50.
insert into zvs50 values *zvs50.
num1 = 1.
read table chk_tab index num1.
endif.
endloop.
if sy-ucomm = 'yes'.
clear ok_code200.
set screen 200. leave screen.
endif.
if chk_tab-chekbox <> 'x'.
refresh chk_tab1.
get cursor line selline.
loop at itab.
move-corresponding itab to chk_tab1.
append chk_tab1.
endloop.
tabix = sigma-top_line + selline - 1.
read table chk_tab1 index tabix.
if sy-subrc ne 0.
clear ok_code200.
set screen 200. leave screen.
endif.
modify chk_tab1 index tabix.
select single * from zvs50 where vbeln = chk_tab1-vbeln.
if sy-subrc = 0.
move 'order screening - queue management' to popup_title.
concatenate 'sales document' chk_tab1-vbeln
'is being processed by' zvs50-ernam into field separated by ' '.
concatenate 'on date' zvs50-erdat 'at time' zvs50-uzeit
into field1 separated by ' '.
call function 'popup_to_inform'
exporting
titel = popup_title
txt1 = field
txt2 = field1
exceptions
others = 1.
else.
perform read_table_chk_tab1.
top_line = 1.
endif.
if sy-ucomm = 'yes'.
clear ok_code200.
set screen 200. leave screen.
endif.
endif.
clear ok_code200.
set screen 300.
leave screen.
when 'asce'.
perform ascending_columns_selected.
when 'desc'.
perform descending_columns_selected.
when 'sele'.
perform select.
when 'dese'.
perform deselect.
clear ok_code200.
when 'frst'.
clear ok_code200.
perform paging_200 using 'frst'.
clear ok_code200.
when 'prev'.
perform paging_200 using 'prev'.
clear ok_code200.
when 'next'.
clear ok_code200.
perform paging_200 using 'next'.
when 'last'.
perform paging_200 using 'last'.
clear ok_code200.
endcase.
endmodule. " user_command_0200 input
*&---------------------------------------------------------------------*
*& module status_0200 output
*&---------------------------------------------------------------------*
module status_0200 output.
set pf-status 'zsdg'.
set titlebar '200'.
endmodule. " status_0200 output
*&---------------------------------------------------------------------*
*& module display_sigma output
*&---------------------------------------------------------------------*
module display_sigma output.
if sy-ucomm = 'back' or
sy-ucomm = 'canc' or
sy-ucomm = 'neor'.
loop at int_del.
delete itab where vbeln = int_del-vbeln
and posnr = int_del-posnr
and zcomrea = int_del-zcomrea
and zqueid = int_del-zqueid
and zcland = int_del-zcland
and zcomgrp = int_del-zcomgrp.
endloop.
endif.
if sy-ucomm = 'rlse'.
*----------------------------------------------------------------------*
* when the order is being released then if it comes back to summary scre
*-----------------------------------------------------------------------
loop at ck_tab.
delete itab
where vbeln = ck_tab-vbeln and posnr = ck_tab-posnr
and zcomrea = ck_tab-zcomrea
and zqueid = ck_tab-zqueid
and zcland = ck_tab-zcland
and zcomgrp = ck_tab-zcomgrp.
endloop.
endif.
if sy-ucomm = 'furt'.
*----------------------------------------------------------------------*
* this is for delay the function code used is furt
* when the order is delayed it should not be seen on summary screen.
*----------------------------------------------------------------------*
if exclude_delayed = 'x'.
* if ck_tab-zohdat > sy-datum or
* ck_tab-zohtim > sy-uzeit.
loop at ck_tab.
delete itab
where vbeln = ck_tab-vbeln and posnr = ck_tab-posnr
and zcomrea = ck_tab-zcomrea
and zqueid = ck_tab-zqueid.
endloop.
* endif.
endif.
endif.
loop at screen.
if screen-name <> 'sol_col'.
screen-input = 0.
endif.
modify screen.
endloop.
if itab-vbeln <> ' '.
move sitab-sol_col to sol_col.
endif.
* sigma-top_line = 1.
zvs13-zcland = itab-zcland.
zvs13-zcomtyp = itab-zcomtyp.
zvs13-zlictyp = itab-zlictyp.
zvs13-matnr = itab-matnr.
zvs13-zcomrea = itab-zcomrea.
zvs13-vsbed = itab-vsbed.
zvs13-route = itab-route.
zvs13-vbeln = itab-vbeln.
zvs13-posnr = itab-posnr.
zvs13-kunnr = itab-kunnr.
zvs13-land1 = itab-land1.
zvs13-regio = itab-regio.
zvs13-erdat = itab-erdat.
zvs13-zqueid = itab-zqueid.
zvs13-zohdat = itab-zohdat.
sol_col = itab-chekbox.
* select name1 from kna1 into itab-ame1 "jjjh/dc 04/02/2003
* where kunnr = zvs13-kunnr. "jjjh/dc 04/02/2003
kna1-name1 = itab-name1. "jjjh/dc 04/02/2003
* endselect. "jjjh/dc 04/02/2003
* select single bsark kdgrp from vbkd into (itab-bsark, itab-kdgrp)
* "jjjh/dc 04/02/2003
* where vbeln = itab-vbeln "jjjh/dc 04/02/2003
* and posnr = 000000. "jjjh/dc 04/02/2003
vbkd-bsark = itab-bsark.
vbkd-kdgrp = itab-kdgrp.
vbkd-bstkd = itab-bstkd.
* select single werks from vbap into itab-werks
* where vbeln = itab-vbeln
* and posnr = itab-posnr.
vbap-werks = itab-werks.
* select single lifsp from vbep into itab-lifsp "jjjh/dc 04/02/2003
* where vbeln = itab-vbeln "jjjh/dc 04/02/2003
* and posnr = itab-posnr. "jjjh/dc 04/02/2003
vbep-lifsp = itab-lifsp.
eban-fixkz = itab-fixkz. "$8
fields zvs13-zlictyp.
move zvs13-zlictyp to w_zlictyp.
fields zvs13-zqueid.
move zvs13-zqueid to w_zqueid.
fields zvs13-stonr.
move zvs13-stonr to w_stonr.
fields zvs13-erdat.
move zvs13-erdat to w_erdat.
fields vbcom-audat_bis.
move vbcom-audat_bis to w_erdat1.
fields zvs13-kunnr.
move zvs13-kunnr to w_kunnr.
fields zvs13-vsbed.
move zvs13-vsbed to w_vsbed.
fields zvs13-route.
move zvs13-route to w_route.
fields zvs13-land1.
move zvs13-land1 to w_land1.
fields zvs13-zcland.
move zvs13-zcland to w_zcland.
fields zvs13-regio.
move zvs13-regio to w_regio.
fields zvs13-vbeln.
move zvs13-vbeln to w_vbeln.
fields eban-werks.
move eban-werks to plant.
fields vbap-werks.
move vbap-werks to w_delivering_plant.
fields vbkd-bsark.
move vbkd-bsark to w_ordering_method.
clear: ok_code300.
endmodule. " status_0300 output
*eject
*---------------------------------------------------------------------*
*& form paging
*&---------------------------------------------------------------------*
form paging using code.
data: linno type i,
i type i.
describe table int_zvs13 lines linno.
case code.
when 'frst'. top_line = 1.
when 'prev'.
top_line = top_line - line_count.
if top_line = 0.
top_line = 1.
endif.
when 'next'.
i = top_line + line_count.
linno = linno - line_count + 1.
if linno le 0.
linno = 1.
endif.
if i le linno.
top_line = i.
else.
top_line = linno.
endif.
when 'last'.
top_line = linno - line_count + 1.
if top_line le 0.
top_line = 1.
endif.
endcase.
if exclude_delayed = 'x'.
if int_zvs13-zohdat < sy-datum or
int_zvs13-zohdat = sy-datum and int_zvs13-zohtim < sy-uzeit.
move ' ' to int_zvs13-zohdat.
move ' ' to int_zvs13-zohtim.
endif.
endif.
if include_delayed = 'x'.
if int_zvs13-zohdat < sy-datum or
int_zvs13-zohdat = sy-datum and int_zvs13-zohtim < sy-uzeit.
move ' ' to int_zvs13-zohdat.
move ' ' to int_zvs13-zohtim.
endif.
endif.
if vbak-vbeln < c_purchase_requisition_high and " purchase requisition
vbak-vbeln >= c_purchase_requisition_low.
select single * from eban
where banfn = int_zvs13-vbeln
and bnfpo = int_zvs13-posnr.
if sy-subrc = 0.
vbap-kwmeng = eban-menge.
vbap-netpr = eban-preis.
endif.
else.
select netpr from vbap into int_zvs13-netpr
where vbeln = int_zvs13-vbeln and
posnr = int_zvs13-posnr.
vbap-netpr = int_zvs13-netpr.
endselect.
select kwmeng from vbap into int_zvs13-kwmeng
where vbeln = int_zvs13-vbeln and
posnr = int_zvs13-posnr.
vbap-kwmeng = int_zvs13-kwmeng.
endselect.
select * from vbep where vbeln = int_zvs13-vbeln and
posnr = int_zvs13-posnr.
if int_zvs13-kwmeng > vbep-bmeng.
move 'x' to bmeng.
endif.
endselect.
endif.
if int_zvs13-zqueid = 'keyword'.
zvs01t-zcomdes = int_zvs13-zkeywrd.
else.
select zcomdes from zvs01t into comp_type_description
where zcomtyp = int_zvs13-zcomtyp.
zvs01t-zcomdes = comp_type_description.
endselect.
endif.
vbak-vbeln = int_zvs13-vbeln.
zvs13-matnr = int_zvs13-matnr.
zvs13-zcomtyp = int_zvs13-zcomtyp.
zvs13-zlictyp = int_zvs13-zlictyp.
zvs13-route = int_zvs13-route.
zvs13-posnr = int_zvs13-posnr.
zvs13-erdat = int_zvs13-erdat.
zvs13-zqueid = int_zvs13-zqueid.
zvs13-zohdat = int_zvs13-zohdat.
zvs13-zohtim = int_zvs13-zohtim.
zvs13-zseqno = int_zvs13-zseqno.
zvs14t-zcomrea = int_zvs13-zcomrea.
checkbox = citab-checkbox.
checkbox = int_zvs13-checkbox.
if sy-ucomm = 'rlse'.
describe table chk_tab lines lin_no.
if num1 > 1.
perform furl.
endif.
endif.
if sy-ucomm = 'exec' or
sy-ucomm = 'ente'.
perform top_part_of_screen.
endif.
*----------------------------------------------------------------------*
* this is for next order, more(details),furt(delay), pushbuttons ------*
*----------------------------------------------------------------------*
if sy-ucomm = 'more' or
sy-ucomm = 'furt' or
sy-ucomm = 'neor'.
if chk_tab-chekbox = 'x'.
move chk_tab-vbeln to vbak-vbeln.
else.
if sy-ucomm = 'furt'.
else.
move chk_tab1-vbeln to vbak-vbeln .
endif.
endif.
perform header.
perform bottom_screen.
endif.
endmodule. " display_order_header output
*&---------------------------------------------------------------------*
*& module get_300 input
*&---------------------------------------------------------------------*
module get_300 input.
line_count = sy-loopc.
endmodule. " get_300 input
*&---------------------------------------------------------------------*
*& module user_command_0300 input
*&---------------------------------------------------------------------*
module user_command_0300 input.
data: compliance_country like zvs20-zcland,
license_type like zvs20-zlictyp,
partner_function like vbpa-parvw,
customer_number like zvs20-kunnr.
case: ok_code300.
when 'exit'.
perform exit.
set screen 0.
leave screen.
when 'back'.
perform back.
set screen 200.
leave screen.
when 'canc'.
perform canc.
set screen 200.
leave screen.
when 'neor'.
perform neor using 'neor'.
when 'sele'.
perform mark_all.
when 'dese'.
perform delete_all_marks.
clear ok_code300.
when 'comt'.
clear fcode.
perform comment.
when 'frst'.
perform paging using 'frst'.
when 'prev'.
perform paging using 'prev'.
when 'next'.
perform paging using 'next'.
when 'last'.
perform paging using 'last'.
when 'dela'.
perform delay.
if sy-ucomm = 'cont' or
sy-ucomm = 'canc'.
perform secu_delay.
else.
perform else.
endif.
when 'disp'.
perform display.
when 'chan'.
perform change.
when 'ques'.
perform ques.
when 'ship'.
clear int_ship.
refresh int_ship.
select *
from zvs13
into table int_ship
where vbeln = vbak-vbeln
and posnr = 000000
and stonr = 30.
loop at int_ship.
endloop.
if int_ship-posnr = '000000' and
int_ship-stonr = 30.
call screen 700 starting at 11 06 ending at 50 13.
else.
select * from zvs24t
where zpopup = 'shippable'
and spras = sy-langu.
endselect.
if sy-subrc = 0.
move zvs24t-zpopdes to popup_text1.
move zvs24t-zpopdes+35(35) to popup_text2.
else.
move 'do you want to ship' to popup_text1.
move 'the remaining items ?' to popup_text2.
endif.
when 'rlse'.
perform check.
perform update_header_status.
if sy-ucomm = 'cont'.
loop at int_zvs13.
move ' ' to int_zvs13-checkbox.
modify int_zvs13.
move int_zvs13-checkbox to citab-checkbox.
append citab.
endloop.
set screen 300.
leave screen.
else.
* perform proc_creditcrd_new.
* perform proc_creditcrd.
perform mian.
endif.
when 'view'.
perform view_released_orders.
when 'cust'.
************************************************************************
************************************************************************
************************************************************************
************************************************************************
* authority check included by rjb as per ur-pha-03-00036
authority-check object 's_tcode'
id 'tcd' field 'xd02'.
if sy-subrc <> 0.
message w000 with
'you have no authority to change the customer master'.
perform customer_transaction_xd03.
clear ok_code300.
else.
************************************************************************
************************************************************************
************************************************************************
************************************************************************
perform customer_transaction_xd02.
clear ok_code300.
endif.
when 'zv20'.
perform link_to_threshold_viewing.
when 'zreg'.
perform link_to_license_set_up.
endcase.
endmodule. " user_command_0300 input
*&---------------------------------------------------------------------*
*& module user_command_0400 input
*&---------------------------------------------------------------------*
module user_command_0400 input.
case ok_code400.
when 'back'.
if fcode = ' '.
perform scr_400_back.
else.
perform release_scr_400_back.
endif.
when 'exit'.
if fcode = ' '.
perform scr_400_exit.
else.
perform release_scr_400_back.
endif.
when 'canc'.
if fcode = ' '.
set screen 300.
leave screen.
else.
set screen 800.
leave screen.
endif.
when 'next'.
if fcode = ' '.
perform next using 'next'.
else.
perform released_order_next using 'next'.
endif.
endcase.
endmodule. " user_command_0400 input
*&---------------------------------------------------------------------*
*& form mark_all
*&---------------------------------------------------------------------*
* checkboxes selection
*----------------------------------------------------------------------*
form mark_all.
refresh citab.
loop at int_zvs13.
move 'x' to int_zvs13-checkbox.
modify int_zvs13.
move int_zvs13-checkbox to citab-checkbox.
append citab.
endloop.
endform. " mark_all
*&---------------------------------------------------------------------*
*& form delete_all_marks
*&---------------------------------------------------------------------*
* delesecting the checkboxes
*&---------------------------------------------------------------------*
form delete_all_marks.
loop at int_zvs13.
move ' ' to int_zvs13-checkbox.
modify int_zvs13.
move int_zvs13-checkbox to citab-checkbox.
append citab.
endloop.
endform. " delete_all_marks
*&---------------------------------------------------------------------*
*& form select
*&---------------------------------------------------------------------*
form select.
refresh sitab.
loop at itab.
move 'x' to itab-chekbox. "sol_col.
modify itab.
move itab-chekbox to sitab-sol_col.
append sitab.
endloop.
endform. " select
*&---------------------------------------------------------------------*
*& form deselect
*&---------------------------------------------------------------------*
form deselect.
loop at itab.
move ' ' to itab-chekbox. "sol_col.
modify itab.
move itab-chekbox to sitab-sol_col.
append sitab.
endloop.
endform. " deselect
*&---------------------------------------------------------------------*
*& form get_page_count
*&---------------------------------------------------------------------*
include zvuaquem.
*&---------------------------------------------------------------------*
*& module check_stonr input
*&---------------------------------------------------------------------*
module check_stonr input.
if zvs13-stonr = itab-stonr.
endif.
endmodule. " check_stonr input
*&---------------------------------------------------------------------*
*& form next
*&---------------------------------------------------------------------*
form next using ccode.
describe table ck_tab lines lin_no.
* case ccode.
* describe table ck_tab lines lin_no.
if numr < lin_no.
numr = numr + 1.
if numr > 1.
endif.
read table ck_tab index numr.
else.
loop at int_zvs13.
move ' ' to int_zvs13-checkbox.
modify int_zvs13.
move int_zvs13-checkbox to citab-checkbox.
append citab.
endloop.
set screen 300. leave screen.
endif.
* endcase.
endform. " next
*&---------------------------------------------------------------------*
*& module modify_itab input
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
module modify_itab input.
ind = sigma-current_line + sy-stepl - 1.
modify itab index ind.
endmodule. " modify_itab input
*&---------------------------------------------------------------------*
*& module set_line_count output
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
module set_line_count output.
* base = sy-loopc + 1.
endmodule. " set_line_count output
*&---------------------------------------------------------------------*
*& module proc-marked input
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
module proc-marked input.
if sy-ucomm = 'back'.
clear sitab.
endif.
clear chk_tab.
clear chk_tab1.
bas = sy-loopc + 1.
num = bas - sy-loopc + sigma-top_line - 1.
read table itab index num.
if sol_col = 'x'.
move 'x' to itab-chekbox.
modify itab index num.
else.
move ' ' to itab-chekbox.
modify itab index num.
endif.
endmodule. " proc-marked input
*&---------------------------------------------------------------------*
*& module proc-marked1 input
*&---------------------------------------------------------------------*
* *
*----------------------------------------------------------------------*
module proc-marked1 input.
clear ck_tab.
bas = sy-loopc + 1.
describe table int_zvs13 lines linno.
num = bas - sy-loopc + top_line - 1.
if checkbox = 'x'.
move 'x' to int_zvs13-checkbox.
modify int_zvs13 index num.
else.
move ' ' to int_zvs13-checkbox.
modify int_zvs13 index num.
endif.
endmodule. " proc-marked1 input
*eject
*&---------------------------------------------------------------------*
*& form check
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
* checking of user profile to release and updating of table zvs13 when
* the order is being released
*----------------------------------------------------------------------*
form check.
refresh ck_tab.
loop at int_zvs13.
if int_zvs13-checkbox = 'x'.
move 'n' to has_security.
select single * from zvs48
where zcland = int_zvs13-zcland and
uname = sy-uname and
zqueid = int_zvs13-zqueid.
if sy-subrc <> 0.
select * from zvs48 into table int_zvs48
where uname = sy-uname and
zqueid = int_zvs13-zqueid.
if sy-subrc = 0.
loop at int_zvs48.
select single * from zvs07
where zctygrp = int_zvs48-zcomgrp and
zland = int_zvs13-zcland.
if sy-subrc = 0.
move 'y' to has_security.
endif.
endloop.
endif.
else.
move 'y' to has_security.
endif.
if has_security = 'y'.
perform check_sales_order_stock.
if lin_no > 0.
move ' ' to int_zvs13-checkbox.
modify int_zvs13.
continue.
endif.
move-corresponding int_zvs13 to ck_tab.
append ck_tab.
else.
call screen 500 starting at 11 06 ending at 50 13.
endif.
endif.
endloop.
loop at ck_tab.
* "purchase requisition
if ck_tab-vbeln < c_purchase_requisition_high and
ck_tab-vbeln >= c_purchase_requisition_low.
perform requisition_strategy_release
using ck_tab-vbeln ck_tab-posnr.
if sy-subrc <> 0. " strategy not released
continue. " do not update zvs13
endif.
endif.
if ck_tab-stonr = 20 or
ck_tab-stonr = 30 or
ck_tab-stonr = 50.
update zvs13 set stonr = 40
name1_gp = sy-uname
zabdat = sy-datum
aenam = sy-uname
laeda = sy-datum
lauhr = sy-uzeit
zabtim = sy-uzeit
where zcland = ck_tab-zcland and
zcomrea = ck_tab-zcomrea and
zcomgrp = ck_tab-zcomgrp and
vbeln = ck_tab-vbeln and
zseqno = ck_tab-zseqno and
posnr = ck_tab-posnr and
zcomtyp = ck_tab-zcomtyp and
zlictyp = ck_tab-zlictyp.
if sy-subrc = 0.
perform check_line_item_comp_reasons.
endif.
endif.
endloop.
endform. "check
*eject
*---------------------------------------------------------------------*
* form check_sales_order_stock *
*---------------------------------------------------------------------*
form check_sales_order_stock.
tables: ebkn.
clear lin_no.
select single *
from eban
where banfn = int_zvs13-vbeln
and bnfpo = int_zvs13-posnr.
check sy-subrc = 0.
select single *
from ebkn
where banfn = eban-banfn
and bnfpo = eban-bnfpo.
if sy-subrc = 0.
ws_vbeln = ebkn-vbeln.
ws_posnr = ebkn-vbelp.
endif.
if ws_vbeln is initial or
ws_posnr is initial.
exit.
endif.
** if it's b2b order with wbna user status then display message
* if ws_wbna_status = 'x'. "$4
* move 1 to lin_no. "$4
* endif. "$4
endform. "check_sales_order_stock
*eject
*---------------------------------------------------------------------*
* form release_requisition_sos_block *
*---------------------------------------------------------------------*
form release_requisition_sos_block.
select single *
from vbap
where vbeln = int_zvs13-vbeln
and posnr = ck_tab-posnr.
check sy-subrc = 0.
* don't proceed with this check if this is a short shelf life product"$6
* i.e. genosys because this is also knttp = 'e'. "$6
read table t_zgenpstyvheadblk "$6
with key pstyv = vbap-pstyv. "$6
select *
from vbep
into table xvbep
where vbeln = vbap-vbeln
and posnr = vbap-posnr.
* find the tvep entry for the schedule line item category
loop at xvbep.
if xvbep-banfn is initial or
xvbep-bnfpo is initial.
continue.
endif.
update zvs13
set stonr = 40
name1_gp = sy-uname
zabdat = sy-datum
aenam = sy-uname
laeda = sy-datum
lauhr = sy-uzeit
zabtim = sy-uzeit
where zcland = w_zcland "$10
and vbeln = xvbep-banfn
and posnr = xvbep-bnfpo
and zqueid = 'sosblock'
and stonr = 30.
endloop.
endform. "release_requisition_sos_block
*eject
*---------------------------------------------------------------------*
* form release_third_party_sos_block *
*---------------------------------------------------------------------*
form release_third_party_sos_block. "$4
* "$4
if vbak-vbeln < c_purchase_requisition_high and " purchase requisition
"$4
vbak-vbeln >= c_purchase_requisition_low. "$4
exit. "$4
endif. "$4
* "$4
select * from vbep into table xvbep "$4
where vbeln = vbak-vbeln. "$4
loop at xvbep. "$4
* "$4
if xvbep-banfn is initial or "$4
xvbep-bnfpo is initial. "$4
continue. "$4
endif. "$4
* "$4
select single * from tvep "$4
where pstyp = '5' "$4third party item category
and ettyp = xvbep-ettyp. "$4schedule line category
check sy-subrc = 0. "$4third party item
* "$4
select single * from eban where banfn = xvbep-banfn "$4
and bnfpo = xvbep-bnfpo. "$4
check sy-subrc = 0. "$4
* "$4
update zvs13 "$4
set stonr = 40 "$4
name1_gp = sy-uname "$4
zabdat = sy-datum "$4
aenam = sy-uname "$4
laeda = sy-datum "$4
lauhr = sy-uzeit "$4
zabtim = sy-uzeit "$4
* removed check for specific zcland "$4
where vbeln = xvbep-banfn "$4
and posnr = xvbep-bnfpo "$4
and zqueid = 'sosblock' "$4
and stonr = 30. "$4
* "$4
* if pruchase requisition is deleted then no need to release it "$4
check eban-loekz is initial. "$4
* "$4
* if there is no zvs13 entry with queuid 'sosblock' created "$4
* then that means the item must have failed the pr screening "$4
* and will still have other zvs13 entries not released. "$4
* therefore, do not release pr strategy at this point. "$4
if sy-subrc = 0. "$4
perform requisition_strategy_release using xvbep-banfn "$4
xvbep-bnfpo. "$4
endif. "$4
perform unlock_purchase_requisition. "$4
* "$4
endloop. "$4
* "$4
endform. "release_third_party_sos_block "$4
*eject "$4
*---------------------------------------------------------------------*
* form check_third_party_sos_block *
*---------------------------------------------------------------------*
form check_third_party_sos_block. "$4
select *
from zvs13
into table item_zvs13
where vbeln = vbak-vbeln
and posnr = ck_tab-posnr.
move 'x' to update_item_status.
loop at item_zvs13.
if item_zvs13-stonr = 20 or
item_zvs13-stonr = 30.
move ' ' to update_item_status.
continue.
endif.
endloop.
if update_item_status = 'x'.
perform lock_sales_document.
perform update_line_item_status.
perform unlock_sales_document.
perform release_requisition_sos_block.
* now look at the materials that have short shelf life i.e. genosys
* so we do not release the pr until header level screening is ok
perform release_requisition_sls_block. "$6
endif.
endform. "check_line_item_comp_reasons
*eject
*---------------------------------------------------------------------*
* form requisition_strategy_release *
*---------------------------------------------------------------------*
form requisition_strategy_release using ws_banfn ws_bnfpo.
select *
from zvs13
into table item_zvs13
where vbeln = ws_banfn
and posnr = ws_bnfpo
and stonr = 30.
describe table item_zvs13 lines lin_no.
if lin_no > 1. " not all released
* if sy-subrc = 0. " not all released
exit. " do not release strategy
endif.
endform. "requisition_strategy_release
*eject
*---------------------------------------------------------------------*
* form lock_sales_document *
*---------------------------------------------------------------------*
form lock_sales_document.
call function 'enqueue_evvbake'
exporting
vbeln = vbak-vbeln
exceptions
foreign_lock = 2
system_failure = 3.
endform. "lock_sales_document
*eject
*---------------------------------------------------------------------*
* form lock_purchase requisition *
*---------------------------------------------------------------------*
form lock_purchase_requisition.
data: ws_bnfpo like eban-bnfpo.
move int_zvs13-posnr to ws_bnfpo.
call function 'enqueue_emebane'
exporting
banfn = vbak-vbeln
bnfpo = ws_bnfpo
exceptions
foreign_lock = 2
system_failure = 3.
case sy-subrc.
when '0000'.
perform unlock_purchase_requisition.
when '0002'.
message e006(me) with sy-msgv1 'purch. requisition' vbak-vbeln
space.
move 'n' to has_security.
when '0003'.
message e007(me) with text-005 vbak-vbeln.
move 'n' to has_security.
when others.
move 'n' to has_security.
endcase.
endform. "lock_purchase_requisition
*eject
*---------------------------------------------------------------------*
* form unlock_sales_document *
*---------------------------------------------------------------------*
form unlock_sales_document.
call function 'dequeue_evvbake'
exporting
vbeln = vbak-vbeln.
endform. "unlock_sales_document
*eject
*---------------------------------------------------------------------*
* form unlock_purhase requisition *
*---------------------------------------------------------------------*
form unlock_purchase_requisition.
data: ws_bnfpo like eban-bnfpo.
move int_zvs13-posnr to ws_bnfpo.
call function 'dequeue_emebane'
exporting
banfn = vbak-vbeln
bnfpo = ws_bnfpo.
endform. "unlock_purchase_requisition
*eject
*---------------------------------------------------------------------*
* form update_line_item_status *
*---------------------------------------------------------------------*
form update_line_item_status.
if ck_tab-posnr = '000000'.
exit.
endif.
concatenate 'vb' vbak-vbeln ck_tab-posnr into object_number.
perform get_change_number.
move 'x' to update_item_status.
select * from jest into table *jest
where objnr = object_number and
inact = ' '.
if sy-subrc = 0.
loop at *jest.
if *jest-stat = 'e0005'.
move ' ' to update_item_status.
endif.
if *jest-stat = 'e0002' or
*jest-stat = 'e0003' or
*jest-stat = 'e0001'.
move 'x' to *jest-inact.
modify *jest.
endif.
endloop.
if update_item_status = 'x'.
move object_number to *jest-objnr.
move 'e0004' to *jest-stat.
move ' ' to *jest-inact.
move change_number to *jest-chgnr.
append *jest.
endif.
modify jest from table *jest.
endif.
perform update_jcds.
endform. "update_line_item_status
*eject
*---------------------------------------------------------------------*
* form update_jcds *
*---------------------------------------------------------------------*
form update_jcds.
select * from jcds into table *jcds
where objnr = object_number and
inact = ' '.
if sy-subrc = 0.
loop at *jcds.
if *jcds-stat = 'e0002' or
*jcds-stat = 'e0003' or
*jcds-stat = 'e0004' or
*jcds-stat = 'e0001'.
move 'x' to *jcds-inact.
modify *jcds.
endif.
endloop.
move object_number to *jcds-objnr.
move 'e0004' to *jcds-stat.
move ' ' to *jcds-inact.
move change_number to *jcds-chgnr.
move sy-uname to *jcds-usnam.
move sy-datum to *jcds-udate.
move sy-uzeit to *jcds-utime.
move sy-tcode to *jcds-tcode.
move 'u' to *jcds-chind.
append *jcds.
modify jcds from table *jcds.
endif.
endform. "update_jcds
*eject
*&---------------------------------------------------------------------*
*& form update_header_status
*&---------------------------------------------------------------------*
* change of header status to sc0k
*&---------------------------------------------------------------------*
form update_header_status.
if vbak-vbeln < c_purchase_requisition_high and " purchase requisition
vbak-vbeln >= c_purchase_requisition_low.
loop at ck_tab.
delete itab where vbeln = ck_tab-vbeln
and posnr = ck_tab-posnr
and zcomrea = ck_tab-zcomrea
and zqueid = ck_tab-zqueid
and zcland = ck_tab-zcland
and zcomgrp = ck_tab-zcomgrp
and zcomtyp = ck_tab-zcomtyp
and zlictyp = ck_tab-zlictyp.
endloop.
exit.
endif.
select *
from zvs13
into table item_zvs13
where vbeln = vbak-vbeln.
move 'x' to update_header_status.
loop at item_zvs13.
if ( ( item_zvs13-stonr = 20 ) or
( item_zvs13-stonr = 30 ) ) and
( item_zvs13-zcomrea <> 57 ) and
( item_zvs13-zcomrea <> 61 ) and
( item_zvs13-zcomrea <> 62 ) and
( item_zvs13-zcomrea <> 63 ) and
( item_zvs13-zcomrea <> 65 ).
move ' ' to update_header_status.
exit.
endif.
endloop.
if update_header_status = 'x'.
* this sosblock refers to the name of the block and is not limited to
* sales order stock. e.g. mayflower and genosys products are included
* if a sales order has a screening block then we do not want the
* corresponding purchase requisition to be available so we artifically
* apply an "sosbli=ock" to the pr item that eventually has to be
* released automaticlaly rather than by a user. this release is
* happening here if all relevant conditions are satisfied.
endif.
if *zvs50-vbeln = vbak-vbeln.
delete *zvs50 where vbeln = vbak-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = vbak-vbeln and ernam = sy-uname.
endif.
loop at *zvs50.
if *zvs50-vbeln = int_zvs13-vbeln.
delete *zvs50 where vbeln = int_zvs13-vbeln and ernam = sy-uname.
delete from zvs50 where vbeln = int_zvs13-vbeln and ernam = sy-uname.
endif.
endloop.
describe table chk_tab lines lin_no.
if num1 < lin_no.
num1 = num1 + 1.
if num1 > 1.
endif.
read table chk_tab index num1.
else.
loop at itab.
if *zvs50-vbeln = vbak-vbeln.
delete *zvs50 where vbeln = vbak-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = vbak-vbeln and ernam = sy-uname.
endif.
loop at *zvs50.
if *zvs50-vbeln = int_zvs13-vbeln.
delete *zvs50 where vbeln = int_zvs13-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = int_zvs13-vbeln and ernam = sy-uname.
endif.
endloop.
* loop at itab.
move ' ' to itab-chekbox.
modify itab.
move itab-chekbox to sitab-sol_col.
append sitab.
endloop.
set screen 200.
leave screen.
endif.
* endcase.
endform. " neor
*&---------------------------------------------------------------------*
*& form change
*&---------------------------------------------------------------------*
form change.
* if vbak-vbeln < c_delivery_low. "$12
" purchase requisition
if vbak-vbeln < c_purchase_requisition_high and
vbak-vbeln >= c_purchase_requisition_low.
set parameter id 'ban' field vbak-vbeln.
call transaction 'me52n' and skip first screen.
else.
clear seenu.
refresh seenu.
select * from vbak into table seenu where vbeln = vbak-vbeln.
loop at seenu.
endloop.
if seenu-vbeln = ' '.
clear field.
concatenate 'document' vbak-vbeln 'does not exist' into field
separated by ' '.
call function 'popup_to_display_text'
exporting
titel = 'order screening - queue management'
textline1 = field
exceptions
others = 1.
else.
if seenu-vbtyp = 'c'.
set parameter id 'aun' field vbak-vbeln.
call transaction 'va02' and skip first screen.
endif.
if seenu-vbtyp = 'e'.
set parameter id 'lpn' field vbak-vbeln.
call transaction 'va32' and skip first screen.
endif.
if seenu-vbtyp = 'b'.
set parameter id 'aun' field vbak-vbeln.
call transaction 'va22' and skip first screen.
endif.
call function 'addr_memory_clear'
exporting
force = 'x'
exceptions
unsaved_data_exist = 1
internal_error = 2
others = 3.
clear sy-subrc.
do 10000 times.
call function 'sd_sales_document_enqueue'
exporting
vbeln = vbak-vbeln
exceptions
foreign_lock = 1
system_failure = 2
others = 3.
if sy-subrc = 0.
call function 'dequeue_evvbake'
exporting
mandt = sy-mandt
vbeln = vbak-vbeln
_collect = ' '.
clear sy-subrc.
exit.
endif.
enddo.
endif.
endif.
* else. "$12
* clear seenu1. "$12
* select * from likp into table seenu1 where vbeln = vbak-vbeln. "$12
* loop at seenu1. "$12
* endloop. "$12
* if seenu1-vbtyp = 'j'. "$12
* call transaction 'vl02n' and skip first screen. "$12
* endif. "$12
* endif. "$12
endform. " change
*&---------------------------------------------------------------------*
*& form disp
*&---------------------------------------------------------------------*
form display.
clear seenu.
* if vbak-vbeln < c_delivery_low. "$12
" purchase requisition
if vbak-vbeln < c_purchase_requisition_high and
vbak-vbeln >= c_purchase_requisition_low.
set parameter id 'ban' field vbak-vbeln.
call transaction 'me53n' and skip first screen.
else.
select * from vbak into table seenu where vbeln = vbak-vbeln.
loop at seenu.
endloop.
if seenu-vbeln = ' '.
clear field.
concatenate 'document' vbak-vbeln 'does not exist' into field
separated by ' '.
call function 'popup_to_display_text'
exporting
titel = 'order screening - queue management'
textline1 = field
exceptions
others = 1.
else.
if seenu-vbtyp = 'c' or seenu-vbtyp = 'i'.
set parameter id 'aun' field vbak-vbeln.
call transaction 'va03' and skip first screen.
endif.
if seenu-vbtyp = 'e'.
set parameter id 'lpn' field vbak-vbeln.
call transaction 'va33' and skip first screen.
endif.
if seenu-vbtyp = 'b'.
set parameter id 'aun' field vbak-vbeln.
call transaction 'va23' and skip first screen.
endif.
endif.
endif.
* else. "$12
* select * from likp into table seenu1 where vbeln = vbak-vbeln. "$12
* loop at seenu1. "$12
* endloop. "$12
* if seenu1-vbtyp = 'j'. "$12
* call transaction 'vl03' and skip first screen. "$12
* endif. "$12
* endif. "$12
endform. "shippable
*&---------------------------------------------------------------------*
*& module user_command_0500 input
*&---------------------------------------------------------------------*
module user_command_0500 input.
if sy-ucomm = 'cont' or
sy-ucomm = 'canc'.
set screen 0.
leave screen.
endif.
endmodule. " user_command_0500 input
*&---------------------------------------------------------------------*
*& module status_0500 output
*&---------------------------------------------------------------------*
module status_0500 output.
set pf-status '500'.
set titlebar 'q50'.
if chk_tab-chekbox = 'x'.
move chk_tab-vbeln to vbak-vbeln.
clear kna1-name1.
clear kna1-name2.
clear kna1-name3.
clear kna1-name4.
clear kna1-ort01.
clear kna1-stras.
clear kna1-regio.
clear kna1-land1.
clear kna1-pstlz.
refresh ktab.
refresh ktab1.
clear name1.
clear name2.
clear name3.
clear name4.
clear ort01.
clear stras.
clear regio.
clear land.
clear pstlz.
select * from kna1 into table ktab
where kunnr = kna1-kunnr.
if sy-subrc = 0.
loop at ktab.
move ktab-name1 to kna1-name1.
move ktab-name2 to kna1-name2.
move ktab-name3 to kna1-name3.
move ktab-name4 to kna1-name4.
move ktab-ort01 to kna1-ort01.
move ktab-stras to kna1-stras.
move ktab-regio to kna1-regio.
move ktab-land1 to kna1-land1.
move ktab-pstlz to kna1-pstlz.
endloop.
else.
clear ktab.
endif.
refresh ktab2.
* refresh ksadr.
select *
from vbpa
into table vbpa1
where vbeln = vbak-vbeln
and posnr = '000000' "$14
and parvw = 'ap'.
sy-subrc = 4. "$2
if sy-subrc <> 0 .
select *
from vbpa
into table vbpa1
where vbeln = vbak-vbeln
and posnr = '000000' "$14
and parvw = 'we'.
if sy-subrc <> 0.
select * from kna1 into table ktab2
where kunnr = kna1-kunnr.
loop at ktab2.
move ktab2-name1 to name1.
move ktab2-name2 to name2.
move ktab2-name3 to name3.
move ktab2-name4 to name4.
move ktab2-ort01 to ort01.
move ktab2-regio to regio.
move ktab2-land1 to w_land1.
move ktab2-pstlz to pstlz.
endloop.
else.
* refresh ksadr.
loop at vbpa1.
perform get_sadr_address using vbpa1-adrnr.
* select * from sadr into table ksadr
* where adrnr = vbpa1-adrnr.
endloop.
if vbpa1-adrnr is initial.
select * from kna1 into table ktab2
where kunnr = vbak-kunnr.
loop at ktab2.
move ktab2-name1 to name1.
move ktab2-name2 to name2 .
move ktab2-name3 to name3 .
move ktab2-name4 to name4 .
move ktab2-ort01 to ort01 .
move ktab2-stras to stras .
move ktab2-regio to regio.
move ktab2-land1 to land.
move ktab2-pstlz to pstlz.
endloop.
else.
* loop at ksadr.
move ksadr-name1 to name1.
move ksadr-name2 to name2.
move ksadr-name3 to name3.
move ksadr-name4 to name4.
move ksadr-ort01 to ort01.
move ksadr-stras to stras.
move ksadr-regio to regio.
move ksadr-land1 to land.
move ksadr-pstlz to pstlz.
* endloop.
endif.
endif.
else.
perform contact_person_address.
endif.
if w_zqueid is initial and
w_zcland is initial.
select *
from zvs13
into table int_zvs13
where ( vbeln = vbak-vbeln )
and stonr <> 40
and stonr <> 50.
elseif not w_zqueid is initial.
select *
from zvs13
into table int_zvs13
where ( vbeln = vbak-vbeln )
and stonr <> 40
and stonr <> 50
and zqueid = w_zqueid.
elseif not w_zcland is initial.
select *
from zvs13
into table int_zvs13
where ( vbeln = vbak-vbeln )
and stonr <> 40
and stonr <> 50
and ( zcland = w_zcland ).
endif.
endif.
endform. " furl
*eject
*&---------------------------------------------------------------------*
*& form record_change
*&---------------------------------------------------------------------*
* when there is a change made in va02 then you see the added records
* in the review screen.
*----------------------------------------------------------------------*
form record_change.
if vbak-vbeln < c_purchase_requisition_high and " purchase requisition
vbak-vbeln >= c_purchase_requisition_low.
exit.
endif.
select *
from vbpa
into corresponding fields of table t_vbpa
where vbeln = vbak-vbeln
and posnr = '000000'.
loop at t_vbpa.
if t_vbpa-parvw = 'ag'.
move t_vbpa-kunnr to kna1-kunnr.
elseif t_vbpa-parvw = 'we'.
move t_vbpa-kunnr to vbak-kunnr.
endif.
endloop.
clear kna1-name1.
clear kna1-name2.
clear kna1-name3.
clear kna1-name4.
clear kna1-ort01.
clear kna1-stras.
clear kna1-regio.
clear kna1-land1.
clear kna1-pstlz.
refresh ktab.
refresh ktab1.
clear name1.
clear name2.
clear name3.
clear name4.
clear ort01.
clear stras.
clear regio.
clear land.
clear pstlz.
select * from kna1 into table ktab
where kunnr = kna1-kunnr.
if sy-subrc = 0.
select single *
from vbpa
where vbeln = vbak-vbeln
and parvw = 'ag'
and posnr = '000000'.
if sy-subrc = 0 and
ktab-adrnr = vbpa-adrnr. "check whether the address has changed
loop at ktab.
move ktab-name1 to kna1-name1.
move ktab-name2 to kna1-name2.
move ktab-name3 to kna1-name3.
move ktab-name4 to kna1-name4.
move ktab-ort01 to kna1-ort01.
move ktab-stras to kna1-stras.
move ktab-regio to kna1-regio.
move ktab-land1 to kna1-land1.
move ktab-pstlz to kna1-pstlz.
endloop.
endif.
else.
clear ktab.
endif.
else.
*if sy-subrc is false then get the adrnr and parnr from vbpa by passing th vbeln
and parvw.
select adrnr parnr
from vbpa
into corresponding fields of table t_vbpa2
where vbeln = vbak-vbeln
and parvw = 'ap'.
select *
from adr6
into corresponding fields of table t_adr6
for all entries in t_vbpa2
where addrnumber = t_vbpa2-adrnr.
endif.
if not t_adr6[] is initial.
select *
from adr6
into corresponding fields of table t_adr61
for all entries in t_knvk
where persnumber = t_knvk-prsnr.
endif.
loop at t_adr6.
read table t_adr61 with key addrnumber = t_adr6-addrnumber persnumber
= t_adr6-persnumber.
if sy-subrc <> 0.
delete t_adr6.
endif.
move t_adr6-smtp_addr to adr6-smtp_addr.
endloop.
*if we look for the e-mail address for the ship-to, the program only
*needs to access adr6 with the address number of the ship-to from the
*order.
select adrnr
from vbpa
into corresponding fields of table it_vbpa002
where vbeln = vbak-vbeln
and parvw = 'we'.
if not it_vbpa002[] is initial.
select smtp_addr
from adr6
into corresponding fields of table it_adr6
for all entries in it_vbpa002
where addrnumber = it_vbpa002-adrnr
and persnumber = space.
endif.
endif.
loop at it_adr6.
* read table it_adr6 with key addrnumber = it_vbpa002-adrnr.
* if sy-subrc <> 0.
* delete it_adr6.
* endif.
move it_adr6-smtp_addr to adr6-smtp_addr.
endloop.
endif.
* end of changes "$16
endif.
endif.
refresh ktab2.
* refresh ksadr.
select *
from vbpa
into table vbpa1
where vbeln = vbak-vbeln
and posnr = '000000' "$14
and parvw = 'ap'.
sy-subrc = 4. "$2
if sy-subrc <> 0.
select *
from vbpa
into table vbpa1
where vbeln = vbak-vbeln
and posnr = '000000' "$14
and parvw = 'we'.
if sy-subrc <> 0.
select * from kna1 into table ktab2
where kunnr = vbak-kunnr.
loop at ktab2.
move ktab2-name1 to name1.
move ktab2-name2 to name2.
move ktab2-name3 to name3.
move ktab2-name4 to name4.
move ktab2-ort01 to ort01.
move ktab2-regio to regio.
move ktab2-land1 to w_land1.
move ktab2-pstlz to pstlz.
endloop.
else.
* refresh ksadr.
loop at vbpa1.
perform get_sadr_address using vbpa1-adrnr.
* select * from sadr into table ksadr
* where adrnr = vbpa1-adrnr.
endloop.
if vbpa1-adrnr is initial.
select * from kna1 into table ktab2
where kunnr = vbak-kunnr.
loop at ktab2.
move ktab2-name1 to name1.
move ktab2-name2 to name2.
move ktab2-name3 to name3.
move ktab2-name4 to name4.
move ktab2-ort01 to ort01.
move ktab2-stras to stras.
move ktab2-regio to regio.
move ktab2-land1 to land.
move ktab2-pstlz to pstlz.
endloop.
else.
* loop at ksadr.
move ksadr-name1 to name1.
move ksadr-name2 to name2.
move ksadr-name3 to name3.
move ksadr-name4 to name4.
move ksadr-ort01 to ort01.
move ksadr-stras to stras.
move ksadr-regio to regio.
move ksadr-land1 to land.
move ksadr-pstlz to pstlz.
* endloop.
endif.
* start of insertion "$16
***********************************************************
** it will write the email-id if the flagcomm6 = yes
**********************************************************
* call function 'addr_comm_get'
* exporting
* address_number = vbpa1-adrnr
** date_from = '00010101'
* language = sy-langu
* table_type = 'adsmtp'
** importing
** returncode =
* tables
* comm_table = int_adr6
* exceptions
* parameter_error = 1
* address_not_exist = 2
* internal_error = 3
* others = 4
* .
* if sy-subrc <> 0.
* endif.
* read table int_adr6 index 1.
* move int_adr6-smtp_addr to adr6-smtp_addr.
* end of insertion "$16
* start of changes "$16
select *
from vbpa
into corresponding fields of table t_vbpa10
where vbeln = vbak-vbeln
and parvw = 'ag'.
else.
*if sy-subrc is false then get the adrnr and parnr from vbpa by passing th vbeln
and parvw.
select adrnr parnr
from vbpa
into corresponding fields of table t_vbpa2
where vbeln = vbak-vbeln
and parvw = 'ap'.
select *
from adr6
into corresponding fields of table t_adr6
for all entries in t_vbpa2
where addrnumber = t_vbpa2-adrnr.
endif.
if not t_adr6[] is initial.
select *
from adr6
into corresponding fields of table t_adr61
for all entries in t_knvk
where persnumber = t_knvk-prsnr.
endif.
loop at t_adr6.
read table t_adr61 with key addrnumber = t_adr6-addrnumber persnumber
= t_adr6-persnumber.
if sy-subrc <> 0.
delete t_adr6.
endif.
move t_adr6-smtp_addr to adr6-smtp_addr.
endloop.
*if we look for the e-mail address for the ship-to, the program only
*needs to access adr6 with the address number of the ship-to from the
*order.
select adrnr
from vbpa
into corresponding fields of table it_vbpa002
where vbeln = vbak-vbeln
and parvw = 'we'.
if not it_vbpa002[] is initial.
select smtp_addr
from adr6
into corresponding fields of table it_adr6
for all entries in it_vbpa002
where addrnumber = it_vbpa002-adrnr
and persnumber = space.
endif.
endif.
loop at it_adr6.
* read table it_adr6 with key addrnumber = it_vbpa002-adrnr.
* if sy-subrc <> 0.
* delete it_adr6.
* endif.
move it_adr6-smtp_addr to adr6-smtp_addr.
endloop.
endif.
* end of changes "$16
endif.
else.
perform contact_person_address.
endif.
if w_zqueid is initial and
w_zcland is initial.
select *
from zvs13
into table int_zvs13
where vbeln = vbak-vbeln
and stonr <> 40
and stonr <> 50.
elseif not w_zqueid is initial.
select *
from zvs13
into table int_zvs13
where vbeln = vbak-vbeln
and stonr <> 40
and stonr <> 50
and zqueid = w_zqueid.
elseif not w_zcland is initial.
select *
from zvs13
into table int_zvs13
where vbeln = vbak-vbeln
and stonr <> 40
and stonr <> 50
and ( zcland = w_zcland ).
endif.
refresh int_del.
select *
from zvs13
into table int_del
where stonr = 50
and laeda = sy-datum.
top_line = 1.
endform. "record_change
*eject
*&---------------------------------------------------------------------*
*& module user_command_0700 input
*----------------------------------------------------------------------*
module user_command_0700 input.
if sy-ucomm = 'push' or
sy-ucomm = 'canc'.
set screen 0.
leave screen.
endif.
endmodule. " user_command_0700 input
*eject
*&---------------------------------------------------------------------*
*& module status_0700 output
*&---------------------------------------------------------------------*
module status_0700 output.
set pf-status 'z700'.
set titlebar 'zpus'.
clear ok_code300.
if *zvs50-vbeln = int_zvs13-vbeln.
delete *zvs50 where vbeln = int_zvs13-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = int_zvs13-vbeln and ernam = sy-uname.
endif.
if *zvs50-vbeln = vbak-vbeln.
delete *zvs50 where vbeln = vbak-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = vbak-vbeln and ernam = sy-uname.
endif.
loop at *zvs50.
if *zvs50-vbeln = chk_tab-vbeln.
delete *zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
if sy-subrc = 0.
describe table chk_tab lines lin_no.
if num1 < lin_no.
num1 = num1 + 1.
if num1 > 1.
endif.
read table chk_tab index num1.
endif.
endif.
endif.
endloop.
endform. " exit
*&---------------------------------------------------------------------*
*& form back
*&---------------------------------------------------------------------*
* the line item or the order in zvs50 should be deleted *
*-----------------------------------------------------------------------
form back.
if *zvs50-vbeln = int_zvs13-vbeln.
delete *zvs50 where vbeln = int_zvs13-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = int_zvs13-vbeln and ernam = sy-uname.
endif.
if *zvs50-vbeln = vbak-vbeln.
delete *zvs50 where vbeln = vbak-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = vbak-vbeln and ernam = sy-uname.
endif.
loop at *zvs50.
if *zvs50-vbeln = chk_tab-vbeln.
delete *zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
if sy-subrc = 0.
describe table chk_tab lines lin_no.
if num1 < lin_no.
num1 = num1 + 1.
if num1 > 1.
endif.
read table chk_tab index num1.
endif.
endif.
endif.
endloop.
describe table itab lines lin_no.
if lin_no = 0.
set screen 100. leave screen.
endif.
endform. " back
*&---------------------------------------------------------------------*
*& form canc
*&---------------------------------------------------------------------*
* the line item or the order in zvs50 should be deleted *
*----------------------------------------------------------------------*
form canc.
if *zvs50-vbeln = int_zvs13-vbeln.
delete *zvs50 where vbeln = int_zvs13-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = int_zvs13-vbeln and ernam = sy-uname.
endif.
if *zvs50-vbeln = vbak-vbeln.
delete *zvs50 where vbeln = vbak-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = vbak-vbeln and ernam = sy-uname.
endif.
loop at *zvs50.
if *zvs50-vbeln = chk_tab-vbeln.
delete *zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
if sy-subrc = 0.
describe table chk_tab lines lin_no.
if num1 < lin_no.
num1 = num1 + 1.
if num1 > 1.
endif.
read table chk_tab index num1.
endif.
endif.
endif.
endloop.
endform. " canc
*&---------------------------------------------------------------------*
*& form comt
*&---------------------------------------------------------------------*
* for the line item selected - description
*----------------------------------------------------------------------*
form comment.
refresh ck_tab.
clear ck_tab.
loop at int_zvs13.
if int_zvs13-checkbox = 'x'.
move-corresponding int_zvs13 to ck_tab.
append ck_tab.
endif.
endloop.
numr = 1.
read table ck_tab index numr.
clear ok_code300.
* move 'disp' to ws_process_mode.
* export ws_process_mode to memory id 'zvs06scr_process_mode'.
* select single bismt matkl into (zvs06-bismt, zvs06-matkl)
* from mara where matnr eq ck_tab-matnr.
* if sy-subrc eq 0.
* set parameter id 'zbl' field zvs06-bismt.
* set parameter id 'mkl' field zvs06-matkl.
* export ws_process_mode to memory id 'zvs06scr_process_mode'.
* call transaction 'zcom' and skip first screen.
* endif.
set screen 400.
leave screen.
endform. " comment
*&---------------------------------------------------------------------*
*& form secu
*&---------------------------------------------------------------------*
form secu_delay.
loop at int_zvs13.
move ' ' to int_zvs13-checkbox.
modify int_zvs13.
move int_zvs13-checkbox to citab-checkbox.
append citab.
endloop.
set screen 300.
leave screen.
endform. " secu_delay
*&---------------------------------------------------------------------*
*& form else
*&---------------------------------------------------------------------*
* security to be deleted in zvs50.
*----------------------------------------------------------------------*
form else.
if *zvs50-vbeln = int_zvs13-vbeln.
delete *zvs50 where vbeln = int_zvs13-vbeln
and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = int_zvs13-vbeln
and ernam = sy-uname.
endif.
loop at *zvs50.
if *zvs50-vbeln = chk_tab-vbeln.
delete *zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
endif.
endloop.
read table chk_tab index num1.
set screen 300. leave screen.
else.
if *zvs50-vbeln = int_zvs13-vbeln.
delete *zvs50 where vbeln = int_zvs13-vbeln
and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = int_zvs13-vbeln
and ernam = sy-uname.
endif.
loop at *zvs50.
if *zvs50-vbeln = chk_tab-vbeln.
delete *zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
endif.
endloop.
set screen 200. leave screen.
endif.
else.
if *zvs50-vbeln = int_zvs13-vbeln.
delete *zvs50 where vbeln = int_zvs13-vbeln
and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = int_zvs13-vbeln
and ernam = sy-uname.
endif.
loop at *zvs50.
if *zvs50-vbeln = chk_tab-vbeln.
delete *zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
endif.
endloop.
set screen 200. leave screen.
endif.
endform. " else
*&---------------------------------------------------------------------*
*& form mian
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
* selection of the next item and deleting the record in table zvs50.
* security of zvs50 *
*&---------------------------------------------------------------------*
form mian.
if *zvs50-vbeln = int_zvs13-vbeln.
delete *zvs50 where vbeln = int_zvs13-vbeln
and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = int_zvs13-vbeln
and ernam = sy-uname.
endif.
loop at *zvs50.
if *zvs50-vbeln = chk_tab-vbeln.
delete *zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
endif.
endloop.
read table chk_tab index num1.
set screen 300. leave screen.
else.
if *zvs50-vbeln = int_zvs13-vbeln.
delete *zvs50 where vbeln = int_zvs13-vbeln
and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = int_zvs13-vbeln
and ernam = sy-uname.
endif.
loop at *zvs50.
if *zvs50-vbeln = chk_tab-vbeln.
delete *zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
endif.
endloop.
set screen 200. leave screen.
endif.
else.
if *zvs50-vbeln = int_zvs13-vbeln.
delete *zvs50 where vbeln = int_zvs13-vbeln
and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = int_zvs13-vbeln
and ernam = sy-uname.
endif.
loop at *zvs50.
if *zvs50-vbeln = chk_tab-vbeln.
delete *zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
clear *zvs50.
delete from zvs50 where vbeln = chk_tab-vbeln and ernam = sy-uname.
endif.
endloop.
set screen 200. leave screen.
endif.
endform. " mian
*&---------------------------------------------------------------------*
*& form top_part_of_screen
*&---------------------------------------------------------------------*
* if you directly come from filter screen when you enter the sales
* document then this is for sold to, ship to, contact person address.
*----------------------------------------------------------------------*
form top_part_of_screen.
if zvs13-vbeln is initial.
else.
vbak-vbeln = zvs13-vbeln.
endif.
loop at itvtab.
move itvtab-zshipno to vbak-kunnr.
move itvtab-kunnr to kna1-kunnr.
endloop.
else. "$3
select * "$3
from vbpa "$3
into corresponding fields of table t_vbpa "$3
where vbeln = vbak-vbeln "$3
and posnr = '000000'. "$3
refresh ktab.
clear kna1-name1.
clear kna1-name2.
clear kna1-name3.
clear kna1-name4.
clear kna1-ort01.
clear kna1-stras.
clear kna1-regio.
clear kna1-land1.
clear kna1-pstlz.
clear kna1-telf1.
clear kna1-telfx.
clear adr6-smtp_addr.
refresh ktab1.
clear name1.
clear name2.
clear name3.
clear name4.
clear ort01.
clear stras.
clear regio.
clear land.
clear pstlz.
clear telf1.
clear telfx.
clear smtp_addr.
if sy-subrc = 0.
if vbpa-adrda = 'e'. " manual address
perform get_sadr_address using vbpa-adrnr.
move ksadr-name1 to kna1-name1.
move ksadr-name2 to kna1-name2.
move ksadr-name3 to kna1-name3.
move ksadr-name4 to kna1-name4.
move ksadr-ort01 to kna1-ort01.
move ksadr-stras to kna1-stras.
move ksadr-regio to kna1-regio.
move ksadr-land1 to kna1-land1.
move ksadr-pstlz to kna1-pstlz.
move ksadr-telf1 to kna1-telf1.
move ksadr-telfx to kna1-telfx.
*started the changes dsekhar
* select single smtp_addr from adr6 into ws_smtp_addr
* where addrnumber = vbpa-adrnr.
*
* if sy-subrc = 0.
* move ws_smtp_addr to adr6-smtp_addr.
* endif.
* call function 'addr_comm_get'
* exporting
* address_number = vbpa1-adrnr
* language = sy-langu
* table_type = 'adsmtp'
** importing
** returncode =
* tables
* comm_table = int_adr6
* exceptions
* parameter_error = 1
* address_not_exist = 2
* internal_error = 3
* others = 4
* .
* if sy-subrc <> 0.
* endif.
* read table int_adr6 index 1.
* move int_adr6-smtp_addr to adr6-smtp_addr.
** end of changes
select *
from vbpa
into corresponding fields of table t_vbpa10
where vbeln = vbak-vbeln
and parvw = 'ag'.
else.
*if sy-subrc is false then get the adrnr and parnr from vbpa by passing th vbeln
and parvw.
select adrnr parnr
from vbpa
into corresponding fields of table t_vbpa2
where vbeln = vbak-vbeln
and parvw = 'ap'.
select *
from adr6
into corresponding fields of table t_adr6
for all entries in t_vbpa2
where addrnumber = t_vbpa2-adrnr.
endif.
if not t_adr6[] is initial.
select *
from adr6
into corresponding fields of table t_adr61
for all entries in t_knvk
where persnumber = t_knvk-prsnr.
endif.
loop at t_adr6.
read table t_adr61 with key addrnumber = t_adr6-addrnumber persnumber
= t_adr6-persnumber.
if sy-subrc <> 0.
delete t_adr6.
endif.
move t_adr6-smtp_addr to adr6-smtp_addr.
endloop.
*if we look for the e-mail address for the ship-to, the program only
*needs to access adr6 with the address number of the ship-to from the
*order.
select adrnr
from vbpa
into corresponding fields of table it_vbpa002
where vbeln = vbak-vbeln
and parvw = 'we'.
if not it_vbpa002[] is initial.
select smtp_addr
from adr6
into corresponding fields of table it_adr6
for all entries in it_vbpa002
where addrnumber = it_vbpa002-adrnr
and persnumber = space.
endif.
endif.
loop at it_adr6.
* read table it_adr6 with key addrnumber = it_vbpa002-adrnr.
* if sy-subrc <> 0.
* delete it_adr6.
* endif.
move it_adr6-smtp_addr to adr6-smtp_addr.
endloop.
endif.
* end of changes "$16
endif.
endif.
select *
from vbpa
into table vbpa1
where vbeln = vbak-vbeln
and posnr = '000000' "$14
and parvw = 'ap'.
if sy-subrc <> 0.
select * from kna1 into table ktab1
where kunnr = vbak-kunnr.
loop at ktab1.
move ktab1-name1 to name1.
move ktab1-name2 to name2.
move ktab1-name3 to name3.
move ktab1-name4 to name4.
move ktab1-ort01 to ort01.
move ktab1-regio to regio.
move ktab1-land1 to w_land1.
move ktab1-pstlz to pstlz.
move ktab1-telf1 to telf1.
move ktab1-telfx to telfx.
endloop.
else.
* refresh ksadr.
loop at vbpa1.
perform get_sadr_address using vbpa1-adrnr.
* select * from sadr into table ksadr
* where adrnr = vbpa1-adrnr.
endloop.
if vbpa1-adrnr is initial.
select * from kna1 into table ktab1
where kunnr = vbak-kunnr.
loop at ktab1.
move ktab1-name1 to name1.
move ktab1-name2 to name2.
move ktab1-name3 to name3.
move ktab1-name4 to name4.
move ktab1-ort01 to ort01.
move ktab1-stras to stras.
move ktab1-regio to regio.
move ktab1-land1 to land.
move ktab1-pstlz to pstlz.
move ktab1-telf1 to telf1.
move ktab1-telfx to telfx.
endloop.
else.
* loop at ksadr.
move ksadr-name1 to name1.
move ksadr-name2 to name2.
move ksadr-name3 to name3.
move ksadr-name4 to name4.
move ksadr-ort01 to ort01.
move ksadr-stras to stras.
move ksadr-regio to regio.
move ksadr-land1 to land.
move ksadr-pstlz to pstlz.
move ksadr-telf1 to telf1.
move ksadr-telfx to telfx.
* started the changes "$16
select *
from vbpa
into corresponding fields of table t_vbpa10
where vbeln = vbak-vbeln
and parvw = 'ag'.
else.
*if sy-subrc is false then get the adrnr and parnr from vbpa by passing th vbeln
and parvw.
endif.
loop at t_adr6.
read table t_adr61 with key addrnumber = t_adr6-addrnumber
persnumber = t_adr6-persnumber.
if sy-subrc <> 0.
delete t_adr6.
endif.
move t_adr6-smtp_addr to adr6-smtp_addr.
endloop.
*if we look for the e-mail address for the ship-to, the program only
*needs to access adr6 with the address number of the ship-to from the
*order.
select adrnr
from vbpa
into corresponding fields of table it_vbpa002
where vbeln = vbak-vbeln
and parvw = 'we'.
if not it_vbpa002[] is initial.
select smtp_addr
from adr6
into corresponding fields of table it_adr6
for all entries in it_vbpa002
where addrnumber = it_vbpa002-adrnr
and persnumber = space.
endif.
endif.
loop at it_adr6.
* read table it_adr6 with key addrnumber = it_vbpa002-adrnr.
* if sy-subrc <> 0.
* delete it_adr6.
* endif.
move it_adr6-smtp_addr to adr6-smtp_addr.
endloop.
endif.
endif.
endif.
else.
perform contact_person_address.
endif.
endform. " top_part_of_screen
*&---------------------------------------------------------------------*
*& form top_part_of_screen_po
*&---------------------------------------------------------------------*
* this is for purchase requisition / purchase order to display
* vendor and receiving plant address.
*----------------------------------------------------------------------*
form top_part_of_screen_po.
move 'pr/po doc' to doc_type.
move 'vendor' to sold_to.
move 'rec plant' to ship_to.
if syst-subrc = 0.
move t001w-land1 to land. " country.
move t001w-name1 to name1.
move t001w-name2 to name2.
move t001w-stras to stras.
move t001w-ort01 to ort01.
move t001w-regio to regio.
move t001w-pstlz to pstlz.
endif.
if sy-subrc = 0.
move lfa1-name1 to kna1-name1.
move lfa1-name2 to kna1-name2.
move lfa1-name3 to kna1-name3.
move lfa1-name4 to kna1-name4.
move lfa1-ort01 to kna1-ort01.
move lfa1-stras to kna1-stras.
move lfa1-regio to kna1-regio.
move lfa1-pstlz to kna1-pstlz.
move lfa1-land1 to kna1-land1.
endif.
endform. " top_part_of_screen_po
*&---------------------------------------------------------------------*
*& form header
*&---------------------------------------------------------------------*
form header.
clear kna1-name1.
clear kna1-name2.
clear kna1-name3.
clear kna1-name4.
clear kna1-ort01.
clear kna1-stras.
clear kna1-regio.
clear kna1-land1.
clear kna1-pstlz.
clear kna1-telf1.
clear kna1-telfx.
clear adr6-smtp_addr.
refresh ktab.
refresh ktab1.
clear name1.
clear name2.
clear name3.
clear name4.
clear ort01.
clear stras.
clear regio.
clear land.
clear pstlz.
clear telf1.
clear telfx.
clear smtp_addr.
refresh ktab2.
* refresh ksadr.
select *
from vbpa
into table vbpa1
where vbeln = vbak-vbeln
and posnr = '000000' "$14
and parvw = 'ap'.
sy-subrc = 4. "$2
if sy-subrc <> 0 .
select *
from vbpa
into table vbpa1
where vbeln = vbak-vbeln
and posnr = '000000' "$14
and parvw = 'we'.
if sy-subrc <> 0.
select * from kna1 into table ktab2
where kunnr = vbak-kunnr.
loop at ktab2.
move ktab2-name1 to name1.
move ktab2-name2 to name2.
move ktab2-name3 to name3.
move ktab2-name4 to name4.
move ktab2-ort01 to ort01.
move ktab2-regio to regio.
move ktab2-land1 to w_land1.
move ktab2-pstlz to pstlz.
move ktab2-telf1 to telf1.
move ktab2-telfx to telfx.
endloop.
else.
* refresh ksadr.
loop at vbpa1.
perform get_sadr_address using vbpa1-adrnr.
* select * from sadr into table ksadr
* where adrnr = vbpa1-adrnr.
endloop.
if vbpa1-adrnr is initial.
select * from kna1 into table ktab2
where kunnr = vbak-kunnr.
loop at ktab2.
move ktab2-name1 to name1.
move ktab2-name2 to name2.
move ktab2-name3 to name3.
move ktab2-name4 to name4.
move ktab2-ort01 to ort01.
move ktab2-stras to stras.
move ktab2-regio to regio.
move ktab2-land1 to land.
move ktab2-pstlz to pstlz.
move ktab2-telf1 to telf1.
move ktab2-telfx to telfx.
endloop.
else.
* loop at ksadr.
move ksadr-name1 to name1.
move ksadr-name2 to name2.
move ksadr-name3 to name3.
move ksadr-name4 to name4.
move ksadr-ort01 to ort01.
move ksadr-stras to stras.
move ksadr-regio to regio.
move ksadr-land1 to land.
move ksadr-pstlz to pstlz.
move ksadr-telf1 to telf1.
move ksadr-telfx to telfx.
select single smtp_addr from adr6 into smtp_addr
where addrnumber = vbpa1-adrnr.
* endloop.
endif.
endif.
else.
perform contact_person_address.
endif.
endform. " header
*&---------------------------------------------------------------------*
*& form bottom_screen
*&---------------------------------------------------------------------*
form bottom_screen.
if w_zqueid is initial
and w_zcland is initial.
select *
from zvs13
into table int_zvs13
where vbeln = vbak-vbeln
and stonr <> 40
and stonr <> 50.
elseif not w_zcland is initial.
if w_zqueid is initial.
select *
from zvs13
into table int_zvs13
where vbeln = vbak-vbeln
and stonr <> 40
and stonr <> 50
and zcland = w_zcland.
else.
select *
from zvs13
into table int_zvs13
where vbeln = vbak-vbeln
and stonr <> 40
and stonr <> 50
and zcland = w_zcland
and zqueid = w_zqueid.
endif.
elseif not w_zqueid is initial.
select *
from zvs13
into table int_zvs13
where vbeln = vbak-vbeln
and stonr <> 40
and stonr <> 50
and zqueid = w_zqueid.
endif.
describe table int_zvs13 lines lin_no.
loop at int_zvs13.
if exclude_delayed = 'x'.
if int_zvs13-zohind = 'x'.
if int_zvs13-zohdat > sy-datum.
delete int_zvs13 where zohdat > sy-datum.
elseif int_zvs13-zohdat = sy-datum and
int_zvs13-zohtim > sy-uzeit.
delete int_zvs13 where zohtim > sy-uzeit.
exit.
endif.
endif.
endif.
if only_delayed = 'x'.
if int_zvs13-zohdat < sy-datum.
delete int_zvs13 where zohdat < sy-datum.
elseif int_zvs13-zohdat = sy-datum
and int_zvs13-zohtim < sy-uzeit.
delete int_zvs13 where zohtim < sy-uzeit.
exit.
endif.
endif.
endloop.
endform. " bottom_screen
*eject
*&---------------------------------------------------------------------*
*& module status_0800 output
*&---------------------------------------------------------------------*
module status_0800 output.
set pf-status 'zrele'.
set titlebar 'zrel'.
endmodule. " status_0800 output
*&---------------------------------------------------------------------*
*& module user_command_0800 input
*&---------------------------------------------------------------------*
module user_command_0800 input.
case : rel_code.
when 'back'.
if rcode = 'y'.
set screen 100.
leave screen.
else.
set screen 300. leave screen.
endif.
when 'canc'.
if rcode = 'y'.
set screen 100. leave screen.
else.
set screen 300.
leave screen.
endif.
when 'exit'.
if rcode = 'y'.
set screen 100. leave screen.
else.
set screen 300.
leave screen.
endif.
when 'frst'.
perform paging_release using 'frst'.
when 'prev'.
perform paging_release using 'prev'.
when 'next'.
perform paging_release using 'next'.
when 'last'.
perform paging_release using 'last'.
when 'sele'.
perform release_mark_all.
when 'dese'.
perform release_delete_all_marks.
clear ok_code300.
when 'comm'.
perform release_comment.
when 'disp'.
perform display.
when 'chan'.
perform change.
endcase.
endmodule. " user_command_0800 input
*&---------------------------------------------------------------------*
*& module display_released_order_item output
*&---------------------------------------------------------------------*
module display_released_order_item output.
select netpr from vbap into int_release-netpr
where vbeln = int_release-vbeln and
posnr = int_release-posnr.
vbap-netpr = int_release-netpr.
endselect.
select kwmeng from vbap into int_release-kwmeng
where vbeln = int_release-vbeln and
posnr = int_release-posnr .
vbap-kwmeng = int_release-kwmeng.
endselect.
select * from vbep where vbeln = int_release-vbeln and
posnr = int_release-posnr.
if int_release-kwmeng > vbep-bmeng.
move 'x' to bmeng.
endif.
endselect.
vbak-vbeln = int_release-vbeln.
zvs13-matnr = int_release-matnr.
zvs13-zcomtyp = int_release-zcomtyp.
zvs13-zlictyp = int_release-zlictyp.
zvs13-route = int_release-route.
zvs13-posnr = int_release-posnr.
zvs13-zqueid = int_release-zqueid.
zvs13-erdat = int_release-erdat.
zvs13-zseqno = int_release-zseqno.
zvs14t-zcomrea = int_release-zcomrea.
zvs13-name1_gp = int_release-name1_gp.
zvs13-zabdat = int_release-zabdat.
zvs13-zabtim = int_release-zabtim.
zvs13-ernam = int_release-ernam.
zvs13-erdat = int_release-erdat.
zvs13-erzeit = int_release-erzeit.
zvs13-aenam = int_release-aenam.
zvs13-laeda = int_release-laeda.
zvs13-lauhr = int_release-lauhr.
checkbox = citab-checkbox.
checkbox = int_release-checkbox.
select zcrdes from zvs14t into compliance_description where
zcomrea = int_release-zcomrea.
zvs14t-zcrdes = compliance_description.
endselect.
if int_release-stonr = '40'.
move 'scok' to stonr.
endif.
if int_release-stonr = '50'.
move 'scrj' to stonr.
endif.
endmodule. " display_released_order_item output
*&---------------------------------------------------------------------*
*& module display_released_order_header output
*&---------------------------------------------------------------------*
module display_released_order_header output.
if sy-ucomm = 'yes'.
perform top_part_of_screen.
endif.
endmodule. " display_released_order_header output
*&---------------------------------------------------------------------*
*& form paging_release
*&---------------------------------------------------------------------*
form paging_release using ccode.
data: linno type i,
i type i.
describe table int_release lines linno.
case ccode.
when 'frst'. top_line = 1.
when 'prev'.
top_line = top_line - line_count.
if top_line = 0.
top_line = 1.
endif.
when 'next'.
i = top_line + line_count.
linno = linno - line_count + 1.
if linno le 0.
linno = 1.
endif.
if i le linno.
top_line = i.
else.
top_line = linno.
endif.
when 'last'.
top_line = linno - line_count + 1.
if top_line le 0.
top_line = 1.
endif.
endcase.
endform. " paging_release
*&---------------------------------------------------------------------*
*& form release_mark_all
*&---------------------------------------------------------------------*
form release_mark_all.
refresh citab.
loop at int_release.
move 'x' to int_release-checkbox.
modify int_release.
move int_release-checkbox to citab-checkbox.
append citab.
endloop.
endform. " release_mark_all
*&---------------------------------------------------------------------*
*& form release_delete_all_marks
*&---------------------------------------------------------------------*
form release_delete_all_marks.
loop at int_release.
move ' ' to int_release-checkbox.
modify int_release.
move int_release-checkbox to citab-checkbox.
append citab.
endloop.
endform. " release_delete_all_marks
*&---------------------------------------------------------------------*
*& form release_comment
*&---------------------------------------------------------------------*
form release_comment.
refresh ck_tab.
clear ck_tab.
loop at int_release.
if int_release-checkbox = 'x'.
move-corresponding int_release to ck_tab.
append ck_tab.
endif.
endloop.
numr = 1.
read table ck_tab index numr.
move 'h' to fcode.
clear ok_code300.
set screen 400.
leave screen.
endform. " release_comment
*&---------------------------------------------------------------------*
*& form scr_400_back
*&---------------------------------------------------------------------*
form scr_400_back.
loop at int_zvs13.
move ' ' to int_zvs13-checkbox.
modify int_zvs13.
move int_zvs13-checkbox to citab-checkbox.
append citab.
endloop.
set screen 300.
leave screen.
endform. " scr_400_back
*&---------------------------------------------------------------------*
*& form release_scr_400_back
*&---------------------------------------------------------------------*
form release_scr_400_back.
loop at int_release.
move ' ' to int_release-checkbox.
modify int_release.
move int_release-checkbox to citab-checkbox.
append citab.
endloop.
set screen 800.
leave screen.
endform. " release_scr_400_back
*&---------------------------------------------------------------------*
*& module release_select_check input
*&---------------------------------------------------------------------*
module release_select_check input.
bas = sy-loopc + 1.
describe table int_release lines linno.
num = bas - sy-loopc + top_line - 1.
if checkbox = 'x'.
move 'x' to int_release-checkbox.
modify int_release index num.
else.
move ' ' to int_release-checkbox.
modify int_release index num.
endif.
endmodule. " release_select_check input
*&---------------------------------------------------------------------*
*& form scr_400_exit
*&---------------------------------------------------------------------*
form scr_400_exit.
loop at int_zvs13.
move ' ' to int_zvs13-checkbox.
modify int_zvs13.
move int_zvs13-checkbox to citab-checkbox.
append citab.
endloop.
clear ok_code400.
set screen 300.
leave screen.
endform. " scr_400_exit
*&---------------------------------------------------------------------*
*& form released_order_next
*&---------------------------------------------------------------------*
form released_order_next using next.
describe table ck_tab lines lin_no.
* case ccode.
* describe table ck_tab lines lin_no.
if numr < lin_no.
numr = numr + 1.
if numr > 1.
endif.
read table ck_tab index numr.
else.
loop at int_release.
move ' ' to int_release-checkbox.
modify int_release.
move int_release-checkbox to citab-checkbox.
append citab.
endloop.
set screen 800. leave screen.
endif.
* endcase.
endform. " released_order_next
*&---------------------------------------------------------------------*
*& form selection_order_status
*&---------------------------------------------------------------------*
form selection_order_status.
select *
from zvs13
into table indu
where vbeln = zvs13-vbeln
and stonr <> 20
and stonr <> 30.
loop at indu.
endloop.
if indu-vbeln <> ' '.
select * from zvs24t
where zpopup = 'queuerel'
and spras = sy-langu.
endselect.
if sy-subrc = 0.
move zvs24t-zpopdes to popup_text1.
move zvs24t-zpopdes+35(35) to popup_text2.
else.
move 'all items have been released from ' to popup_text1.
move 'the queue. view released items ? ' to popup_text2.
endif.
select *
from zvs13
into table int_release
where vbeln = zvs13-vbeln
and stonr <> 30
and stonr <> 20.
top_line = 1.
set screen 800.
leave screen.
if sy-subrc = 0.
move 'order screening - queue management' to popup_title.
concatenate 'sales document' zvs13-vbeln
'is being processed by' zvs50-ernam into field separated by ' '
.
concatenate 'on date ' zvs50-erdat 'at time' zvs50-uzeit
into field1 separated by ' '.
call function 'popup_to_inform'
exporting
titel = popup_title
txt1 = field
txt2 = field1
exceptions
others = 1.
clear ok_code100.
if zvs50-vbeln = zvs13-vbeln.
clear zvs13-vbeln.
clear zvs50-vbeln.
set screen 100.leave screen.
else.
clear ok_code100.
top_line = 1.
set screen 300.
leave screen.
endif.
endform. " selection_reveiw_screen
*&---------------------------------------------------------------------*
*& form pop_up_for_item_release
*&---------------------------------------------------------------------*
form pop_up_for_item_release.
select *
from zvs13
where vbeln = vbak-vbeln
and stonr <> 20
and stonr <> 30.
endselect.
if sy-subrc = 0.
if w_zcland is initial.
select *
from zvs13
into table int_release
where vbeln = vbak-vbeln
and stonr <> 20
and stonr <> 30.
else.
select *
from zvs13
into table int_release
where vbeln = vbak-vbeln
and stonr <> 20
and stonr <> 30
and ( zcland = w_zcland ).
endif.
if sy-subrc = 0.
endif.
else.
perform pop_up_for_item_release.
endif.
endform. " view_released_orders
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& form contact_person_address
*&---------------------------------------------------------------------*
form contact_person_address.
clear vbak-kunnr.
loop at vbpa1.
move vbpa1-parnr to vbak-kunnr.
endloop.
* refresh ksadr.
refresh ktab1.
loop at vbpa1.
perform get_sadr_address using vbpa1-adrnr.
* select * from sadr into table ksadr
* where adrnr = vbpa1-adrnr.
endloop.
if vbpa1-adrnr is initial.
select single * from knvk into xknvk
where parnr = vbpa1-parnr.
loop at xknvk.
endloop.
perform get_sadr_address using xknvk-adrnd.
endif.
* select * from sadr into table xsadrx where adrnr = xknvk-adrnd.
* loop at xsadrx.
* else.
* loop at ksadr.
move ksadr-name1 to name1.
move ksadr-name2 to name2.
move ksadr-name3 to name3.
move ksadr-name4 to name4.
move ksadr-ort01 to ort01.
move ksadr-stras to stras.
move ksadr-regio to regio.
move ksadr-land1 to land.
move ksadr-pstlz to pstlz.
move ksadr-telf1 to telf1.
move ksadr-telfx to telfx.
* endloop.
* endif.
select *
from zvs50
into table *zvs50.
select *
from zvs13
into table itab
where ( stonr = '20' or
stonr = '30' )
and vkorg in s_vkorg "$7
and zcomtyp in s_zcomtyp
and zlictyp in s_zlictyp
and stonr in s_stonr
and zqueid in s_zqueid
and vbeln in s_vbeln
and kunnr in s_kunnr
and vsbed in s_vsbed
and route in s_route
and land1 in s_land1
and zcland in s_zcland
and erdat in s_erdat.
sigma-top_line = 1.
if not plant is initial.
delete itab where zshipno <> plant.
endif.
loop at itab.
select single werks
from vbap
into itab-werks
where vbeln = itab-vbeln
and posnr = itab-posnr.
if sy-subrc = 0.
if not w_delivering_plant is initial.
if itab-werks <> w_delivering_plant.
delete itab.
continue.
endif.
endif.
modify itab transporting werks.
endif.
endloop.
if exclude_delayed = 'x'.
delete itab where zohdat > sy-datum
and zohind = 'x'.
delete itab where zohdat = sy-datum
and zohtim > sy-uzeit
and zohind = 'x'.
endif.
if only_delayed = 'x'.
delete itab where zohind <> 'x'.
if debi-auswl cs '110'.
rf02d-d0110 = 'x'.
endif.
if debi-auswl cs '324'.
rf02d-d0324 = 'x'.
endif.
set parameter id 'kun' field rf02d-kunnr.
set parameter id 'ddy' field debi-auswl .
call transaction 'xd02' .
if debi-auswl cs '110'.
rf02d-d0110 = 'x'.
endif.
if debi-auswl cs '324'.
rf02d-d0324 = 'x'.
endif.
set parameter id 'kun' field rf02d-kunnr.
set parameter id 'ddy' field debi-auswl .
call transaction 'xd03' .
numr = 1.
read table ck_tab index numr.
clear ok_code300.
numr = 1.
read table ck_tab index numr.
clear ok_code300.
* check if this order has been released from all the queue. a record
* with status code e0004 should exist in the table jcds.
loop at t_jcds.
endloop.
endloop.
if sy-subrc ne 0.
clear : vbpa-kunnr.
select single kunnr adrnr from vbpa into (vbpa-kunnr, vbpa-adrnr)
where vbeln = vbak-vbeln and posnr = 0 and parvw = 're'.
endform. "proc_creditcrd_new
*&---------------------------------------------------------------------*
*& form save_order
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form save_order.
* refresh t_bdc.
refresh t_bdc.
clear t_bdc.
clear t_bdc.
perform bdc_screen using 'sapmv45a' '0102'.
clear t_bdc.
perform bdc_field using 'vbak-vbeln' vbak-vbeln.
* press f6 detail
clear t_bdc.
perform bdc_field using 'bdc_okcode' '=uer1'.
clear t_bdc.
perform bdc_screen using 'sapmv45a' '4001'.
clear t_bdc.
perform bdc_field using 'bdc_okcode' '=krpl'.
clear t_bdc.
perform bdc_screen using 'saplv60f' '4001'.
clear t_bdc.
perform bdc_field using 'bdc_okcode' '=s\back'.
clear t_bdc.
perform bdc_screen using 'sapmv45a' '4001'.
* save order.
clear t_bdc.
perform bdc_field using 'bdc_okcode' '=sich'.
if sy-subrc = 0.
popup_title = 'sales document save'.
move vbak-vbeln to ws_vbeln.
condense ws_vbeln.
concatenate 'sales document ' ws_vbeln 'has been'
'saved successfully'
into ws_field1 separated by ' '.
move 'press continue.' to ws_field2.
else.
endif.
endform. "save_order
*&---------------------------------------------------------------------*
*& form proc_creditcrd
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form proc_creditcrd.
* check if this order has been released from all the queue. a record
* with status code e0004 should exist in the table jcds.
loop at t_jcds.
endloop.
endloop.
if sy-subrc ne 0.
clear : ws_complete.
select single * from vbuk where vbeln = vbak-vbeln.
if sy-subrc = 0.
if vbuk-uvall = 'c' and vbuk-uvvlk = 'c' and vbuk-uvfak = 'c' and
vbuk-uvprs = 'c'.
move 'y' to ws_complete.
endif.
endif.
clear : vbpa-kunnr.
select single kunnr adrnr from vbpa into (vbpa-kunnr, vbpa-adrnr)
where vbeln = vbak-vbeln and posnr = 0 and parvw = 're'.
if sy-subrc = 0.
if ws_bypass = 'n'.
if ws_value = 0.
move 'y' to ws_free.
loop at t_vbap where abgru eq ' ' or abgru eq 'c1' or
abgru eq 'c3' or abgru eq 'c2'.
if t_vbap-pstyv ne 'renn' and
t_vbap-pstyv ne 'tann' and
t_vbap-pstyv ne 'zann' and
t_vbap-pstyv ne 'zgcn' and
t_vbap-pstyv ne 'zktn' and
t_vbap-pstyv ne 'zmtn' and
t_vbap-pstyv ne 'zrek' and
t_vbap-pstyv ne 'ztmn' and
t_vbap-pstyv ne 'ztqn' and
t_vbap-pstyv ne 'zcmk' and
t_vbap-pstyv ne 'zcom' and
t_vbap-pstyv ne 'zxqi'.
move 'n' to ws_free.
exit.
endif.
endloop.
endif.
if ws_free = 'y'.
popup_title = 'sales order with free items'.
move 'no authorization required.' to ws_field1.
move 'press continue.' to ws_field2.
call function 'popup_to_inform'
exporting
titel = popup_title
txt1 = ws_field1
txt2 = ws_field2
exceptions
others = 1.
perform remov_delblk.
exit.
endif.
* get address
h_addr1_sel-addrnumber = vbpa-adrnr.
if sy-subrc = 0.
move h_sadr-telf1 to zcrd_info-zztelno.
move h_sadr-name1 to zcrd_info-zzname1.
move h_sadr-name2 to zcrd_info-zzname2.
move h_sadr-name3 to zcrd_info-zzname3.
move h_sadr-ort01 to zcrd_info-zzcity.
move h_sadr-regio to zcrd_info-zzstate.
move h_sadr-pstlz to zcrd_info-zzzip.
endif.
if sy-subrc = 0.
if zcrd_retn-zzerrrslt ne 's'.
if zcrd_retn-zzrspno ne '000'.
perform order_reject tables t_vbap.
perform updat_detail using zcrd_info zcrd_retn.
else.
perform updat_detail using zcrd_info zcrd_retn.
endif.
else.
perform updat_detail using zcrd_info zcrd_retn.
loop at t_vbap where abgru = 'c1' or abgru = 'c2' or
abgru = 'c3'.
endloop.
if sy-subrc = 0.
perform remov_reject tables t_vbap.
endif.
perform remov_delblk.
endif.
else.
endif.
endif.
endif.
endif.
refresh : t_zccdatad.
clear : t_zccdatad.
move vbak-vbeln to t_zccdatad-vbeln.
move zcrd_info-zzccreqdat to t_zccdatad-zzccreqdat.
move zcrd_info-zzccreqtim to t_zccdatad-zzccreqtim.
move zcrd_info-ccmop to t_zccdatad-zzccmop.
move zcrd_info-ccard to t_zccdatad-zzccard.
move zcrd_info-ccexp to t_zccdatad-zzccexpdt.
move zcrd_info-ccref to t_zccdatad-zzccmbrno.
if zcrd_retn-zzavsrsp = 'n1'.
move 'n' to t_zccdatad-zzccavsavv.
else.
move 'y' to t_zccdatad-zzccavsavv.
endif.
move zcrd_info-value to t_zccdatad-zzccnetwr.
move zcrd_retn-zzerrrslt to t_zccdatad-zzccrestyp.
move zcrd_retn-zzrspno to t_zccdatad-zzccreason.
move zcrd_retn-zzrspdt to t_zccdatad-zzccrespdt.
move zcrd_retn-zzccresptm to t_zccdatad-zzccresptm.
move zcrd_retn-zzautcod to t_zccdatad-zzccauthcd.
move zcrd_retn-zzerractn to t_zccdatad-zzccaction.
move zcrd_retn-zzavsrsp to t_zccdatad-zzavsrsp.
move zcrd_retn-zzscvlrs to t_zccdatad-zzscvlrs.
if zcrd_retn-zzerrrslt = 's'.
select single zvalue1 from zliteral into zliteral-zvalue1 where
zkey1 = 'zccrd' and zkey2 = zcrd_info-ccmop and zkey3 = 0.
if zcrd_retn-zzrspno = '000'.
move 'y' to t_zccdatad-zzccbch.
endif.
move sy-datum to t_zccdatad-erdat.
move sy-uname to t_zccdatad-ernam.
append t_zccdatad.
* refresh t_bdc.
refresh t_bdc.
clear t_bdc.
clear t_bdc.
perform bdc_screen using 'sapmv45a' '0102'.
clear t_bdc.
perform bdc_field using 'vbak-vbeln' vbak-vbeln.
* press f5 detail
clear t_bdc.
perform bdc_field using 'bdc_okcode' '/5'.
clear t_bdc.
perform bdc_screen using 'sapmv45a' '4001'.
* overview shipping.
* clear t_bdc.
* perform bdc_field using 'bdc_okcode' 'uver'.
* clear t_bdc.
* perform bdc_screen using 'sapmv45a' '0403'.
clear t_bdc.
perform bdc_field using 'vbak-lifsk' ' '.
clear t_bdc.
perform bdc_field using 'bdc_okcode' 'sich'.
do 2 times.
call function 'rzl_sleep'
exporting
seconds = 4
exceptions
argument_error = 1
others = 2.
enddo.
*&---------------------------------------------------------------------*
*& form bdc_field
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form bdc_field using fname fval.
*&---------------------------------------------------------------------*
*& form bdc_screen
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form bdc_screen using progname screenno.
* refresh t_bdc.
refresh t_bdc.
clear t_bdc.
clear t_bdc.
perform bdc_screen using 'sapmv45a' '0102'.
clear t_bdc.
perform bdc_field using 'vbak-vbeln' vbak-vbeln.
* press f6 detail
clear t_bdc.
perform bdc_field using 'bdc_okcode' '=uer1'.
clear t_bdc.
perform bdc_screen using 'sapmv45a' '4001'.
* select all the lines.
* clear t_bdc.
* perform bdc_field using 'bdc_okcode' 'hkal'.
* item status.
* clear t_bdc.
* perform bdc_field using 'bdc_okcode' 'psta'.
* clear t_bdc.
* perform bdc_screen using 'sapmv45a' '0456'.
clear t_bdc.
perform bdc_field using 'bdc_okcode' '=t\03'.
clear t_bdc.
perform bdc_screen using 'sapmv45a' '4001'.
if ws_vbapl = 1.
clear t_bdc.
read table t_vbap index sy-index.
if sy-subrc = 0 and t_vbap-abgru = ' '.
perform bdc_field using 'vbap-abgru' 'c1'.
endif.
clear t_bdc.
perform bdc_field using 'bdc_okcode' '=sich'.
else.
do ws_vbapl times.
clear t_bdc.
read table t_vbap index sy-index.
if sy-subrc = 0 and t_vbap-abgru = ' '.
perform bdc_field using 'vbap-abgru' 'c1'.
endif.
if sy-index lt ws_vbapl.
clear t_bdc.
perform bdc_field using 'bdc_okcode' '=itpp'.
clear t_bdc.
perform bdc_screen using 'sapmv45a' '4001'.
else.
clear t_bdc.
perform bdc_field using 'bdc_okcode' '=sich'.
endif.
enddo.
endif.
if sy-subrc = 0.
*&---------------------------------------------------------------------*
*& form remov_reject
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form remov_reject tables t_vbap structure vbap.
* refresh t_bdc.
refresh t_bdc.
clear t_bdc.
clear t_bdc.
perform bdc_field using 'vbak-vbeln' vbak-vbeln.
* press f6 detail
clear t_bdc.
perform bdc_field using 'bdc_okcode' '=uer1'.
clear t_bdc.
perform bdc_screen using 'sapmv45a' '4001'.
* clear t_bdc.
* perform bdc_field using 'bdc_okcode' 'hkal'.
* item status.
* clear t_bdc.
* perform bdc_field using 'bdc_okcode' 'psta'.
clear t_bdc.
perform bdc_field using 'bdc_okcode' '=t\03'.
clear t_bdc.
perform bdc_screen using 'sapmv45a' '4001'.
if ws_vbapl = 1.
clear t_bdc.
read table t_vbap index sy-index.
if sy-subrc = 0 and ( t_vbap-abgru = 'c1' or
t_vbap-abgru = 'c2' or t_vbap-abgru = 'c3' ).
perform bdc_field using 'vbap-abgru' ' '.
endif.
clear t_bdc.
perform bdc_field using 'bdc_okcode' '=sich'.
else.
do ws_vbapl times.
clear t_bdc.
read table t_vbap index sy-index.
if sy-subrc = 0 and ( t_vbap-abgru = 'c1' or
t_vbap-abgru = 'c2' or t_vbap-abgru = 'c3' ).
perform bdc_field using 'vbap-abgru' ' '.
endif.
if sy-index lt ws_vbapl.
clear t_bdc.
perform bdc_field using 'bdc_okcode' '=itpp'.
clear t_bdc.
perform bdc_screen using 'sapmv45a' '4001'.
else.
clear t_bdc.
perform bdc_field using 'bdc_okcode' '=sich'.
endif.
enddo.
endif.
do 2 times.
call function 'rzl_sleep'
exporting
seconds = 4
exceptions
argument_error = 1
others = 2.
enddo.
ws_addr_sel-addrnumber = p_vbpa1_adrnr.
clear zvs13-zcland.
select * from usr05 into table i_usr05
where bname = sy-uname.
loop at i_usr05.
if i_usr05-parid = 'vko'. " parameter for sales org
select single * from tvko " read sales organization table
where vkorg = i_usr05-parva.
if sy-subrc = 0.
perform get_sadr_address using tvko-adrnr.
if sy-subrc = 0.
move ksadr-land1 to zvs13-zcland.
endif.
endif.
endif.
endloop.
if zvs13-zcland is initial.
move 'de' to zvs13-zcland.
endif.
if plant is initial.
clear eban-werks.
endif.
endmodule. " get_default_country output
*eject
*---------------------------------------------------------------------*
* form get_pr_plant_country
*
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form get_pr_plant_country using p_banfn "$10
p_bnfpo "$10
changing p_land1. "$10
if sy-subrc = 0. "$10
select single adrnr "$10
land1 "$10
from t001w "$10
into (w_adrnr, "$10
w_t001w_land1) "$10
where werks = w_werks. "$10
endif. "$10
if sy-subrc = 0. "$10
wc_addr1_sel-addrnumber = w_adrnr. "$10
call function 'addr_get' "$10
exporting "$10
address_selection = wc_addr1_sel "$10
importing "$10
sadr = w_sadr_t001w "$10
exceptions "$10
parameter_error = 1 "$10
address_not_exist = 2 "$10
version_not_exist = 3 "$10
internal_error = 4 "$10
others = 5. "$10
if sy-subrc = 0. "$10
move w_sadr_t001w-land1 to p_land1. "$10
else. "$10
move w_t001w_land1 to p_land1. " plant country. "$10
clear sy-subrc. "$10
endif. "$10
else. "$10
move 'de' to p_land1 . " plant country. "$10
endif. "$10