Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Routing BDC

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 6

*&---------------------------------------------------------------------*

*& Report ZROUTE_CA01_TEST *


*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
report zroute_ca01_test
no standard page heading line-size 255.
include zpl_bdcrecx1.
*Include ZBDCRECC_CA01.
data: begin of ty_data occurs 0,
matnr(18),
werks(4),
verwe(3),
statu(3),
vornr(4),
arbpl(8),
vgw02(9),
vge02(3),
end of ty_data.
data: counter(02) type n value '00',
final1(20),
final2(20),
final3(20),
final4(20),
final5(20).
start-of-selection.
perform open_group.
perform upload_data.
perform bdc_populate.
perform close_group.
end-of-selection.
*&--------------------------------------------------------------------*
*& Form upload_data
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
form upload_data.
call function 'UPLOAD'
exporting
* CODEPAGE = ' '
filename = ' '
filetype = 'DAT'
* ITEM = ' '
* FILEMASK_MASK = ' '
* FILEMASK_TEXT = ' '
* FILETYPE_NO_CHANGE = ' '
* FILEMASK_ALL = ' '
* FILETYPE_NO_SHOW = ' '
* LINE_EXIT = ' '
* USER_FORM = ' '
* USER_PROG = ' '
* SILENT = 'S'
* IMPORTING
* FILESIZE =
* CANCEL =
* ACT_FILENAME =
* ACT_FILETYPE =
tables
data_tab = ty_data
exceptions
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
others = 7
.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. "upload_data

*&--------------------------------------------------------------------*
*& Form bdc_populate
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
form bdc_populate.
*{ INSERT &$&$&$&$ 1
* Change to Add Material Number to Each Line in the Internal Table
data : l_matnr type matnr.
loop at ty_data.
if ty_data-matnr is not initial .
clear l_matnr.
l_matnr = ty_data-matnr.
endif.
if ty_data-matnr is initial.
ty_data-matnr = l_matnr .
modify ty_data transporting matnr.
endif.
endloop.

*
*} INSERT
sort ty_data by matnr vornr.
delete adjacent duplicates from ty_data comparing all fields .
*delete adjacent duplicates from ty_data COMPARING VORNR .
clear ty_data.
loop at ty_data.
on change of ty_data-matnr.
clear counter .
perform bdc_dynpro using 'SAPLCPDI' '1010'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PROFIDNETZ'.
perform bdc_field using 'BDC_OKCODE'
'=ALD1'.
perform bdc_field using 'RC27M-MATNR'
ty_data-matnr.
perform bdc_field using 'RC27M-WERKS'
ty_data-werks.
perform bdc_field using 'RC271-PLNNR'
''.
perform bdc_field using 'RC271-STTAG'
'31.01.2005'.
perform bdc_field using 'RC271-PROFIDNETZ'
'1'.
perform bdc_dynpro using 'SAPLCPDI' '1200'.
perform bdc_field using 'BDC_CURSOR'
'RC27X-ENTRY_ACT'.
perform bdc_field using 'BDC_OKCODE'
'=ANLG'.
perform bdc_dynpro using 'SAPLCPDA' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=VOUE'.
* Commented out on 02/02/2005
* perform bdc_field using 'PLKOD-PLNAL'
* '1'.
* End of Comment
perform bdc_field using 'PLKOD-VERWE'
ty_data-verwe.
perform bdc_field using 'PLKOD-STATU'
ty_data-statu.
*perform bdc_field using 'PLKOD-LOSBS'
* '99,999,999'.
*perform bdc_field using 'PLKOD-PLNME'
* 'MTS'.
perform bdc_field using 'BDC_CURSOR'
'PLKOD-PPKZTLZU'.
perform bdc_field using 'PLKOD-SLWBEZ'
'320'.
perform bdc_field using 'PLKOD-PPKZTLZU'
'2'.
*perform bdc_dynpro using 'SAPLCPDI' '1400'.
*perform bdc_field using 'BDC_CURSOR'
* 'PLPOD-VORNR(01)'.
*perform bdc_field using 'BDC_OKCODE'
* '=VOD1'.
endon.

perform bdc_dynpro using 'SAPLCPDI' '1400'.


perform bdc_field using 'BDC_CURSOR'
'PLPOD-VORNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'=VOD1'.
if not counter is initial.
perform bdc_field using final1 "'RC27X-FLG_SEL(01)'
' '.
endif.
add 1 to counter.
clear: final1,final2,final3,final4,final5.
concatenate 'RC27X-FLG_SEL(' counter ')' into final1.
concatenate 'PLPOD-VORNR(' counter ')' into final2.
concatenate 'PLPOD-ARBPL(' counter ')' into final3.
concatenate 'PLPOD-VGW02(' counter ')' into final4.
concatenate 'PLPOD-VGE02(' counter ')' into final5.
perform bdc_field using final1 "'RC27X-FLG_SEL(01)'
'X'.
perform bdc_field using final2 "'PLPOD-VORNR(01)'
ty_data-vornr. ".'0400'.
perform bdc_field using final3 "'PLPOD-ARBPL(01)'
ty_data-arbpl. "'CRS01'.
perform bdc_field using final4
ty_data-vgw02.
perform bdc_field using final5
ty_data-vge02.
perform bdc_dynpro using 'SAPLCPDO' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
*perform bdc_field using 'PLPOD-VORNR'
* '0400'.
*perform bdc_field using 'PLPOD-ARBPL'
* 'CRS01'.
*perform bdc_field using 'PLPOD-WERKS'
* 'SBST'.
*perform bdc_field using 'PLPOD-STEUS'
* 'ZP04'.
*perform bdc_field using 'PLPOD-BMSCH'
* '1'.
*perform bdc_field using 'PLPOD-MEINH'
* 'MTS'.
*perform bdc_field using 'PLPOD-UMREZ'
* '1'.
*perform bdc_field using 'PLPOD-UMREN'
* '1'.
*perform bdc_field using 'PLPOD-VGW02'
* '1.2'.
*perform bdc_field using 'PLPOD-VGE02'
* 'MIN'.
*perform bdc_field using 'PLPOD-LAR02'
* 'PR001'.
*perform bdc_field using 'PLPOD-ZERMA'
* '1'.
*perform bdc_field using 'PLPOD-UENICHT'
* 'X'.
*perform bdc_field using 'PLPOD-LOANZ'
* '2'.
*perform bdc_field using 'PLPOD-RSANZ'
* '2'.
*perform bdc_field using 'PLPOD-CKSELKZ'
* 'X'.
*perform bdc_field using 'PDORQ-QSEL1'
* 'X'.
perform bdc_field using 'BDC_CURSOR'
'PLPOD-QKZZTMG1'.
perform bdc_field using 'PLPOD-QKZPRINI'
''.
perform bdc_field using 'PLPOD-QKZPRZEIT'
'X'.
perform bdc_field using 'PLPOD-QRASTZFAK'
'1'.
perform bdc_field using 'PLPOD-QRASTZEHT'
'MIN'.
perform bdc_field using 'PLPOD-QKZZTMG1'
'X'.
perform bdc_dynpro using 'SAPLCPDO' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
*perform bdc_field using 'BDC_CURSOR'
* 'PLPOD-VORNR'.
*perform bdc_field using 'PLPOD-VORNR'
* '0400'.
*perform bdc_field using 'PLPOD-ARBPL'
* 'CRS01'.
*perform bdc_field using 'PLPOD-WERKS'
* 'SBST'.
*perform bdc_field using 'PLPOD-STEUS'
* 'ZP04'.
*perform bdc_field using 'PLPOD-BMSCH'
* '1'.
*perform bdc_field using 'PLPOD-MEINH'
* 'MTS'.
*perform bdc_field using 'PLPOD-UMREZ'
* '1'.
*perform bdc_field using 'PLPOD-UMREN'
* '1'.
*perform bdc_field using 'PLPOD-VGW02'
* ty_data-vgw02.
*perform bdc_field using 'PLPOD-VGE02'
* ty_data-vge02.
*perform bdc_field using 'PLPOD-LAR02'
* 'PR001'.
*perform bdc_field using 'PLPOD-ZERMA'
* '1'.
*perform bdc_field using 'PLPOD-UENICHT'
* 'X'.
*perform bdc_field using 'PLPOD-LOANZ'
* '2'.
*perform bdc_field using 'PLPOD-RSANZ'
* '2'.
*perform bdc_field using 'PLPOD-CKSELKZ'
* 'X'.
*perform bdc_field using 'PDORQ-QSEL1'
* 'X'.
*perform bdc_field using 'PLPOD-QKZPRZEIT'
* 'X'.
*perform bdc_field using 'PLPOD-QRASTZFAK'
* '1.00'.
*perform bdc_field using 'PLPOD-QRASTZEHT'
* 'MIN'.
*perform bdc_field using 'PLPOD-QKZZTMG1'
* 'X'.
at end of matnr.
perform bdc_dynpro using 'SAPLCPDI' '1400'.
perform bdc_field using 'BDC_CURSOR'
'PLPOD-VORNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
*perform bdc_field using 'RC27X-ENTRY_ACT'
* '1'.
*perform bdc_field using 'RC27X-FLG_SEL(01)'
* 'X'.
perform bdc_transaction using 'CA01'.
endat.
endloop.
endform. "bdc_populate
*perform close_group.

You might also like