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 for Goods Receipt - Outbound Delivery

Former Member
0 Kudos

Hello all,

I am looking for a Bapi for <b>Goods Receipt for Outbound Delivery</b>.

I have searched the forum but found BAPIs only for GR for Inbound Delivery, GR for purchase order etc. But not for GR for Outbound Delivery.

Can someone guide?

Thanks and Regards,

Reena

1 ACCEPTED SOLUTION

gopi_narendra
Active Contributor
0 Kudos

BAPI_GOODSMVT_CREATE

Regards

Gopi

13 REPLIES 13

Former Member
0 Kudos

Hi,

guess no BAPI for Delivery creation but there are few FM to create delivery

RV_DELIVERY_CREATE

GN_DELIVERY_CREATE

PGI :

WS_DELIVERY_UPDATE

<b>Reward points</b>

Regards

0 Kudos

Hi Kiran,

Thank you.

Are these FMs precisely for "Goods Receipt for Outbound Delivery" ?

I mean, I am particularly looking for a FM/Bapi which can do the same function as transaction MIGO, when we choose "Goods Receipt" and "Outbound Delivery" from the transaction.

Thanks and Regards,

Reena

0 Kudos

the BAPI : BAPI_GOODSMVT_CREATE is meant for the same. It creates a Goods receipt and once the goods receipt is done, you can see an entry in the table MKPF, MSEG

Regards

Gopi

0 Kudos

Hi,

See if the below helps how it work.

TABLES tvsa.

DATA lf_numki LIKE inri-nrrangenr.

SELECT SINGLE * FROM tvsa WHERE smart = 'L'.

lf_numki = tvsa-numki. extended check

call function 'NUMBER_GET_NEXT'

exporting

nr_range_nr = lf_numki

object = 'RV_SAMMG'

importing

number = e_vbsk-sammg.

e_vbsk-mandt = sy-mandt.

e_vbsk-programm = sy-repid.

e_vbsk-selset = sy-slset.

e_vbsk-batch = sy-batch.

e_vbsk-ernam = sy-uname.

e_vbsk-erdat = sy-datlo.

e_vbsk-uzeit = sy-timlo.

e_vbsk-vstel = i_vstel.

*L_VBSK-VTEXT = TVSTT-VTEXT. "Text zur Versandstelle

e_vbsk-smart = 'L'.

CALL FUNCTION 'RV_DELIVERY_CREATE'

EXPORTING

selektionsdatum = sy-datum

vbsk_i = l_vbsk

it_vorgabe_daten = lt_vorgabe_daten

if_no_commit = 'X'

TABLES

lvbak = lvbak

lvbap = lvbap

lvbep = lvbep

lvbfa = lvbfa

lvbfs = lvbfs

lvbkd = lvbkd

lvbls = lvbls

lvbpa = lvbpa

lvbuk = lvbuk

lvbup = lvbup

EXCEPTIONS

error_message = 1

OTHERS = 2.

You could fill the tables, LVBAK,LVBAP,LVBEP,LVBUP,LVBKD etc by reading the relevant data from the database tables VBAK,VBAP,VBEP,VBUP,VBKD .

<b>Reward points</b>

Regards

gopi_narendra
Active Contributor
0 Kudos

BAPI_GOODSMVT_CREATE

Regards

Gopi

Former Member
0 Kudos

hi

try <b>BAPI_GOODSMVT_CREATE </b> it will help probabaly.

<b>reward points for useful ans</b>

Regards

Aarti

0 Kudos

Hi Gopi/Aarti,

There are few posts on SDN which say <b>BAPI_GOODSMVT_CREATE</b> cannot be used for Outbound Delivery.

Im confused.

Thanks and Regards,

Reena

Former Member
0 Kudos

Hi Reena,

use this code....

&----


*& Report ZSAN_BAPI_GOODSMVT_CREATE *

*& *

&----


*& *

*& *

&----


REPORT ZSAN_BAPI_GOODSMVT_CREATE .

DATA: GOODSMVT_HEADER LIKE BAPI2017_GM_HEAD_01,

" Material Document Header Data

GOODSMVT_CODE LIKE BAPI2017_GM_CODE,

" Assign code to transaction for BAPI goods movement

MATERIALDOCUMENT LIKE BAPI2017_GM_HEAD_RET-MAT_DOC,

" Number of Material Document

GOODSMVT_ITEM LIKE BAPI2017_GM_ITEM_CREATE OCCURS 0 WITH HEADER LINE,

" Create Material Document Item

RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE

" Return table for messages

.

*Fill values in header

GOODSMVT_HEADER-PSTNG_DATE = '20030825'.

GOODSMVT_HEADER-DOC_DATE = '20030802'.

*Fill GOODSMVT_CODE

GOODSMVT_CODE-GM_CODE = '05' .

*Fill Item Table

GOODSMVT_ITEM-MATERIAL = '100-100'.

GOODSMVT_ITEM-PLANT = '1000'.

GOODSMVT_ITEM-STGE_LOC = '0001'.

GOODSMVT_ITEM-MOVE_TYPE = '501'.

GOODSMVT_ITEM-ENTRY_QNT = '50'.

GOODSMVT_ITEM-ITEM_TEXT = 'Test Sanket'.

*GOODSMVT_ITEM-COSTCENTER = '1000'.

APPEND GOODSMVT_ITEM.

*Create Good's movement

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'

EXPORTING

GOODSMVT_HEADER = GOODSMVT_HEADER

GOODSMVT_CODE = GOODSMVT_CODE

IMPORTING

MATERIALDOCUMENT = MATERIALDOCUMENT

TABLES

GOODSMVT_ITEM = GOODSMVT_ITEM

RETURN = RETURN.

*Commit BAPI

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'.

*Display Goods movement number

FORMAT COLOR 6 INVERSE ON.

READ TABLE RETURN WITH KEY TYPE = 'E'.

IF SY-SUBRC = 0.

WRITE: /,'ERROR! Goods movement not created'.

ELSE.

WRITE: /,'Goods movent number',MATERIALDOCUMENT COLOR 5,

'posted for material',GOODSMVT_ITEM-MATERIAL.

ENDIF.

FORMAT COLOR OFF INVERSE OFF.

If useful reward me with points.

Thanks

Sanket.

0 Kudos

Hi Sanket,

Thanks a lot for the code. It looks promising. I will try it out.

In the line:

<b>GOODSMVT_CODE-GM_CODE = '05' .</b>

05 stands for "Others" right? Does this mean that "<b>Outbound Delivery</b>" is handled by this?

Thanks and Regards,

Reena

0 Kudos

Hello,

I tried the solution given by SANKET SETHI, with the following values changed:

*Fill Item Table

GOODSMVT_ITEM-MATERIAL = '100-100'.

GOODSMVT_ITEM-PLANT = 'NL10'.

GOODSMVT_ITEM-STGE_LOC = 'FG01'.

GOODSMVT_ITEM-MOVE_TYPE = '101'.

GOODSMVT_ITEM-ENTRY_QNT = '50'.

GOODSMVT_ITEM-ITEM_TEXT = 'Test Sanket'.

APPEND GOODSMVT_ITEM.

All other values were same as mentioned by Sanket. But I get an error as follows:

<b>Goods movement not possible with movement type 101.</b>

I <b>have</b> to use movement type 101 according to the requirements I have. How can I run this BAPI for movement type 101?

Thanks and Regards,

Reena

0 Kudos

I guess Movement type 101 there is no BAPI or FM,You can use simple BDC Program to achive this functionality.

Even you can search in this forum,there are some many posts related 101 movement types.. and all are incomplete with FM

Thanks

Seshu

0 Kudos

Hmmm... BDC !!

The reason I was looking for a FM was because, I want use the FM with a WebDynpro application, by remote enabling the FM.

Now, I am just wondering, if something of this sort would be possible through a BDC.

I mean, can a BDC be called by an external application and the data be exchanged between the BDC and the external application (Webdynpro in my case) ?

Thanks and Regards,

Reena

0 Kudos

Then creat Function module ,select attribure tyoe remote enabled ,with in Function module write the bdc code.

use call transaction method ,update mode would be 'S'.

If you need example for this ,use BAPI_VENDOR_CREATE or MATERIAL_BDCDATA ,they use BDC

Thanks

Seshu