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: 

BAPI_GOODSMVT_CREATE

Former Member
0 Kudos
182

Hi EVERYONE!

Who have an example for bapi: BAPI_GOODSMVT_CREATE, for transaction MB01, movement type 101, with purchase order.

Thanks!

3 REPLIES 3

Former Member
0 Kudos
80

Hi !!!

This morning i send you an example

Best Regards

Former Member
0 Kudos
80

Dear Andy,

I am an executive recruiter in Sydney and I was referred to you by Hemant Joshi at Nestle who recommended you as a very competent SAP BW person. One of my clients in Sydney is looking for a new person (they can sponsor visa) for a BW 7 / ECC6 Information Management role - and I would like to talk to you and e-mail you some information on the role? My contact details are:

e: andrewd@ethoscorporation.com.au

Andrew Daniels

Ethos Corporation Pty Ltd

Level 7, Macquarie House

167 Macquarie Street, Sydney NSW 2000

Tel: 02 8227 9200

Fax: 02 8227 9299

Mob: 0409 284 124

<http://www.ethoscorporation.com.au/>

I look forward to speaking with you as soon aas possible.

Kind regards

Andrew Daniels

Ethos CPL

Former Member
0 Kudos
80

LOOP AT I_TAB.

MOVE: I_TAB-VERKF TO I_MAIN-VERKF,

I_TAB-SOL_PONO TO I_MAIN-SOL_PONO,

I_TAB-SOL_PODT TO I_MAIN-SOL_PODT,

I_TAB-SOLOMON_GR TO I_MAIN-SOLOMON_GR,

I_TAB-SOLOMON_GRDAT TO I_MAIN-SOLOMON_GRDAT,

I_TAB-WERKS TO I_MAIN-WERKS,

I_TAB-EBELP TO I_MAIN-EBELP,

I_TAB-MATNR TO I_MAIN-MATNR, "Material Number

I_TAB-ERFMG1 TO I_MAIN-ERFMG, "Quantity

I_TAB-LGOBE1 TO I_MAIN-LGOBE, " Storage Location

I_TAB-EBELN TO I_MAIN-EBELN,

I_TAB-ABLAD1 TO I_MAIN-ABLAD1,

I_TAB-ABLAD2 TO I_MAIN-ABLAD2.

APPEND I_MAIN.

IF I_TAB-ERFMG2 <> '0'.

MOVE-CORRESPONDING: I_TAB TO I_MAIN.

MOVE: I_TAB-ERFMG2 TO I_MAIN-ERFMG, "Quantity

I_TAB-LGOBE2 TO I_MAIN-LGOBE.

APPEND I_MAIN.

ENDIF.

ENDLOOP.

REFRESH I_OUT.

CLEAR I_TAB.

I_OUT[] = I_TAB[].

DELETE ADJACENT DUPLICATES FROM I_TAB COMPARING SOLOMON_GR.

  • DELETE ADJACENT DUPLICATES FROM I_MAIN COMPARING SOLOMON_GR.

LOOP AT I_TAB.

count = sy-tabix.

SELECT SINGLE * FROM ZMM_GR_UPLOAD1

WHERE SOLOMON_GR = I_TAB-SOLOMON_GR AND

SOLOMON_GRDAT = I_TAB-SOLOMON_GRDAT.

IF SY-SUBRC = 0.

I_TAB-FLAG = 'C'.

modify i_tab index count.

concatenate 'File Name : ' name into i_msg1.

append i_msg1.

CONCATENATE 'ERROR PO : ' I_TAB-SOL_PONO

' WAS ALREADY UPLOADED' INTO I_MSG1.

APPEND I_MSG1.

CLEAR I_TAB-FLAG.

CONTINUE.

ELSE.

REFRESH I_ITEMS.

CLEAR I_ITEMS.

CONCATENATE I_MAIN-SOLOMON_GRDAT+4(4)

I_MAIN-SOLOMON_GRDAT+2(2)

I_MAIN-SOLOMON_GRDAT+0(2) INTO G_DATE.

gmhead-pstng_date = G_DATE.

gmhead-doc_date = sy-datum.

gmhead-pr_uname = sy-uname.

  • "01 - MB01 - Goods Receipts for Purchase Order

gmcode-gm_code = '01'.

refresh itab.

clear itab.

SORT I_MAIN BY SOLOMON_GR.

LOOP AT I_MAIN WHERE SOLOMON_GR = I_TAB-SOLOMON_GR.

itab-move_type = '101'.

itab-mvt_ind = 'B'.

itab-plant = I_MAIN-WERKS.

itab-material = I_MAIN-MATNR.

itab-entry_qnt = I_MAIN-ERFMG.

  • itab-stge_loc = 'OMR1'.

  • itab-move_stloc = pcitab-recv_loc.

  • itab-REF_DOC = 'exnum123'.

itab-NO_MORE_GR = 'X'.

itab-WITHDRAWN = ''.

itab-stge_loc = I_MAIN-LGOBE.

itab-po_number = I_MAIN-EBELN.

itab-po_item = I_MAIN-EBELP.

itab-unload_pt = I_MAIN-ABLAD2.

append itab.

ENDLOOP.

if not itab[] is initial.

call function 'BAPI_GOODSMVT_CREATE'

exporting

goodsmvt_header = gmhead

goodsmvt_code = gmcode

  • * TESTRUN = ' '

IMPORTING

goodsmvt_headret = mthead

  • * MATERIALDOCUMENT =

  • MATDOCUMENTYEAR =

tables

goodsmvt_item = itab

  • GOODSMVT_SERIALNUMBER =

return = errmsg.

clear errflag.

loop at errmsg.

if sy-tabix = 1.

concatenate 'File Name : ' name into i_msg1.

append i_msg1.

concatenate 'Sol PO : ' I_TAB-SOL_PONO ' '

I_TAB-SOL_PODT into i_msg1.

append i_msg1.

endif.

if errmsg-type eq 'E'.

write:/'Error in function', errmsg-message.

errflag = 'X'.

else.

write:/ errmsg-message.

endif.

move errmsg-message to i_msg1.

append i_msg1.

endloop.

if errflag is initial.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

  • commit work and wait.

if sy-subrc ne 0.

write:/ 'Error in updating'.

exit.

else.

concatenate 'File Name : ' name into i_msg1.

append i_msg1.

concatenate 'Sol PO : ' I_TAB-SOL_PONO ' '

I_TAB-SOL_PODT into i_msg1.

append i_msg1.

write:/ mthead-mat_doc, mthead-doc_year.

ZMM_GR_UPLOAD1-SOLOMON_GR = I_TAB-SOLOMON_GR.

ZMM_GR_UPLOAD1-SOLOMON_GRDAT = I_TAB-SOLOMON_GRDAT.

INSERT ZMM_GR_UPLOAD1.

COMMIT WORK.

I_TAB-FLAG = 'C'.

MODIFY I_TAB INDEX COUNT.

CONCATENATE mthead-mat_doc mthead-doc_year

into i_msg1.

append i_msg1.

endif.

endif.

endif.

ENDIF.

ENDLOOP.