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 VL31N:Create Inbound Delivery

Former Member
0 Kudos

Hi all,

Please give the BAPI for VL 31N: Create Inbound delivery transaction

thanks

5 REPLIES 5

Former Member
0 Kudos

Did you look at BAPI_INB_DELIVERY_SAVEREPLICA

Regards,

Ravi

Note - Please mark all the helpful answres

Former Member
0 Kudos

Hi

Please check out this BAPI

<b>BAPI_IBDLV_CREATE_FROM_OBDLV</b>

Some other BAPI's

BAPI_INB_DELIVERY_CONFIRM_DEC

BAPI_INB_DELIVERY_SAVEREPLICA

BAPI_INB_DELIVERY_CHANGE

Former Member
0 Kudos

These BAPIs are not for created from PO, I think only way in BDC. Any else can help?

0 Kudos

No bapi but you can use this function module GN_DELIVERY_CREATE

Select the data required - see below

select ebeln ebelp menge meins matnr werks lgort bstae loekz elikz

lmein umrez umren insmk pstyp sobkz knttp kzfme kzvbr

ematn mfrnr mfrpn emnfr cuobj uebto untto uebtk bwtar idnlf

txz01 mfrgr gewei voleh ntgew brgew volum ean11 aktnr abeln

abelp aurel matkl upvor uptyp uebpo wepos

into corresponding fields of table xekpo_short

from ekpo

where ebeln = i_ebeln

and ebelp = i_ebelp.

if sy-subrc ne 0.

e_rc = 4.

else.

read table xekpo_short index 1.

call function 'ME_EKKO_SINGLE_READ'

exporting

pi_ebeln = xekpo_short-ebeln

importing

po_ekko = ekko

exceptions

no_records_found = 1

others = 2.

if sy-subrc ne 0.

e_rc = 4.

elseif ekko-bstyp ne 'F' and ekko-bstyp ne 'L'.

e_rc = 4.

endif.

endif.

clear xvbsk.

xvbsk-mandt = sy-mandt.

xvbsk-ernam = sy-uname.

xvbsk-erdat = sy-datum.

xvbsk-uzeit = sy-uzeit.

xvbsk-smart = 'L'.

*- Nummer VBSK vergeben -


*

select single * from tvsa where smart = xvbsk-smart.

if sy-subrc = 0.

call function 'NUMBER_GET_NEXT'

exporting

nr_range_nr = tvsa-numki

object = 'RV_SAMMG'

importing

number = xvbsk-sammg

exceptions

others = 01.

if sy-subrc ne 0.

message e700(me) with tvsa-numki text-007.

endif.

else.

message e700(me) with space text-007.

endif.

data: h_grkor like lips-grkor, "Liefergruppe "386409

h_bsmng like ekpo-menge. "Bestellmenge übergeordnete Pos.

if not ekko-lifnr is initial.

call function 'VENDOR_MASTER_DATA_SELECT_12'

exporting

pi_lifnr = ekko-lifnr

pi_ekorg = ekko-ekorg

importing

pe_lfm1 = lfm1

exceptions

no_entry_found = 1

others = 2.

xkomdlgn-vsbed = lfm1-vsbed.

else.

clear xkomdlgn-vsbed.

endif.

xkomdlgn-lifnr = ekko-lifnr.

xkomdlgn-inco1 = ekko-inco1. "363954

xkomdlgn-inco2 = ekko-inco2. "363954

xkomdlgn-exnum = ekko-exnum. "363954

xkomdlgn-bukrs_best = ekko-bukrs. "363954

xkomdlgn-matnr = xekpo_short-matnr.

xkomdlgn-werks = xekpo_short-werks.

xkomdlgn-lgort = xekpo_short-lgort.

  • xkomdlgn-charg = ?

xkomdlgn-vrkme = xekpo_short-meins.

xkomdlgn-meins = xekpo_short-lmein.

xkomdlgn-umvkz = xekpo_short-umrez.

xkomdlgn-umvkn = xekpo_short-umren.

if xekpo_short-matnr eq space. "386409

xkomdlgn-meins = xekpo_short-meins.

xkomdlgn-umvkz = 1.

xkomdlgn-umvkn = 1.

endif.

xkomdlgn-insmk = xekpo_short-insmk.

xkomdlgn-kzfme = xekpo_short-kzfme.

xkomdlgn-kzvbr = xekpo_short-kzvbr. "note 384051

xkomdlgn-lfimg = p_lfimg.

xkomdlgn-lfdat = p_eindt.

xkomdlgn-vgbel = xekpo_short-ebeln.

xkomdlgn-vgpos = xekpo_short-ebelp.

xkomdlgn-lfart = gf_dlv_type.

xkomdlgn-vgtyp = 'V'.

xkomdlgn-kzazu = 'X'. "??? what's that for ????

xkomdlgn-knttp = xekpo_short-knttp.

xkomdlgn-sobkz = xekpo_short-sobkz.

if xekpo_short-matnr is initial or xekpo_short-pstyp = '6'.

xkomdlgn-posar = 'B'.

endif.

xkomdlgn-ematn = xekpo_short-ematn.

xkomdlgn-mfrnr = xekpo_short-mfrnr.

xkomdlgn-mfrpn = xekpo_short-mfrpn.

xkomdlgn-emnfr = xekpo_short-emnfr.

xkomdlgn-cuobj = xekpo_short-cuobj.

xkomdlgn-uebto = xekpo_short-uebto.

xkomdlgn-untto = xekpo_short-untto.

xkomdlgn-uebtk = xekpo_short-uebtk.

xkomdlgn-bwtar = xekpo_short-bwtar.

xkomdlgn-kdmat = xekpo_short-idnlf.

xkomdlgn-arktx = xekpo_short-txz01.

xkomdlgn-mfrgr = xekpo_short-mfrgr.

xkomdlgn-gewei = xekpo_short-gewei.

xkomdlgn-voleh = xekpo_short-voleh.

xkomdlgn-ntgew = xekpo_short-ntgew * xkomdlgn-lfimg.

xkomdlgn-brgew = xekpo_short-brgew * xkomdlgn-lfimg.

xkomdlgn-volum = xekpo_short-volum * xkomdlgn-lfimg.

xkomdlgn-ean11 = xekpo_short-ean11.

xkomdlgn-aktnr = xekpo_short-aktnr.

xkomdlgn-abeln = xekpo_short-abeln.

xkomdlgn-abelp = xekpo_short-abelp.

xkomdlgn-aurel = xekpo_short-aurel.

xkomdlgn-idnlf = xekpo_short-idnlf.

xkomdlgn-matkl = xekpo_short-matkl.

  • Leergut-Stückliste übernehmen

clear xkomdlgn-grkor.

clear xkomdlgn-kmpmg.

clear xkomdlgn-uepos.

if xekpo_short-upvor ca '3X'.

h_grkor = h_grkor + 1.

xkomdlgn-grkor = h_grkor.

h_bsmng = xekpo_short-menge.

endif.

if not xekpo_short-uebpo is initial and

xekpo_short-uptyp ca '3X'.

xkomdlgn-uepos = xekpo_short-uebpo.

xkomdlgn-grkor = h_grkor.

if h_bsmng ne 0.

xkomdlgn-kmpmg = xekpo_short-menge / h_bsmng.

endif.

endif.

*- Konsignation - SOBKZ 'K' hart reinsetzen, da von Pstyp abhäng......

if xekpo_short-pstyp eq '2'.

xkomdlgn-sobkz = 'K'.

endif.

  • Kontierungsfelder

if xekpo_short-sobkz eq 'E' or xekpo_short-sobkz eq 'Q'.

call function 'MMPUR_EKKN_READ_EBELN_EBELP'

exporting

pi_ebeln = xekpo_short-ebeln

pi_ebelp = xekpo_short-ebelp

  • PI_BYPASSING_BUFFER =

  • PI_REFRESH_BUFFER =

tables

pto_ekkn_po = xekkn

exceptions

no_records_requested = 1

others = 2.

if sy-subrc eq 0.

read table xekkn index 1.

xkomdlgn-ps_psp_pnr = xekkn-ps_psp_pnr.

xkomdlgn-vbelv = xekkn-vbeln.

xkomdlgn-posnv = xekkn-vbelp.

endif.

endif.

append xkomdlgn.

Former Member
0 Kudos

Hi,

We succeeded to do something similar.

We needed to create an inbound based on invoice data, with refference to items from multiple PO.

We used FM BBP_INB_DELIVERY_CREATE, combined with enhancement of ME_CONFIRMATION_VIA_EDI for using MARA- MATNR instead of

mara-ematn (standard logic of SAP for vendor ASN).

In this enhancement we filled also fields:

t_kom-vornu = t_data-belnr. "invoice number as precendent document
t_kom-bolnr = t_data-bolnr. "bill of ladding
t_kom-traty = t_data-trans_cat. "transport type.

Also we had to use customizing to not display warning related to different delivery date.

Kind regards,

Valentina