Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Issues while process the tcode OX09

Former Member
0 Likes
1,145

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
945

Hi Vishnu,

you can not place a TCD-command inside of an ABAP-ENDABAP block.

Best regards,

Christoph

3 REPLIES 3
Read only

Former Member
0 Likes
946

Hi Vishnu,

you can not place a TCD-command inside of an ABAP-ENDABAP block.

Best regards,

Christoph

Read only

0 Likes
945

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.

Read only

Former Member
0 Likes
945

Answered to myself satisfactorily.