10-05-2005 9:26 PM
Hi,
I am trying to change a BADI interface and since BADIs use ABAP OO, a simple loop statement fails to work.
I need to loop through an internal table and for each record in the internal table I need to read another db table which has a field in common with the internal table.
Ideally,
Loop at lt_selections
select logsys from /bic/mzcs_unit where /bic/zcs_unit = lt_selections-cs_unit
endloop.
But this piece of code fails to work in BADI because of OO concepts.
Can anyone help me out here?
THank you
10-05-2005 9:48 PM
Hi,
Try using this code:
1. Create a work area to internal table lt_selections.
data: wa_selections like line of lt_selections.
2. Change the loop:
Loop at lt_selections into wa_wa_selections.
select logsys from /bic/mzcs_unit where /bic/zcs_unit = wa_selections-cs_unit
endloop.
or use FOR ALL ENTRIES statement:
select logsys from /bic/mzcs_unit
FOR ALL ENTRIES IN lt_selections
where /bic/zcs_unit = lt_selections-cs_unit.
Regards,
Alejandro
10-05-2005 9:41 PM
Deep,
Actually the code below does work. It doesnt depend on OO concept in BADI or other.
May be there may be a type mis match between the field in the internal table and the key in the db table.
Check.
Regards,
10-05-2005 9:48 PM
Hi,
Try using this code:
1. Create a work area to internal table lt_selections.
data: wa_selections like line of lt_selections.
2. Change the loop:
Loop at lt_selections into wa_wa_selections.
select logsys from /bic/mzcs_unit where /bic/zcs_unit = wa_selections-cs_unit
endloop.
or use FOR ALL ENTRIES statement:
select logsys from /bic/mzcs_unit
FOR ALL ENTRIES IN lt_selections
where /bic/zcs_unit = lt_selections-cs_unit.
Regards,
Alejandro
10-05-2005 10:27 PM
As Alejandro said, if you are getting a syntax error, it is probably because <b>header lines are not allow in OO</b>.
data: wa_selections like line of lt_selections.
Loop at lt_selections into wa_wa_selections.
select logsys from /bic/mzcs_unit
where /bic/zcs_unit = wa_selections-cs_unit.
endloop.
Regards,
Rich Heilman
Message was edited by: Rich Heilman