BDC For Vd01 Customer
BDC For Vd01 Customer
BDC For Vd01 Customer
START-OF-SELECTION.
PERFORM GET_DATA.
*-- Session method
* performopen_group.
PERFORM OPEN_SESSION.
LOOP AT LT_CUST INTO LW_CUST WHERE KUNNR NE SPACE.
REFRESH LT_BDCDATA.
*-- 1st
PERFORM BDC_DYNPRO
USING 'SAPMF02D' '0107'.
PERFORM BDC_FIELD
USING 'BDC_CURSOR' 'RF02D-KTOKD'.
PERFORM BDC_FIELD
USING 'BDC_OKCODE' '/00'.
PERFORM BDC_FIELD
USING 'RF02D-KUNNR' LW_CUST-KUNNR.
PERFORM BDC_FIELD
USING 'RF02D-VKORG' LW_CUST-VKORG.
PERFORM BDC_FIELD
USING 'RF02D-VTWEG' LW_CUST-VTWEG.
PERFORM BDC_FIELD
USING 'RF02D-SPART' LW_CUST-SPART.
PERFORM BDC_FIELD
USING 'RF02D-KTOKD' '0001'.
* --2nd
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
BDC_DYNPRO
BDC_FIELD
BDC_FIELD
BDC_FIELD
BDC_FIELD
BDC_FIELD
BDC_FIELD
BDC_FIELD
BDC_FIELD
BDC_FIELD
BDC_FIELD
BDC_FIELD
* -- 3rd
PERFORM BDC_DYNPRO
USING 'SAPMF02D' '0120'.
PERFORM BDC_FIELD
USING 'BDC_CURSOR' 'KNA1-LZONE'.
PERFORM BDC_FIELD
PERFORM BDC_FIELD
*-- 4th
PERFORM BDC_DYNPRO
USING 'SAPMF02D' '0125'.
PERFORM BDC_FIELD
USING 'BDC_CURSOR' 'KNA1-NIELS'.
PERFORM BDC_FIELD
USING 'BDC_OKCODE' '=VW'.
*--5th
PERFORM BDC_DYNPRO
USING 'SAPMF02D' '0340'.
PERFORM BDC_FIELD
USING 'BDC_CURSOR' 'RF02D-KUNNR'.
PERFORM BDC_FIELD
USING 'BDC_OKCODE' '=VW'.
*--6th
PERFORM
PERFORM
PERFORM
PERFORM
BDC_DYNPRO
USING 'SAPMF02D' '0370'.
BDC_FIELD
USING 'BDC_CURSOR' 'RF02D-KUNNR'.
BDC_FIELD
USING 'BDC_OKCODE' '=VW'.
BDC_FIELD
USING 'KNA1-CIVVE' 'X'.
*--7th
PERFORM BDC_DYNPRO
USING 'SAPMF02D' '0360'.
PERFORM BDC_FIELD
USING 'BDC_CURSOR' 'KNVK-NAMEV(01)'.
PERFORM BDC_FIELD
USING 'BDC_OKCODE' '=VW'.
*--8th
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
BDC_DYNPRO
BDC_FIELD
BDC_FIELD
BDC_FIELD
BDC_FIELD
BDC_FIELD
*--9th
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
PERFORM
BDC_DYNPRO
BDC_FIELD
BDC_FIELD
BDC_FIELD
BDC_FIELD
BDC_FIELD
*--10th
PERFORM BDC_DYNPRO
USING 'SAPMF02D' '0320'.
PERFORM BDC_FIELD
USING 'BDC_CURSOR' 'KNVV-PERFK'.
PERFORM BDC_FIELD
USING 'BDC_OKCODE' '=VW'.
*--11th
PERFORM
PERFORM
PERFORM
PERFORM
BDC_DYNPRO
USING 'SAPMF02D' '1350'.
BDC_FIELD
USING 'BDC_CURSOR' 'KNVI-TAXKD(01)'.
BDC_FIELD
USING 'BDC_OKCODE' '=UPDA'.
BDC_FIELD
USING 'KNVI-TAXKD(01)' '0'.
*--end of 11
* perform bdc_transaction using 'VD01'.
PERFORM SESSION_METHOD.
CLEAR LW_CUST.
ENDLOOP.
* performclose_group.
PERFORM CLOSE_SESSION.
*&---------------------------------------------------------------------*
*&Form GET_DATA
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM GET_DATA .
DATA : L_FNM TYPE STRING.
L_FNM = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME
= L_FNM
FILETYPE
= 'ASC'
HAS_FIELD_SEPARATOR
= '#'
* HEADER_LENGTH
=0
* READ_BY_LINE
= 'X'
* DAT_MODE
=''
* CODEPAGE
=''
* IGNORE_CERR
= ABAP_TRUE
* REPLACEMENT
= '#'
* CHECK_BOM
=''
* VIRUS_SCAN_PROFILE
=
* NO_AUTH_CHECK
=''
* IMPORTING
* FILELENGTH
=
* HEADER
=
TABLES
DATA_TAB
= LT_CUST
EXCEPTIONS
FILE_OPEN_ERROR
=1
FILE_READ_ERROR
=2
NO_BATCH
=3
GUI_REFUSE_FILETRANSFER
=4
INVALID_TYPE
=5
NO_AUTHORITY
=6
UNKNOWN_ERROR
=7
BAD_DATA_FORMAT
=8
HEADER_NOT_ALLOWED
=9
SEPARATOR_NOT_ALLOWED
= 10
HEADER_TOO_LONG
= 11
UNKNOWN_DP_ERROR
= 12
ACCESS_DENIED
= 13
DP_OUT_OF_MEMORY
= 14
DISK_FULL
= 15
DP_TIMEOUT
= 16
OTHERS
= 17
.
IF SY-SUBRC <> 0.
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM SESSION_METHOD .
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE
= 'VD01'
TABLES
DYNPROTAB
= LT_BDCDATA
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN
=2
QUEUE_ERROR
=3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 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." SESSION_METHOD
*----------------------------------------------------------------------*
*
-->PROGRAM text
*
-->DYNPRO
text
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR LW_BDCDATA.
LW_BDCDATA-PROGRAM = PROGRAM.
LW_BDCDATA-DYNPRO = DYNPRO.
LW_BDCDATA-DYNBEGIN = 'X'.
APPEND LW_BDCDATA TO LT_BDCDATA.
ENDFORM.
"BDC_DYNPRO
*&---------------------------------------------------------------------*
*&Form BDC_FIELD
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
*
-->FNAM
text
*
-->FVAL
text
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
CLEAR LW_BDCDATA.
LW_BDCDATA-FNAM = FNAM.
LW_BDCDATA-FVAL = FVAL.
APPEND LW_BDCDATA TO LT_BDCDATA.
ENDFORM.
"BDC_FIELD