mallik


{ City } hyderabad
< Country > india
* Profession *
User No # 25214
Total Questions Posted # 0
Total Answers Posted # 1

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 0
Users Marked my Answers as Wrong # 4
Questions / { mallik }
Questions Answers Category Views Company eMail




Answers / { mallik }

Question { IBM, 15944 }

how to create bdc for sales order ? if any one kow the
steps plz mail me at toamitshri@gmail.com


Answer

report ZTEST_BDC_MA
no standard page heading line-size 255.

*DATA: ld_file LIKE rlgrap-filename.
DATA: gd_file type string.

*Internal tabe to store upload data
TYPES: BEGIN OF t_record,
AUART LIKE VBAK-AUART,
VKORG LIKE VBAK-VKORG,
VTWEG LIKE VBAK-VTWEG,
SPART LIKE VBAK-SPART,
KUNNR LIKE KUAGV-KUNNR,
KUNNR1 LIKE KUAGV-KUNNR,
MATNR LIKE MARA-MATNR,
PRCTR LIKE COBL-PRCTR,
END OF t_record.

DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL
SIZE 0,
wa_record TYPE t_record.

*Text version of data table
TYPES: BEGIN OF t_uploadtxt,
AUART LIKE VBAK-AUART,
VKORG LIKE VBAK-VKORG,
VTWEG LIKE VBAK-VTWEG,
SPART LIKE VBAK-SPART,
KUNNR LIKE KUAGV-KUNNR,
KUNNR1 LIKE KUAGV-KUNNR,
MATNR LIKE MARA-MATNR,
PRCTR LIKE COBL-PRCTR,
END OF t_uploadtxt.

*Used to store BDC data
DATA: BEGIN OF bdc_tab OCCURS 0.
INCLUDE STRUCTURE bdcdata.
DATA: END OF bdc_tab.

*Used to stores error information from CALL TRANSACTION
Function Module
*DATA: BEGIN OF messtab OCCURS 0.
* INCLUDE STRUCTURE bdcmsgcoll.
*DATA: END OF messtab.

gd_file = ' Your workstation file name'.

CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gd_file
has_field_separator = 'X' "file is TAB delimited
TABLES
data_tab = it_record
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.

IF sy-subrc NE 0.
write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD
FM'.
skip.
endif.

include bdcrecx1.

start-of-selection.

perform open_group.

Loop at it_record into wa_record.

perform bdc_dynpro using 'SAPMV45A' '0101'.

perform bdc_field using 'VBAK-AUART'
wa_record-auart.
perform bdc_field using 'VBAK-VKORG'
wa_record-vkorg.
perform bdc_field using 'VBAK-VTWEG'
wa_record-vtweg.
perform bdc_field using 'VBAK-SPART'
wa_record-spart.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'KUAGV-KUNNR'
wa_record-kunnr.
perform bdc_field using 'KUWEV-KUNNR'
wa_record-kunnr1.
perform bdc_field using 'BDC_CURSOR'
'RV45A-KWMENG(01)'.
perform bdc_field using 'RV45A-MABNR(01)'
wa_record-matnr.
perform bdc_field using 'RV45A-KWMENG(01)'
' 1'.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=ITEM'.
perform bdc_field using 'KUAGV-KUNNR'
wa_record-kunnr.
perform bdc_field using 'KUWEV-KUNNR'
wa_record-kunnr1.
perform bdc_field using 'BDC_CURSOR'
'RV45A-MABNR(01)'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=T\07'.
perform bdc_field using 'BDC_CURSOR'
'RV45A-KWMENG'.
perform bdc_field using 'RV45A-KWMENG'
' 1,000'.
perform bdc_field using 'VBAP-VRKME'
'TA'.
perform bdc_field using 'RV45A-ETDAT'
'10.04.2010'.
perform bdc_field using 'RV45A-PRGBZ'
'D'.
perform bdc_field using 'VBKD-PRSDT'
'10.04.2010'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=T\06'.
perform bdc_field using 'BDC_CURSOR'
'VBAP-ABGRS'.
perform bdc_field using 'DKACB-FMORE'
'X'.
perform bdc_dynpro using 'SAPLKACB' '0002'.
perform bdc_field using 'BDC_CURSOR'
'COBL-PRCTR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTE'.
perform bdc_field using 'COBL-PRCTR'
wa_record-prctr.
perform bdc_dynpro using 'SAPMV45A' '5003'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'KOMV-KSCHL(07)'.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
perform bdc_field using 'KUAGV-KUNNR'
wa_record-kunnr.
perform bdc_field using 'KUWEV-KUNNR'
wa_record-kunnr1.
perform bdc_field using 'BDC_CURSOR'
'RV45A-MABNR(02)'.
perform bdc_transaction using 'VA01'.

endloop.

perform close_group.

Is This Answer Correct ?    0 Yes 4 No