‎2013 Feb 13 8:27 PM
I am trying to read the internal table into work area with some key values. But it fails,it returns with sy-subrc =4. Can anyone help me in this?
‎2013 Feb 14 3:45 PM
Hi Sarika,
I see that you different definition for table it_lineitemdt and workarea s_lineitemdt.
Try this.
DATA: it_lineitemdt TYPE STANDARD TABLE OF /bic/aassosit300.
DATA: s_lineitemdt LIKE LINE OF it_lineitemdt.
DATA: t_source TYPE STANDARD TABLE OF table.
DATA: s_source LIKE LINE OF t_source.
*(make sure this table t_source has first three fields are logsys, doc_number & s_ord_item.)
Get data into your t_source table.
Now get data in you it_lineitemdt table for all entries in t_source.
SELECT logsys doc_number s_ord_item contrstart contr1end
FROM (i_db_tab) into corresponding fields of table it_lineitemdt
FOR all entries in t_source
WHERE logsys = t_source-logsys
AND doc_number = t_source-doc_number
AND s_ord_item = t_source-s_ord_item.
sort it_lineitemdt by logsys doc_number s_ord_item.
sort t_source by logsys doc_number s_ord_item.
LOOP at t_source into i_source.
clear s_lineitemdt.
READ TABLE it_lineitemdt into s_lineitemdt with key logsys = i_source-logsys
doc_number = i_source-doc_number
s_ord_item = i_source-s_ord_item binary search.
if sy-subrc EQ 0
endif.
.
ENDLOOP.
I'm guessing this will help.
Thanks,
Amulya
‎2013 Feb 13 8:28 PM
hello,
it may be the case the table is not holding a record with the key you rae passing. If not explain what is happening with an example.
best regards,
swanand
‎2013 Feb 13 8:54 PM
Hi,
Please check the data population in internal table and u'r Read statement.
Thanks
Vivek
‎2013 Feb 13 9:20 PM
I have check the internal table it does have the key values which I am passing. I using doc number sales order item and logsys as my key and whenever these three conditions are passing I want to populate the result fields for some date. But in any condition the dates are 00000000.
Thanks
Sarika
‎2013 Feb 13 9:27 PM
Hi Sarika,
Can you post your read statement here? So we can help better.
Thanks,
Amulya
‎2013 Feb 13 9:31 PM
Amulya,
Following is the code for your reference.
loop at t_source into i_source.
clear result_fields.
move-corresponding i_source to result_fields.
clear s_lineitemdt.
read table it_lineitemdt into s_lineitemdt with key
logsys = i_source-logsys
doc_number = i_source-doc_number
s_ord_item = i_source-s_ord_item
binary search.
if sy-subrc = 0.
result_fields-contrstart = s_lineitemdt-contrstart.
result_fields-contr1end = s_lineitemdt-contr1end.
endif.
*********************************************************
*Append RESULTS_PACKAGE
*
append result_fields to result_package.
endloop.
Thanks
Sarika
‎2013 Feb 13 9:38 PM
hello,
you should sort the table it_lineitemdt using fields logsys, doc_number and s_ord_item before the loop statement.
best regards,
swanand
‎2013 Feb 13 9:34 PM
Did you sort the table it_lineitemdt before reading (by the key fields) as you are using binary search? Try that and let me know if it worked.
Thanks,
Amulya
‎2013 Feb 13 9:41 PM
Amulya, Swanand
this is first part of my code for you rreference. I did sort the it_lineitemdt table.
select logsys doc_number s_ord_item contrstart contr1end
from (i_db_tab) into corresponding fields of table it_lineitemdt
for all entries in t_source
where logsys = t_source-logsys
and doc_number = t_source-doc_number
and s_ord_item = t_source-s_ord_item.
sort it_lineitemdt by logsys doc_number s_ord_item.
Thanks
Sarika
‎2013 Feb 13 9:45 PM
one more thing, can you send the data definition of it_lineitemdt table
best regards,
swanand
‎2013 Feb 13 9:50 PM
During debug, try to check if data(fields logsys,doc_number,s_ord_item) in it_lineitemdt and t_source are in the same format or not. Just to see if we are missing any leading zero's for any fields. If possible try to give a screenshot of debug screen showing values.
-Amulya
‎2013 Feb 13 9:49 PM
Swanand
Here is the data defination:
DATA: it_lineitemdt TYPE STANDARD TABLE OF /bic/aassosit300.
DATA: BEGIN OF s_lineitemdt,
logsys TYPE /bic/aassosit300-logsys,
doc_number TYPE /bic/aassosit300-doc_number,
s_ord_item TYPE /bic/aassosit300-s_ord_item,
contrstart TYPE /bic/aassosit300-contrstart,
contr1end TYPE /bic/aassosit300-contr1end,
END OF s_lineitemdt.
‎2013 Feb 13 9:54 PM
apart from what amulya said above one moe thing to check is -
when you loop (loop at t_source into i_source) just check that data definition of t_source and i_source is same and the fields are in same sequence.
Other than you need to send screen shot of the table and the debug point where you are reading with the key values used.
best regards,
swanand
‎2013 Feb 13 10:16 PM
‎2013 Feb 14 3:22 PM
Amulya, Swanand,
Did you get the chance to go through the screenshots?
Thanks
Sarika
‎2013 Feb 14 3:41 PM
hello,
can you send the internal table as an excel and also the screen shot of the read statement with the keys. (the current one is not that clear.)
best regards,
swanand
‎2013 Feb 14 3:45 PM
Hi Sarika,
I see that you different definition for table it_lineitemdt and workarea s_lineitemdt.
Try this.
DATA: it_lineitemdt TYPE STANDARD TABLE OF /bic/aassosit300.
DATA: s_lineitemdt LIKE LINE OF it_lineitemdt.
DATA: t_source TYPE STANDARD TABLE OF table.
DATA: s_source LIKE LINE OF t_source.
*(make sure this table t_source has first three fields are logsys, doc_number & s_ord_item.)
Get data into your t_source table.
Now get data in you it_lineitemdt table for all entries in t_source.
SELECT logsys doc_number s_ord_item contrstart contr1end
FROM (i_db_tab) into corresponding fields of table it_lineitemdt
FOR all entries in t_source
WHERE logsys = t_source-logsys
AND doc_number = t_source-doc_number
AND s_ord_item = t_source-s_ord_item.
sort it_lineitemdt by logsys doc_number s_ord_item.
sort t_source by logsys doc_number s_ord_item.
LOOP at t_source into i_source.
clear s_lineitemdt.
READ TABLE it_lineitemdt into s_lineitemdt with key logsys = i_source-logsys
doc_number = i_source-doc_number
s_ord_item = i_source-s_ord_item binary search.
if sy-subrc EQ 0
endif.
.
ENDLOOP.
I'm guessing this will help.
Thanks,
Amulya
‎2013 Feb 14 10:34 PM
Amulya,
DATA: s_lineitemdt LIKE LINE OF it_lineitemdt.
it worked. Now I am seeing the data in my target DSO. please let me know how to assign points.
Thanks a lot,
Sarika
‎2013 Feb 15 1:39 PM
hello,
If you see the replies, I had pointed out that earlier.
best regards,
swanand
‎2013 Feb 15 3:38 PM
‎2013 Feb 15 6:32 PM
‎2013 Feb 14 10:50 PM
Amulya,
Not only that i also did
sort t_source by logsys doc_number s_ord_item.
Thanks
Sarika