‎2008 Jul 16 9:41 PM
Hi Friends ,
I am doing BOM explosion on 4911 materials with one material at a time .After the BOM explosion I need to make sure that I get the correct component by getting the MRP controllers for those components and comparing them with the one on selection screen .
This is the code below. Please advise and your thoughts on this .
Thanks !
Teresa.
LOOP AT t_mattmp.
SELECT matnr
stlan
stlal
INTO (mkal-matnr,
mkal-stlan,
mkal-stlal)
FROM mkal
WHERE werks = p_pwwrk AND
verid IN s_veri1 AND
matnr = t_mattmp-nrmit.
ENDSELECT.
IF syst-subrc = 0 .
REFRESH: xstpox,
xmatcat.
CLEAR: xstpox,
xmatcat.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
ftrel = ftrel
altvo = pm_altvo
aufsw = ' '
auskz = pm_ausch
bagrp = pm_bagrp
beikz = pm_beikz
bessl = pm_bessl
bgixo = ' '
brems = ' '
capid = 'PP01'
datuv = syst-datum
emeng = qty
erskz = pm_erskz
erssl = pm_erssl
mbwls = ' '
mtnrv = t_mattmp-nrmit
mktls = 'X'
mehrs = ' '
mmory = ' '
postp = pm_postp
sanko = pm_sanko
sanfr = pm_sanfe
sanka = pm_sanka
sanin = pm_sanin
sanvs = pm_sanvs
svwvo = 'X'
rndkz = ' '
rvrel = pm_rvrel
schgt = pm_schgt
stkkz = pm_stkkz
stlal = mkal-stlal
stlan = mkal-stlan
werks = p_pwwrk
vrsvo = 'X'
IMPORTING
topmat = xcstmat
dstst = xfeld
TABLES
stb = xstpox
matcat = xmatcat
EXCEPTIONS
alt_not_found = 1
call_invalid = 2
material_not_found = 3
missing_authorization = 4
no_bom_found = 5
no_plant_data = 6
no_suitable_bom_found = 7
OTHERS = 8.
LOOP AT xstpox.
CLEAR marc-dispo.
SELECT SINGLE dispo
INTO marc-dispo
FROM marc
WHERE werks = p_pwwrk
AND matnr = xstpox-idnrk
AND dispo IN s_disp.
IF syst-subrc = 0 .
MOVE xstpox-idnrk TO t_matc-matc.
MOVE t_mattmp-nrmit TO t_matc-nrmit.
APPEND t_matc.
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
‎2008 Jul 16 9:45 PM
Teresa,
Can you please run a trace on your program using ST05 to find out which segment in your code is taking more time. Is it the select/call function/loop....endloop?
The you can try to optimize that section.
Thanks,
‎2008 Jul 16 9:47 PM
select matnr werks dispo
into table itab
for all entries in xstpox
where matnr in xstpox-idnrk
and werks = p_pwwrk
AND dispo IN s_disp.
loop at ur table ...
read table itab with key ...
IF syst-subrc = 0 .
MOVE xstpox-idnrk TO t_matc-matc.
MOVE t_mattmp-nrmit TO t_matc-nrmit.
APPEND t_matc.
EXIT.
ENDIF.
ENDLOOP.
‎2008 Jul 16 9:52 PM
Hi,
In my opinion you can break the code in two programs. One which contains the FM where BOM is exploded in background. After the BOM explosion, call the second program and pass the exploded materials to it and check for the materials with the selection screen parameters.
Just a thought. Let me know once u try it out.
All the best,
Anand Patil
‎2008 Jul 16 9:56 PM
I don't see much that you can do other than run it in the background.
Rob
‎2008 Jul 16 10:26 PM
Hi
I experianced similar problem with one of the transaction in HR Payroll. There is a setting in Basis through which the interval for time out can be increased.
Basis guys should be asked to increase the time out interval for foreground tasks.
Regards
Waz