‎2008 Jan 14 10:32 AM
Hi
Am getting an runtime error in the below code.Its working fine in development if i move it to QUALITY am getting an ru time error in the
''READ TABLE it_mara with key matnr = it_S026-matnr."
Please help.
Vijay
REPORT ZCOP_TEST_O.
TABLES:S026,MARA,T023T,S023.
DATA:IT_S026 TYPE STANDARD TABLE OF S026 WITH HEADER LINE.
DATA:IT_MARA TYPE STANDARD TABLE OF MARA WITH HEADER LINE.
DATA:IT_T023T TYPE STANDARD TABLE OF T023T WITH HEADER LINE.
DATA:IT_S023 TYPE STANDARD TABLE OF S023 WITH HEADER LINE.
TYPES:BEGIN OF t_report,
ENMNG TYPE S026-ENMNG,
MATNR TYPE S026-MATNR,
SPTAG TYPE S026-SPTAG,
MATKL TYPE MARA-MATKL,
MCOMP TYPE S026-mcomp,
*WGBEZ TYPE T023T-WGBEZ,
WEMNG TYPE S023-WEMNG,
END OF t_report.
DATA:it_report TYPE STANDARD TABLE OF t_report WITH HEADER LINE.
PARAMETERS:p_werks type S026-WERKS OBLIGATORY.
SELECT-OPTIONS:p_sptag FOR S026-SPTAG.
SELECT-OPTIONS:p_mcomp FOR S026-MCOMP default '60000000' to '60000063' obligatory.
*RANGES:p_mcomp for s026-mcomp.
DATA:x TYPE ENMNG.
DATA:y TYPE ENMNG.
DATA:z TYPE WEMNG.
DATA:a TYPE WEMNG.
DATA:b TYPE WEMNG.
SELECT * FROM S026 INTO CORRESPONDING FIELDS OF TABLE
IT_S026 WHERE WERKS = P_WERKS AND
SPTAG IN p_sptag AND MCOMP NOT in p_mcomp.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE IT_MARA
FROM ( MARA AS A
INNER JOIN S026 AS B ON B~MATNR = A~MATNR ).
SELECT * FROM s023 INTO
CORRESPONDING FIELDS OF TABLE IT_s023 WHERE
WERKS = P_WERKS AND
SPTAG IN P_SPTAG .
SELECT *
INTO CORRESPONDING FIELDS OF TABLE IT_T023T
FROM ( T023T AS C
INNER JOIN MARA AS D ON DMATKL = CMATKL ) .
LOOP AT IT_S026.
READ TABLE it_mara with key matnr = it_S026-matnr.
READ TABLE it_t023t with key matKL = it_MARA-matKL.
IT_REPORT-MATKL = IT_T023T-MATKL.
IT_REPORT-ENMNG = IT_S026-ENMNG .
IT_REPORT-SPTAG = IT_S026-SPTAG .
IT_REPORT-MATNR = IT_S026-MATNR .
IT_REPORT-MCOMP = IT_S026-MCOMP .
ADD IT_REPORT-ENMNG TO X.
APPEND IT_REPORT.
ENDLOOP.
LOOP AT IT_S023.
ADD IT_s023-WEMNG TO Z.
IT_REPORT-WEMNG = IT_S023-WEMNG.
APPEND IT_REPORT.
ENDLOOP.
LOOP AT IT_REPORT .
IF IT_REPORT-ENMNG IS NOT INITIAL.
WRITE:/5(10) IT_REPORT-ENMNG , 20(10) IT_REPORT-SPTAG ,40(20) IT_REPORT-MATKL .
*50(10) IT_REPORT-MATNR, 60(10) IT_REPORT-MCOMP .
ENDIF.
ENDLOOP.
WRITE:/ 'TOTAL::',x.
WRITE:/ 'Quantity of goods received ::',z.
b = x - z.
WRITE:/ 'Process Loss ::' , b .
‎2008 Jan 14 10:41 AM
well, you've got a few more materials in QA, don't you?
in order to not change your code around too much, try sorting IT_MARA by MATNR and then use the BINARY SEARCH addition to the "READ TABLE it_mara" statement.
Apply this also to your other READ TABLEs, and the code should run much faster.
Cheers
Thomas
Edit: looking at your code again, why do you need IT_MARA at all? You don't seem to use it in your code.
‎2008 Jan 14 10:36 AM
Check the run time analysis carefully you will get the reason behind the short dump. Post that reason it will help us to solve your problem
‎2008 Jan 14 10:39 AM
Hi Vijay
Can you please confirm the run time error message you are getting. This will help us to analyze the problem better. Hopefully you are not getting a time out error
~ Ranganath
‎2008 Jan 14 10:41 AM
Hi
Thanks for the reply.The below is the runtime analys.
Vijay
After a specific time, the program is terminated to make the work area
available to other users who may be waiting.
This is to prevent a work area being blocked unnecessarily long by, for
example:
- Endless loops (DO, WHILE, ...),
- Database accesses with a large result set
- Database accesses without a suitable index (full table scan)
The maximum runtime of a program is limited by the system profile
parameter "rdisp/max_wprun_time". The current setting is 600 seconds. If this
time limit is
exceeded, the system attempts to cancel any running SQL statement or
signals the ABAP processor to stop the running program. Then the system
waits another 60 seconds maximum. If the program is then still active,
the work process is restarted.
‎2008 Jan 14 10:41 AM
well, you've got a few more materials in QA, don't you?
in order to not change your code around too much, try sorting IT_MARA by MATNR and then use the BINARY SEARCH addition to the "READ TABLE it_mara" statement.
Apply this also to your other READ TABLEs, and the code should run much faster.
Cheers
Thomas
Edit: looking at your code again, why do you need IT_MARA at all? You don't seem to use it in your code.
‎2008 Jan 14 10:57 AM
Hi thomas
where exactly i need to add d SORT statement.Please help
Vijay
‎2008 Jan 14 11:01 AM
Hi all
if i dont put the read statement its working fine.Please help
Vijay
‎2008 Jan 14 11:38 AM
SELECT *
INTO CORRESPONDING FIELDS OF TABLE IT_MARA
FROM ( MARA AS A
INNER JOIN S026 AS B ON B~MATNR = A~MATNR ).
SORT IT_MARA BY MATNR. <--insert
SELECT * FROM s023 INTO
CORRESPONDING FIELDS OF TABLE IT_s023 WHERE
WERKS = P_WERKS AND
SPTAG IN P_SPTAG .
SELECT *
INTO CORRESPONDING FIELDS OF TABLE IT_T023T
FROM ( T023T AS C
INNER JOIN MARA AS D ON D~MATKL = C~MATKL ) .
LOOP AT IT_S026.
READ TABLE it_mara with key matnr = it_S026-matnr BINARY SEARCH. <-- change
READ TABLE it_t023t with key matKL = it_MARA-matKL.But again, since you are not using the values in IT_MARA, you might be able to get rid of it altogether.
Greetings
Thomas
‎2008 Jan 14 10:44 AM