Skip to Content

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

Please let me know where is the Error in BAPI...

Hi,

I'm practicing on BAPI...

Below is my code , data and error im getting Please let me know ASAP...

Thanks in advace.

REPORT ZP_BAPI_PROFITCENTER_PRC.

TYPES:BEGIN OF PCENTER,

CO_ARE TYPE BAPI0015ID2-CO_AREA,

P_CENTER TYPE BAPI0015ID2-PROFIT_CTR,

VFROM TYPE BAPI0015_3-DATE,

VTO TYPE BAPI0015_3-DATE,

P_NAME TYPE BAPI0015_4-PRCTR_NAME,

P_RES TYPE BAPI0015_4-IN_CHARGE,

P_CENTER_GRP TYPE BAPI0015_4-PRCTR_HIER_GRP,

END OF PCENTER.

DATA:IT_PCENTER TYPE TABLE OF PCENTER,

WA_PCENTER TYPE PCENTER.

DATA: IT_RET TYPE TABLE OF BAPIRET2,

WA_RET TYPE BAPIRET2.

DATA: PCENTER_ID TYPE BAPI0015ID2.

DATA: VALIDFROM TYPE BAPI0015_3-DATE.

DATA: DATE1 TYPE BAPI0015_3-DATE.

DATA: DATE2 TYPE BAPI0015_3-DATE.

DATA: VALIDTO TYPE BAPI0015_3-DATE.

DATA:IT_BASICDATA TYPE TABLE OF BAPI0015_4,

WA_BASICDATA TYPE BAPI0015_4.

DATA: P_CENTER TYPE BAPI0015ID2-PROFIT_CTR.

DATA: CON_AREA TYPE BAPI0015ID2-CO_AREA.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'E:\ZP_PRCt.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_PCENTER

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.

LOOP AT IT_PCENTER INTO WA_PCENTER.

PCENTER_ID = WA_PCENTER .

WA_BASICDATA-PRCTR_NAME = WA_PCENTER-P_NAME.

WA_BASICDATA-IN_CHARGE = WA_PCENTER-P_RES.

WA_BASICDATA-PRCTR_HIER_GRP = WA_PCENTER-P_CENTER_GRP.

APPEND WA_BASICDATA TO IT_BASICDATA.

P_CENTER = WA_PCENTER-P_CENTER .

CON_AREA = WA_PCENTER-CO_ARE.

PCENTER_ID = WA_PCENTER.

CALL FUNCTION 'BAPI_PROFITCENTER_CREATE'

EXPORTING

PROFITCENTERID = PCENTER_ID

VALIDFROM = DATE1

VALIDTO = DATE2

BASICDATA = WA_basicdata

  • ADDRESS =

  • COMMUNICATION =

  • INDICATORS =

  • TESTRUN =

  • LANGUAGE =

IMPORTING

RETURN = WA_RET

PROFITCENTER = P_CENTER

CONTROLLINGAREA = CON_AREA

  • TABLES

  • COMPANYCODES =

.

READ TABLE IT_ret INTO wa_ret WITH KEY type = 'E'.

IF sy-subrc = 0.

LOOP AT IT_ret INTO wa_ret WHERE type = 'E'.

WRITE: / wa_ret-type,wa_ret-id,wa_ret-message.

ENDLOOP.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .

LOOP AT IT_ret INTO wa_ret WHERE type <> 'E'.

WRITE: / wa_ret-type, wa_ret-id, wa_ret-message.

ENDLOOP.

*ELSE.

WRITE: / sy-tabix, wa_ret-message.

ENDIF.

ENDLOOP.

.

Data:

6000 4987 01012008 31129999 BIN HIM DM

Error:

0

Internal error :invalid_format:4987

0

Internal error :invalid_format:4987

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