on 07-10-2008 10:21 AM
Hi all
I have a STO between different plants in different company codes in two steps (643).
I saw that in the time between the made of 643 and that of 101, the value of stock in transit is 0. I saw already the sap note stock in transit between companies (like that between plants in the same company) or I must calculate it or using in my program?
thanks
Davide
Hi,
Intercompany is a flow between two differents companies, so, mov 643 is more similar to mov 601 in accounting (ie: FI) than to 641 (here the movement is inside the same company). Check FI documents and you can see it. Perhaps you are confused because the origin of deliveries is very similar (in an purchase order UL).
I hope this helps you
Regards,
Eduardo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Perhaps for your requirements is so easy control it by deliveries NLCC and its status, ie: you can create a report where you can read the info from table VBFA (flow of documents on you have the MM movements).
I copy some ABAP coding for control stock transfer for deliveries UL.
&----
*& Form selecciona_entregas
&----
form selecciona_entregas .
clear entregas.
select vbeln lfdat kunnr from likp
into corresponding fields of table lt_ul
where lfart = p_lfart
and lfdat in s_lfdat.
describe table lt_ul lines entregas.
check entregas > 0.
select * from vbfa
into table lt_vbfa
for all entries in lt_ul
where vbelv = lt_ul-vbeln.
endform. " selecciona_entregas
&----
*& Form tratar_flujo
&----
text
----
--> p1 text
<-- p2 text
----
form tratar_flujo .
data: veces like sy-dbcnt.
check entregas > 0.
delete lt_vbfa where posnv is initial.
loop at lt_vbfa where vbtyp_n = 'R'.
sm_vbfa = lt_vbfa.
append sm_vbfa.
endloop.
loop at lt_vbfa where vbtyp_n = 'i'.
em_vbfa = lt_vbfa.
append em_vbfa.
endloop.
loop at lt_ul.
loop at em_vbfa where vbelv = lt_ul-vbeln.
if em_vbfa-plmin = '+'.
add 1 to lt_ul-mov_p.
elseif em_vbfa-plmin = '-'.
add 1 to lt_ul-mov_n.
else.
nada/nothing
endif.
endloop.
modify lt_ul.
endloop.
loop at em_vbfa where plmin = '+'.
at new vbelv.
clear veces.
endat.
add 1 to veces.
read table lt_ul with key vbeln = lt_vbfa-vbelv.
if sy-subrc = 0
and lt_ul-mov_p > 0.
if lt_ul-mov_p = lt_ul-mov_n.
delete em_vbfa where vbelv = lt_ul-vbeln.
elseif lt_ul-mov_p > lt_ul-mov_n.
if veces < lt_ul-mov_p.
delete em_vbfa.
endif.
endif.
endif.
endloop.
delete em_vbfa where plmin = '-'.
endform. " tratar_flujo
&----
*& Form matriz_de_datos
&----
form matriz_de_datos .
check entregas > 0.
loop at sm_vbfa.
read table em_vbfa with key vbelv = sm_vbfa-vbelv
posnv = sm_vbfa-posnv.
if sy-subrc <> 0.
datos-vbeln = sm_vbfa-vbelv.
datos-posnr = sm_vbfa-posnv.
datos-mblnr = sm_vbfa-vbeln.
datos-zeile = sm_vbfa-posnn.
datos-dmbtr = sm_vbfa-rfwrt. "evita acc.MSEG
append datos.
endif.
endloop.
loop at datos.
read table lt_ul with key vbeln = datos-vbeln.
if sy-subrc = 0.
move-corresponding lt_ul to datos.
select single name1 into datos-name1 from kna1
where kunnr = datos-kunnr.
endif.
select single budat into datos-budat from mkpf
where mblnr = datos-mblnr.
modify datos.
endloop.
endform. " matriz_de_datos
For your requiriment perhaps you can use NLCC (no UL).
I hope this helps you.
Regards,
Eduardo
Edited by: Eduardo Hinojosa on Jul 10, 2008 3:46 PM
Thanks Eduardo but I need only a shorter piece of code:
*---aggiunta stock in transito tra società - 10.07.2008
REFRESH xmatnr.
REFRESH xwerks.
REFRESH xpstyp.
REFRESH xelikz.
REFRESH xloekz.
REFRESH xtab6.
MOVE 'I' TO xmatnr-sign.
MOVE 'I' TO xwerks-sign.
MOVE 'I' TO xpstyp-sign.
MOVE 'I' TO xelikz-sign.
MOVE 'I' TO xloekz-sign.
MOVE 'EQ' TO xmatnr-option.
MOVE 'EQ' TO xwerks-option.
MOVE 'EQ' TO xpstyp-option.
MOVE 'EQ' TO xelikz-option.
MOVE 'EQ' TO xloekz-option.
MOVE marc-matnr TO xmatnr-low.
MOVE marc-werks TO xwerks-low.
MOVE '0' TO xpstyp-low.
MOVE space to xelikz-low.
MOVE space TO xloekz-low.
APPEND xmatnr.CLEAR xmatnr.
APPEND xwerks.CLEAR xwerks.
APPEND xpstyp.CLEAR xpstyp.
APPEND xelikz.CLEAR xelikz.
APPEND xloekz.CLEAR xloekz.
CALL FUNCTION 'MB_ADD_TRANSFER_QUANTITY'
EXPORTING
cumulate = 'X'
TABLES
xmatnr = xmatnr
xwerks = xwerks
XRESWK =
XSOBKZ =
xpstyp = xpstyp
xelikz = xelikz
xloekz = xloekz
xtab6 = xtab6
.
LOOP AT xtab6.
ADD xtab6-menge TO com-marc-trame.
ENDLOOP.
*----
-
User | Count |
---|---|
91 | |
11 | |
10 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.