*&---------------------------------------------------------------------*
*& Report Z_TEMP_UPLOAD *
*& *
*&---------------------------------------------------------------------*
*& *
*& Author tech.sap29@gmail.com *
*&---------------------------------------------------------------------*
REPORT Z_TEMP_UPLOAD .
DATA : ITAB TYPE TABLE OF ZIT_FI01,
WA TYPE ZIT_FI01.
DATA : IT_BDCDATA TYPE TABLE OF BDCDATA,
WA_BDCDATA TYPE BDCDATA.
PERFORM FILE1_UPLOAD USING 'D:\FI01.TXT' 'T' CHANGING ITAB .
LOOP AT ITAB INTO WA .
PERFORM BDC_DYNPRO USING 'SAPMF02B' '0100'.
PERFORM BDC_FIELD USING 'BNKA-BANKS' WA-BANKS .
PERFORM BDC_FIELD USING 'BNKA-BANKL' WA-BANKL .
PERFORM BDC_FIELD USING 'BDC_OKCODE' '/00'.
PERFORM BDC_DYNPRO USING 'SAPMF02B' '0110'.
PERFORM BDC_FIELD USING 'BNKA-BANKA' WA-BANKA.
CALL TRANSACTION 'FI01' USING IT_BDCDATA.
ENDLOOP.
*&---------------------------------------------------------------------*
*& Form BDC_DYNPRO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0038 text
* -->P_0039 text
*----------------------------------------------------------------------*
form BDC_DYNPRO using PROG TYPE C
DYNP TYPE C .
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = PROG.
WA_BDCDATA-DYNPRO = DYNP.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO IT_BDCDATA.
endform. " BDC_DYNPRO
*&---------------------------------------------------------------------*
*& Form BDC_FIELD
*&---------------------------------------------------------------------*
form BDC_FIELD using FNAME TYPE C
FVAL TYPE C.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = FNAME .
WA_BDCDATA-FVAL = FVAL .
APPEND WA_BDCDATA TO IT_BDCDATA.
endform. " BDC_FIELD
*&---------------------------------------------------------------------*
*& Form FILE1_UPLOAD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0026 text
* -->P_0027 text
* <--P_ITAB text
*----------------------------------------------------------------------*
form FILE1_UPLOAD using FP_FILE TYPE STRING
FP_SP TYPE C
changing ITAB TYPE STANDARD TABLE .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = FP_FILE
* FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'T'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
tables
data_tab = ITAB
* 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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " FILE1_UPLOAD
No comments:
Post a Comment