Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

bdc

i wrote the following code for MM02 bdc.but only one record is getting fetched into my internal table and also im getting the message ' UNABLE TO UPLOAD DATA FROM FLAT FILE' with sy-subrc = 8. why sy-subrc = 8 even though there is 0ne record in the internal table.please help. .

report ZPP_MM02

no standard page heading line-size 255.

TYPES : BEGIN OF TY_ITAB,

MATNR TYPE MATNR,

WERKS TYPE WERKS,

QKZVERF TYPE QKZVERF,

AKTIV TYPE AKTIV,

END OF TY_ITAB.

****************************************************************************

***********************************************************************

*& Internal Tables Declaration

***********************************************************************

DATA : IT_ITAB TYPE TABLE OF TY_ITAB WITH HEADER LINE,

IT_BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE,

IT_BDCMSGCOLL TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE.

****************************************************************************

*& DATA Declaration

***********************************************************************

DATA : P_FILE1 TYPE STRING ,"FILE NAME

V_LINES TYPE I,

FNAM(20) TYPE C,

V_MSG TYPE CHAR_132,

V_SUC_CNT TYPE INT2,

TABIX TYPE I,

NUMBER TYPE I,

IDX TYPE C.

************************************************************************

*& SELECTION-SCREEN DECLARATION

************************************************************************

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETERS : P_FILE TYPE LOCALFILE OBLIGATORY."FILE NAME

SELECTION-SCREEN END OF BLOCK B1 .

************************************************************************

  • AT-SELECTION-SCREEN DECALRATION *

  • *

************************************************************************

----


AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

----


clear : P_FILE.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

IMPORTING

FILE_NAME = P_FILE.

IF P_FILE IS NOT INITIAL.

  • VALIDATE FILE TYPE

PERFORM SUB_VALIDATE_txt_TYPE.

ENDIF.

************************************************************************

  • START-OF-SELECTION

************************************************************************

start-of-selection.

perform upload.

perform bdc.

&----


*& Form upload

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM upload .

clear : P_FILE1.

P_FILE1 = P_FILE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = P_FILE1

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = IT_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.

endif.

BREAK-POINT.

*IF SY-SUBRC <> 0 OR IT_ITAB[] IS INITIAL.

IF IT_ITAB[] IS INITIAL.

  • UNABLE TO UPLOAD DATA FROM FLAT FILE

MESSAGE I003(ZMSG).

ENDIF.

ENDFORM.

Former Member
Not what you were looking for? View more on this topic or Ask a question