‎2014 Feb 11 10:41 AM
Hello,
I created start and end routine to enhance some other data.
Actually it works fine. Results correct. But DTP needs really lot of time.
I am not a ABAP developer, so I think you can help me really easy.
Can you tell me how I can optimize coding?
Global:
*$*$ begin of global - insert your declaration only below this line *-*
... "insert your code here
* 20121130 2462
* Deklaration der internen Tabellen und Workareas
* Dispomerkmal
TYPES:
BEGIN OF gs_mat_plant,
mat_plant TYPE /bi0/oimat_plant,
plant TYPE /bi0/oiplant,
dismm TYPE /bi0/oidismm,
ABCKEY type /bi0/oiabckey,
PUR_GROUP type /bi0/oipur_group,
/BIC/ZXYZKE type /bi0/oiabckey,
END OF gs_mat_plant.
DATA: lt_mat_plant TYPE STANDARD TABLE OF gs_mat_plant
WITH KEY mat_plant plant.
"interne Tabelle
DATA: ls_mat_plant LIKE LINE OF lt_mat_plant. "Workarea
*$*$ end of global - insert your declaration only before this line *-*
Start routine:
*$*$ begin of routine - insert your code only below this line *-*
... "insert your code here
*-- fill table "MONITOR" with values of structure "MONITOR_REC"
*- to make monitor entries
... "to cancel the update process
* raise exception type CX_RSROUT_ABORT.
* 20121130 2462
* Dispomerkmal von Werk 1300 in die interne Tabelle laden
BREAK-POINT.
LOOP AT SOURCE_PACKAGE ASSIGNING <source_fields>.
SELECT mat_plant
plant
dismm
ABCKEY
PUR_GROUP
/BIC/ZXYZKEY
FROM /bi0/pmat_plant
INTO ls_mat_plant
WHERE plant = '1000'
AND mat_plant = <source_fields>-matnr.
ENDSELECT.
APPEND ls_mat_plant TO lt_mat_plant.
SELECT mat_plant
plant
dismm
ABCKEY
PUR_GROUP
/BIC/ZXYZKEY
FROM /bi0/pmat_plant
INTO ls_mat_plant
WHERE plant = '1300'
AND mat_plant = <source_fields>-matnr.
ENDSELECT.
APPEND ls_mat_plant TO lt_mat_plant.
ENDLOOP.
*$*$ end of routine - insert your code only before this line *-*
End routine:
*$*$ begin of routine - insert your code only below this line *-*
... "insert your code here
*-- fill table "MONITOR" with values of structure "MONITOR_REC"
*- to make monitor entries
... "to cancel the update process
* raise exception type CX_RSROUT_ABORT.
* 20121130 2462
* Füllen der fehlenden Felder im Ziel mit Daten aus den
* Stammdaten Werksmaterial
DATA: lt_rp LIKE RESULT_PACKAGE.
DATA: lv_count TYPE i.
BREAK-POINT.
LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.
* Auftragspositionen
READ TABLE lt_mat_plant
INTO ls_mat_plant
WITH KEY mat_plant = <result_fields>-material
plant = '1300'.
<result_fields>-/bic/zdim_1300 = ls_mat_plant-dismm.
<result_fields>-/bic/z_abc1300 = ls_mat_plant-abckey.
<result_fields>-/bic/z_xyz1300 = ls_mat_plant-/BIC/ZXYZKE.
<result_fields>-/bic/zpgrp1300 = ls_mat_plant-pur_group.
READ TABLE lt_mat_plant
INTO ls_mat_plant
WITH KEY mat_plant = <result_fields>-material
plant = '1000'.
<result_fields>-/bic/z_abc1000 = ls_mat_plant-abckey.
<result_fields>-/bic/z_xyz1000 = ls_mat_plant-/BIC/ZXYZKE.
<result_fields>-/bic/zpgrp1000 = ls_mat_plant-pur_group.
ENDLOOP.
*$*$ end of routine - insert your code only before this line *-*
I hope you can help me!
Regards
Jesper
‎2014 Feb 11 10:48 AM
Hi Jesper,
Write a code like below,
LOOP AT SOURCE_PACKAGE ASSIGNING <source_fields>.
SELECT mat_plant
plant
dismm
ABCKEY
PUR_GROUP
/BIC/ZXYZKEY
FROM /bi0/pmat_plant
INTO table lt_mat_plant
for all entries in SOURCE_PACKAGE.
WHERE plant in ('1000','1300')
AND mat_plant = <source_fields>-matnr.
The above code is enough for your condition.
APPEND ls_mat_plant TO lt_mat_plant.
SELECT mat_plant
plant
dismm
ABCKEY
PUR_GROUP
/BIC/ZXYZKEY
FROM /bi0/pmat_plant
INTO ls_mat_plant
WHERE plant = '1300'
AND mat_plant = <source_fields>-matnr.
ENDSELECT.
APPEND ls_mat_plant TO lt_mat_plant.
ENDLOOP.
Arivazhagan S
‎2014 Feb 11 10:48 AM
Hi Jesper,
Write a code like below,
LOOP AT SOURCE_PACKAGE ASSIGNING <source_fields>.
SELECT mat_plant
plant
dismm
ABCKEY
PUR_GROUP
/BIC/ZXYZKEY
FROM /bi0/pmat_plant
INTO table lt_mat_plant
for all entries in SOURCE_PACKAGE.
WHERE plant in ('1000','1300')
AND mat_plant = <source_fields>-matnr.
The above code is enough for your condition.
APPEND ls_mat_plant TO lt_mat_plant.
SELECT mat_plant
plant
dismm
ABCKEY
PUR_GROUP
/BIC/ZXYZKEY
FROM /bi0/pmat_plant
INTO ls_mat_plant
WHERE plant = '1300'
AND mat_plant = <source_fields>-matnr.
ENDSELECT.
APPEND ls_mat_plant TO lt_mat_plant.
ENDLOOP.
Arivazhagan S
‎2014 Feb 11 11:11 AM
Hello Arivazhagan,
thanks for quick answer. But in
for all entries in SOURCE_PACKAGE.
WHERE plant in ('1000','1300')
AND mat_plant = <source_fields>-matnr.
is an error.
Any idea?
Regards
Jesper
‎2014 Feb 11 11:44 AM
Hi Jesper,
for all entries in SOURCE_PACKAGE
WHERE mat_plant = <source_fields>-matnr
AND plant in ('1000','1300').
Please check now.
Arivazhagan S
‎2014 Feb 11 12:06 PM
My Coding now is following
SELECT mat_plant
plant
dismm
ABCKEY
PUR_GROUP
/BIC/ZXYZKEY
FROM /bi0/pmat_plant
INTO table lt_mat_plant
for all entries in SOURCE_PACKAGE
WHERE mat_plant = <source_fields>-matnr
AND plant in ('1000','1300').
ENDSELECT.
and I get message
"E:The WHERE condition does not refer to the FOR ALL ENTRIES table. -"
What can be the problem?
Regards
Jesper
‎2014 Feb 11 12:11 PM
Replace
for all entries in SOURCE_PACKAGE
WHERE mat_plant = <source_fields>-matnr
AND plant in ('1000','1300').with
for all entries in SOURCE_PACKAGE
WHERE mat_plant = SOURCE_PACKAGE-matnr
AND plant in ('1000','1300').Also read WHERE - FOR ALL ENTRIES
Regards,
Raymond
‎2014 Feb 11 12:28 PM
Hi Jesper,
Modify your code as suggested by Raymond and also delete endselect statement.
Arivazhagan S