Skip to Content
0
Apr 07, 2006 at 05:04 AM

Error in" BAPI_GOODSMVT_CREATE"

51 Views

Hi All,

IM facing an error. <b>Posting date is initial</b>

Even i'm updating the date from the file.

can anyone explain why it's happening.

My code is as follows:

&----


*& Report ZBAPI_MIGO *

*& *

&----


*& *

*& *

&----


REPORT zbapi_migo .

DATA:BEGIN OF I_HEAD occurs 0.

include structure BAPI2017_GM_HEAD_01.

data: END OF I_HEAD.

DATA:BEGIN OF I_CODE .

include structure BAPI2017_GM_CODE.

data: END OF I_CODE.

DATA: BEGIN OF I_ITEM OCCURS 0.

include structure BAPI2017_GM_ITEM_CREATE.

data: END OF I_ITEM.

DATA: return TYPE TABLE OF bapiRET2 INITIAL SIZE 0 WITH HEADER LINE.

DATA: MATDOC type BAPI2017_GM_HEAD_RET-MAT_DOC.

*DATA: BEGIN OF mthead.

  • INCLUDE STRUCTURE bapi2017_gm_head_ret.

*DATA: END OF mthead.

DATA: BEGIN OF errmsg OCCURS 10.

INCLUDE STRUCTURE bapiret2.

DATA: END OF errmsg.

DATA: BEGIN OF i_data OCCURS 0,

po_no(10),

po_item(05),

mvt_type(03),

doc_date(08),

post_date(08),

del_note(16),

entry_qty(13),

stk_type(01),

batch(10),

ex_trans(02),

ex_inv(10),

ex_invdate(08),

END OF i_data.

SELECTION-SCREEN BEGIN OF BLOCK main WITH FRAME TITLE text-001.

PARAMETERS: path LIKE rlgrap-filename OBLIGATORY

DEFAULT 'C:/'.

SELECTION-SCREEN END OF BLOCK main.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR path.

CALL FUNCTION 'F4_FILENAME'

  • EXPORTING

  • PROGRAM_NAME = 'ZBAPI_MIGO'

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = path

.

START-OF-SELECTION.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = path

FILETYPE = 'DAT'

TABLES

data_tab = i_data

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

NO_AUTHORITY = 10

OTHERS = 11

.

IF sy-subrc <> 0.

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

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

ENDIF.

i_CODE-GM_CODE = '01'.

i_item-mvt_ind = 'B'.

loop at i_data.

i_ITEM-PO_NUMBER = I_DATA-po_no.

i_ITEM-PO_ITEM = I_DATA-po_item.

I_ITEM-MOVE_TYPE = i_data-mvt_type.

I_head-DOC_DATE = i_data-doc_date.

i_head-PSTNG_DATE = i_data-post_date.

I_head-REF_DOC_NO = i_data-del_note.

I_ITEM-ENTRY_QNT = i_data-entry_qty.

I_ITEM-STCK_TYPE = i_data-stk_type.

I_ITEM-BATCH = i_data-batch.

append: i_item,i_head.

clear:i_item,i_head.

endloop.

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

goodsmvt_header = i_head

goodsmvt_code = i_code

  • TESTRUN = ' '

IMPORTING

  • GOODSMVT_HEADRET =

MATERIALDOCUMENT = matdoc

  • MATDOCUMENTYEAR =

tables

goodsmvt_item = i_item

  • GOODSMVT_SERIALNUMBER =

return = return

.

if return is initial.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

endif.

loop at return.

write: return-message.

endloop.

write: matdoc.

Plesae rectify the error.