Skip to Content

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

Error in BDC Program..Please help me

Hi,

below is my BDC program Please let me know the error.

TYPES:BEGIN OF TY_CCENTER,

CARE TYPE BAPI0012_GEN-CO_AREA,

CCENTER TYPE BAPI0012_CCINPUTLIST-costcenter,

VALIDFROM TYPE BAPI0012_CCINPUTLIST-VALID_FROM,

VALIDTO TYPE BAPI0012_CCINPUTLIST-VALID_TO,

NAME TYPE BAPI0012_CCINPUTLIST-NAME,

INCHARGE TYPE BAPI0012_CCINPUTLIST-PERSON_IN_CHARGE,

CCENTERTYPE TYPE BAPI0012_CCINPUTLIST-COSTCENTER_TYPE,

HIREAREA TYPE BAPI0012_CCINPUTLIST-COSTCTR_HIER_GRP,

BUSSAREA TYPE BAPI0012_CCINPUTLIST-BUS_AREA,

PCENTER TYPE BAPI0012_CCINPUTLIST-PROFIT_CTR,

END OF TY_CCENTER.

DATA: IT_CCENTER TYPE TABLE OF TY_CCENTER,

WA_CCENTER TYPE TY_CCENTER.

DATA:IT_RETURN TYPE TABLE OF BAPIRET2,

WA_RETURN LIKE LINE OF IT_RETURN.

DATA: WA_CAREA TYPE BAPI0012_GEN-CO_AREA.

DATA: CCLIST TYPE TABLE OF BAPI0012_CCINPUTLIST,

WA_CCLIST LIKE LINE OF CCLIST.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'E:\KS01_BAPI.txt'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = '#'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = IT_CCENTER

  • 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.

BREAK SAPUSER.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LOOP AT IT_CCENTER INTO WA_CCENTER.

MOVE WA_CCENTER TO WA_CAREA.

move WA_CCENTER to WA_CCLIST.

APPEND WA_CCLIST TO cclist.

ENDLOOP.

CALL FUNCTION 'BAPI_COSTCENTER_CREATEMULTIPLE'

EXPORTING

CONTROLLINGAREA = WA_CAREA

  • TESTRUN = ' '

  • MASTER_DATA_INACTIVE = ' '

TABLES

COSTCENTERLIST = CCLIST

RETURN = IT_RETURN.

  • EXTENSIONIN =

  • EXTENSIONOUT =

BREAK SAPUSER.

read TABLE IT_RETURN INTO WA_RETURN with key TYPE = 'E'. .

IF SY-SUBRC = 0.

LOOP AT IT_RETURN INTO WA_RETURN WHERE TYPE = 'E'.

WRITE: WA_RETURN-TYPE , WA_RETURN-ID , WA_RETURN-MESSAGE.

ENDLOOP.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

    • WAIT =

  • IMPORTING

  • RETURN = IT_RETURN

.

LOOP AT IT_RETURN INTO WA_RETURN WHERE TYPE <> 'E'.

WRITE : / WA_RETURN-TYPE , WA_RETURN-ID , WA_RETURN-MESSAGE.

ENDLOOP.

ENDIF.

Thanks,

Lawrence

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