Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Error in" BAPI_GOODSMVT_CREATE"

Simha_
Employee
Employee
0 Kudos

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.

10 REPLIES 10

Former Member
0 Kudos

Hi,

You need to fill i_head outside the loop.

PSTNG_DATE is getting cleared in the loop because of

clear:i_item,i_head.

Hope it helps.

Regards,

Shashank.

abdul_hakim
Active Contributor
0 Kudos

i dont think clear will be causing this problem.just check in debugging mode whether dates are coming properly from your itab.

Cheers,

Abdul Hakim

0 Kudos

Hi,

Thanks for the reply.

What should be the dateformat while uploading.

Can u please specify the format.

Regards,

Simha.

0 Kudos

the internal SAP format is YYYYMMDD.But you can upload in the legacy format as well ie,DD.MM.YYYY

If you get any error while passing this value plz let us know..

Cheers,

Abdul Hakim

0 Kudos

Hi Abdul,

Thanks for the reply.

Im uploading in the DD.MM.YYYY format.

it's giving error.

How could i solve this as SAP format is YYYYMMDD.

PLease help me.

Anyway I will reward u points.

Regards,

SImha.

0 Kudos

Use the function module <b>CONVERT_DATE_TO_INTERNAL</b>

Cheers,

Abdul Hakim

0 Kudos

Hi Abdul,

THanks very much.

One more doubt.

I have to include the excise transaction in this BAPI for MIGO GR posting for PO.

But in this BAPI <b>BAPI_GOODSMVT_CREATE</b> there is no such excise fields,

How can i solve this problem.

Regards,

Simha.

0 Kudos

hi i don't think u can achive this using ur below BAPI.

check this BAPI also <b>BAPI_ACC_GOODS_MOVEMENT_POST</b>

Cheers,

Abdul Hakim

0 Kudos

Hi. I have checked this BAPI also, but there is no handling for excise.

I know one function module: J_1IEXGM_UPDATE_EXCISE

to update the excise in MIGO.

But how i have to handle this after the BAPI .

I'm unable to perform it.

My text file contains all the data including excise information also.

How can i handle this??

Please help me..

Regards,

Simha.

0 Kudos

i am in 4.6c now so i am unable to find ur FM here.

i know that the fm J_1IEXGM_UPDATE_EXCISE is for updating excise info.so you call this fm after calling your bapi fm to achive ur tasks.any issue let me knw..

Cheers,

Abdul Hakim