‎2010 Oct 04 12:32 PM
Hi Group,
I am facing issues while executing the eCATT script for multiple records.
the issue is as under:
- I will be getting only the PLANT data from the excel file
- we need to fetch the Storage Locations connected to this PLANT from table TWLAD
- then process all the Storage locations for the tcode OX09
- the code is as under:
lv_plant = plant.
abap.
types: begin of ty_slocs,
sloc type LGORT_D,
end of ty_slocs.
data: it_slocs type table of ty_slocs,
wa_slocs type ty_slocs,
lv_tzone type LFREG.
select lgort from twlad into table it_slocs where werks = lv_plant.
select single zone1 from t001w into lv_tzone where werks = lv_plant.
describe table it_slocs lines lv_no_of_records.
loop at it_slocs into wa_slocs.
sloc = wa_slocs-sloc.
tzone = lv_tzone.
if sloc is not initial.
TCD ( OX09 , OX09_1 ).
endif.
clear wa_slocs.
endloop.
endabap.
- I need to populate the Transportation zone from T001W for the PLANT and populate this zone for each and every Storage Loc
- I was getting error at the statement "TCD ( OX09 , OX09_1 )." in the code, but when I kept this statement after endabap, I was
not getting any error but only the last record is getting processed.
- The loop is getting executed only once for the last record fetched
So please let me know your inputs on how to process this.
Regards,
Vishnu.
‎2010 Oct 04 10:03 PM
Hi Vishnu,
you can not place a TCD-command inside of an ABAP-ENDABAP block.
Best regards,
Christoph
‎2010 Oct 04 10:03 PM
Hi Vishnu,
you can not place a TCD-command inside of an ABAP-ENDABAP block.
Best regards,
Christoph
‎2010 Oct 06 2:39 PM
Hi Group,
I have solved the issue myself and this is the code:
lv_plant = plant.
abap.
types: begin of ty_slocs,
lgort type LGORT_D,
seq_no type LFDNR_TWLAD,
end of ty_slocs.
data: it_slocs type table of ty_slocs,
wa_slocs type ty_slocs,
lv_tzone type LFREG.
select lgort lfdnr from twlad into table it_slocs where werks = lv_plant.
if sy-subrc eq 0.
endif.
select single zone1 from t001w into tzone where werks = lv_plant.
if sy-subrc eq 0.
endif.
describe table it_slocs lines lv_no_of_records.
loop at it_slocs into wa_slocs.
lw_record-lgort = wa_slocs-lgort.
lw_record-kzill = wa_slocs-seq_no.
append lw_record to lt_records.
clear lw_record.
endloop.
sort lt_records by lgort.
endabap.
do ( lv_no_of_records ).
abap.
lt_start_row = lt_start_row + 1.
clear lw_record.
read table lt_records into lw_record index lt_start_row.
if sy-subrc eq 0.
sloc = lw_record-lgort.
position = lw_record-kzill.
endif.
clear lw_record.
endabap.
TCD ( XXXX , XXXX_1 ).
enddo.
Hope the logic will be useful when the same kind of error is encountered.
Regards,
Vishnu.
‎2010 Oct 06 2:42 PM