‎2010 Apr 05 4:15 PM
Hi,
In the following second select statement in where condition for objid(hrp1001-sobid) value im having multiple
values(records) but as per my coding it is passing only last value(record).i want to pass all the sobid values.
can u please give me some idea on this.
select sobid from hrp1001 into wa_hrp1001 where otype = 'NC' and
sclas = 'NB' and
begda = p_start AND
endda = p_end.
append wa_hrp1001 to it_hrp1001.
endselect.
IF it_hrp1001[] IS NOT INITIAL.
SELECT branch city region FROM hrp5126 INTO wa_hrp5126 WHERE otype = 'NB' AND
objid = wa_hrp1001-sobid and
begda = p_start AND
endda = p_end .
APPEND wa_hrp5126 TO it_hrp5126.
ENDSELECT.
ENDIF.
thanks in advance.
shwetha.
Moderator message: please use a more meaningful subject line next time.
Edited by: Thomas Zloch on Apr 6, 2010 9:18 AM
‎2010 Apr 05 4:24 PM
‎2010 Apr 05 4:37 PM
Hi,
for using for all entries sobid and objid are different data types..so it is not accepting.
Thx.
‎2010 Apr 05 5:21 PM
Check this,
TYPES:BEGIN OF ty,
sobid(8) TYPE n,
END OF ty.
DATA:wa TYPE ty,
it TYPE TABLE OF ty,
it2 TYPE TABLE OF hrp5126.
SELECT sobid FROM hrp1001 INTO TABLE it
WHERE otype = 'NC'.
IF it[] IS NOT INITIAL.
SELECT * FROM hrp5126 INTO TABLE it2
FOR ALL ENTRIES IN it
WHERE objid = it-sobid AND
otype = 'NB'.
ENDIF.
‎2010 Apr 05 4:39 PM
Use the following code :
select sobid from hrp1001 into table it_hrp1001 where otype = 'NC' and
sclas = 'NB' and
begda = p_start AND
endda = p_end.
append wa_hrp1001 to it_hrp1001.
IF it_hrp1001[] IS NOT INITIAL.
SELECT branch city region
FROM hrp5126 INTO TABLE it_hrp5126
FOR ALL ENTRIES IN it_hrp1001
WHERE otype = 'NB' AND
objid = it_hrp1001-objid and
begda = p_start AND
endda = p_end .
ENDIF.
‎2010 Apr 06 12:09 AM
Check the below points.
1. Fetch all the primary key fields.
2. Make use of for all entries.
3. Sort and delete adjacent duplicates if any.
‎2010 Apr 06 8:27 AM
‎2010 Apr 06 8:42 AM
Hi,
Please check the below logic.
You can create a new work area and internal table as shown below.
Better to avoid select/endselect statement.
Please check and let me know if any further issues.
select sobid from hrp1001 into wa_hrp1001 where otype = 'NC' and
sclas = 'NB' and
begda = p_start AND
endda = p_end.
append wa_hrp1001 to it_hrp1001.
*--Create a new work area and internal table
*--with correct field type which matches the hrp5126-objid
*--add additional fields which ever required for further processing in the new table and work area
wa_hrp-objid = wa_hrp1001-sobid.
append wa_hrp to i_objid.
clear: wa_hrp.
endselect.
IF i_objid.[] IS NOT INITIAL.
SELECT branch city region
FROM hrp5126 INTO TABLE it_hrp5126
FOR ALL ENTRIES IN i_objid.
WHERE otype = 'NB' AND
objid = i_objid-objid and
begda = p_start AND
endda = p_end .
ENDIF.
Regards
Shibino