Skip to Content
author's profile photo Former Member
Former Member

GN_DELIVERY_CREATE

Hello Experts,

I am creating inbound delivery with reference to purchase order, my problem

is i have a record in table xkomdlgn , and i want to create single inbound delivery

for all data available in above mentioned table ,but it is creating inbound delivery

for each

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 08, 2007 at 07:09 PM

    solve myself

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2008 at 10:11 AM

    hi sanju

    i was wondering whether you can give/write the program which called this FORM...

    and tell me please when or on which proccess are you calling this function

    im writing here my code which is activated on the "POST GOOD ISSUES" in the "vl02n" transection

    the whole point of my application is to create an inbound delivery and assign the Handling Units after posting good issues in the outbound delivery creation (vl02n).

    im getting a various kinds of errors about it:

    • No document number was assigned

    • Data of preceding document was not transmitted

    im pretty sure it is caused by the function 😔

    here is my code:

    METHOD f_ex_le_shp_delivery_proc~save_document_prepare.

    types: BEGIN OF t_hu_numbers,

    exidv type exidv,

    venum type venum,

    vepos type vepos,

    matnr type matnr,

    charg type CHARG_D,

    END OF t_hu_numbers.

    DATA: wa_xlikp LIKE LINE OF ct_xlikp,

    wa_xvbuk LIKE LINE OF it_xvbuk,

    lv_status TYPE vttk-stlad.

    • added by Eyal Cohen 07.01.08

    types: BEGIN OF t_hu_numbers,

    exidv type exidv,

    venum type venum,

    vepos type vepos,

    matnr type matnr,

    charg type CHARG_D,

    END OF t_hu_numbers.

    DATA: out_del_lines TYPE TABLE OF lips,

    wa_out_del_lines like LINE OF out_del_lines,

    wa_hu_numbers type t_hu_numbers,

    hu_numbers TYPE TABLE OF t_hu_numbers.

    • Data for the create inbound delivery function

    DATA: wa_XVBPA like LINE OF CT_XVBPA,

    xkomdlgn TYPE TABLE OF komdlgn ,

    wa_xkomdlgn like LINE OF xkomdlgn,

    wa_vbsk_i TYPE vbsk,

    • wa_vbsk_i like LINE OF vbsk_i,

    xvbfs TYPE TABLE OF vbfs ,

    xvbls TYPE TABLE OF vbls,

    hu_tab TYPE hum_rehang_hu_t,

    l_sammg type SAMMG,

    tvsa TYPE TABLE OF tvsa,

    wa_tvsa like line of tvsa,

    L_NRNR type nrnr,

    l_number type integer,

    wa_hu_tab TYPE hum_rehang_hu.

    DATA: hu_name(15) TYPE c VALUE 'V51VE-EXIDV(',

    line_no(2) TYPE n VALUE '00',

    lifnr type lifnr,

    in_del_num type vbeln,

    l_out_del type vbeln,

    l_lifnr type lifnr,

    rfpos type posnr.

    READ TABLE ct_xlikp INTO wa_xlikp INDEX 1.

    IF not is_v50agl-warenausgang is INITIAL and wa_xlikp-lfart = 'ZNL'.

    l_out_del = wa_xlikp-vbeln.

    READ TABLE CT_XVBPA into wa_xvbpa index 1.

    l_lifnr = wa_XVBPA-lifnr.

    • get the vbsk data

    SELECT SINGLE *

    FROM TVSA

    into wa_tvsa

    WHERE SMART = 'L'.

    L_NRNR = wa_TVSA-NUMKI.

    CALL FUNCTION 'NUMBER_GET_NEXT'

    EXPORTING

    NR_RANGE_NR = L_NRNR

    OBJECT = 'RV_SAMMG'

    IMPORTING

    NUMBER = wa_vbsk_i-SAMMG

    EXCEPTIONS

    OTHERS = 1.

    • wa_vbsk_i-mandt = sy-mandt.

    • wa_vbsk_i-

    • wa_vbsk_i-ERNAM = sy-uname.

    • wa_vbsk_i-BRGEW = 1111.

    • APPEND wa_vbsk_i to vbsk_i.

    • Get data from the outbound delivery

    SELECT *

    INTO TABLE out_del_lines

    FROM lips

    WHERE vbeln EQ l_out_del.

    SORT out_del_lines BY posnr.

    • Get HU data

    SELECT exidv vekp~venum vepos matnr charg

    INTO TABLE hu_numbers

    FROM vepo INNER JOIN vekp

    ON vepovenum = vekpvenum

    WHERE vepo~vbeln = l_out_del.

    rfpos = 10.

    • Get the next free number for the inbound delivery

    CALL FUNCTION 'NUMBER_GET_NEXT'

    EXPORTING

    nr_range_nr = '41'

    object = 'RV_BELEG'

    IMPORTING

    number = in_del_num

    EXCEPTIONS

    interval_not_found = 1

    number_range_not_intern = 2

    object_not_found = 3

    quantity_is_0 = 4

    quantity_is_not_1 = 5

    interval_overflow = 6

    buffer_overflow = 7

    OTHERS = 8.

    IF sy-subrc <> 0.

    MESSAGE e036(ysd) WITH text-013.

    ENDIF.

    • init data for inbound delivery

    LOOP AT out_del_lines INTO wa_out_del_lines.

    wa_xkomdlgn-mandt = sy-mandt.

    wa_xkomdlgn-lfart = 'EL'.

    wa_xkomdlgn-auart = 'DL'.

    wa_xkomdlgn-vbeln = in_del_num.

    wa_xkomdlgn-matnr = wa_out_del_lines-matnr.

    wa_xkomdlgn-werks = wa_out_del_lines-werks.

    • Get the delivery date

    CLEAR wa_xkomdlgn-lfdat.

    SELECT SINGLE eindt

    INTO wa_xkomdlgn-lfdat

    FROM eket

    WHERE ebeln EQ wa_out_del_lines-vgbel AND

    ebelp EQ wa_out_del_lines-vgpos.

    wa_xkomdlgn-lfimg = wa_out_del_lines-lfimg.

    wa_xkomdlgn-umvkz = '1'.

    wa_xkomdlgn-umvkn = '1'.

    wa_xkomdlgn-vrkme = wa_out_del_lines-vrkme.

    wa_xkomdlgn-meins = wa_out_del_lines-meins.

    wa_xkomdlgn-vgbel = wa_out_del_lines-vgbel.

    wa_xkomdlgn-vgpos = wa_out_del_lines-vgpos.

    wa_xkomdlgn-vgtyp = 'V'.

    wa_xkomdlgn-kzazu = 'X'.

    wa_xkomdlgn-lgort = '2000'.

    wa_xkomdlgn-charg = wa_out_del_lines-charg.

    wa_xkomdlgn-ntgew = wa_out_del_lines-ntgew.

    wa_xkomdlgn-brgew = wa_out_del_lines-brgew.

    wa_xkomdlgn-gewei = wa_out_del_lines-gewei.

    wa_xkomdlgn-lifnr = l_lifnr.

    wa_xkomdlgn-bukrs_best = '2000'.

    • wa_xkomdlgn-matkl = wa_out_del_lines-matkl.

    wa_xkomdlgn-ematn = wa_out_del_lines-matnr.

    • wa_xkomdlgn-vkorg = ekpv_tab-vkorg.

    • wa_xkomdlgn-vtweg = ekpv_tab-vtweg.

    • wa_xkomdlgn-spart = ekpv_tab-spart.

    APPEND wa_xkomdlgn to xkomdlgn.

    • Init the handle unit for the inbound delivery

    LOOP AT hu_numbers into wa_hu_numbers WHERE matnr EQ wa_out_del_lines-matnr.

    SHIFT wa_hu_numbers-exidv LEFT DELETING LEADING '0'.

    wa_hu_tab-top_hu_internal = wa_hu_numbers-exidv.

    wa_hu_tab-venum = wa_hu_numbers-venum.

    wa_hu_tab-vepos = wa_hu_numbers-vepos.

    wa_hu_tab-rfbel = in_del_num.

    wa_hu_tab-rfpos = rfpos.

    APPEND wa_hu_tab TO hu_tab.

    ENDLOOP.

    ADD 10 TO rfpos.

    ENDLOOP.

    • create the inbound delivery

    CALL FUNCTION 'GN_DELIVERY_CREATE'

    EXPORTING

    vbsk_i = wa_vbsk_i

    it_handling_units = hu_tab

    TABLES

    xkomdlgn = xkomdlgn

    xvbfs = xvbfs

    xvbls = xvbls.

    commit WORK AND WAIT.

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Eyal,

      Did you ever get this code to work?

      We are also trying to create an inbound delivery and pack the delivery at the same time. We have got it to create the delivery, but it is creating empty handling units and is not packing the items on the delivery.

      Thanks in advance,

      Finbarr

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.