Professional Documents
Culture Documents
Written by Reddy
Saturday, 10 November 2007 23:11 - Last Updated Tuesday, 06 November 2007 23:17
The scenerio is
Input fields: Manditory fields to create a new Sales Order using VA01.
Hint: Take an existing Sales Order and use the master data which was previously used.
Conditions:
1)Upload the input data from a text file stored in your note pc.
2)Use call transaction method.
3)Your program should allow to input the file path and file name to select the data.
report ZBDC3_VA01
no standard page heading line-size 255.
include bdcrecx1.
1/4
data:v_kwmeng(30) type c,
v_mabnr(30) type c.
DATA: VAL(2) TYPE N VALUE 01.
DATA : w_file2 TYPE string,
w_file1 TYPE string.
PARAMETERS: filename LIKE rlgrap-filename.
PARAMETERS: filenam1 LIKE rlgrap-filename.
START-OF-SELECTION.
w_file2 = filename.
w_file1 = filenam1.
*************** HEADER ************************
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = w_file2
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = it_head.
2/4
filename = w_file1
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = it_item.
perform open_group.
loop at it_head into wa_head.
.
perform bdc_dynpro using 'SAPMV45A' '0101'.
perform bdc_field using 'BDC_CURSOR'
'VBAK-AUART'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'VBAK-AUART'
WA_HEAD-AUART.
perform bdc_field using 'VBAK-VKORG'
WA_HEAD-VKORG.
perform bdc_field using 'VBAK-VTWEG'
WA_HEAD-VTWEG.
perform bdc_field using 'VBAK-SPART'
WA_HEAD-SPART.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'VBKD-BSTKD'
WA_HEAD-BSTKD.
perform bdc_field using 'VBKD-BSTDK'
'30.01.2006'.
perform bdc_field using 'KUAGV-KUNNR'
WA_HEAD-KUNNR.
perform bdc_field using 'RV45A-KETDAT'
'30.01.2006'.
perform bdc_field using 'RV45A-KPRGBZ'
'D'.
perform bdc_field using 'VBKD-ZTERM'
'0001'.
perform bdc_field using 'VBKD-INCO1'
'CIF'.
perform bdc_field using 'VBKD-INCO2'
'COST INSUSRABCE FRIEGHT'.
3/4
VAL = VAL + 1.
IF VAL > 5.
VAL = 5.
ENDIF.
endloop.
VAL = 01.
4/4