Skip to Content
0
Sep 10, 2007 at 08:40 AM

Create a transfer order with L_TO_CREATE_TR

188 Views

Hi!

I need to create a transfer order. I am using L_TO_CREATE_TR but sy-subrc = 8 (squit forbidden) is returned. I don't know why TO is not created.

My code:

SELECT SINGLE tbnum lgnum nltyp nlpla

FROM ltbk

INTO lwa_ltbk

WHERE mblnr = l_matdoc.

IF sy-subrc EQ 0.

SELECT tbpos menge meins charg

FROM ltbp

INTO TABLE li_ltbp

WHERE lgnum = lwa_ltbk-lgnum AND

tbnum = lwa_ltbk-tbnum.

LOOP AT li_ltbp INTO lwa_ltbp.

lwa_detail-tbpos = lwa_ltbp-tbpos.

lwa_detail-anfme = lwa_ltbp-menge.

lwa_detail-altme = lwa_ltbp-meins.

lwa_detail-vltyp = lwa_ltbk-nltyp.

lwa_detail-vlpla = lwa_ltbk-nlpla.

lwa_detail-charg = lwa_ltbp-charg.

lwa_detail-vlenr = pid. " lqua-lenum

APPEND lwa_detail TO li_detail.

ENDLOOP.

CALL FUNCTION 'L_TO_CREATE_TR'

EXPORTING

i_lgnum = lwa_ltbk-lgnum

i_tbnum = lwa_ltbk-tbnum

i_squit = 'X'

it_trite = li_detail

IMPORTING

e_tanum = tran_order

Any help is welcome.

Thx