2007 Feb 04 6:39 AM
I'm using LINK and LINP tables.... I don't know why in my output I'm not getting lgtyp and uname filled.
Shaheen,
LINK is header table and LINP is item table so your first table should be LINK to improve the performance:
Write the code as below:
select lgnum ivnum lgtyp uname FROM link INTO CORRESPONDING
FIELDS OF TABLE itab1 where lgnum = pa_lgnum AND ivnum IN s_ivnum.
select lgnum ivnum ivpos istat lgpla idatu from linp into
corresponding fields of table itab for all entries in table itab1 where lgnum = itab-lgnum and ivnum = itab-ivnum.
And then you will have to populate the respective fields in to the final table.
-
There is one better option of writting a JOIN statement which do not require above select statements:
Write code as below
TABLES: link, linp.
data: begin of itab occurs 0,
lgnum like link-lgnum,
ivnum like link-ivnum,
lgtyp like link-lgtyp,
uname like link-uname,
ivpos like linp-ivpos,
istat like linp-istat,
lgpla like linp-lgpla,
idatu like linp-idatu,
end of itab.
parameters: pa_lgnum like link-lgnum.
select-options: s_ivnum for link-ivnum.
select algnum aivnum algtyp auname bivpos bistat blgpla bidatu
from link as a
inner join linp as b on algnum = blgnum and aivnum = bivnum
into table itab
where a~lgnum = pa_lgnum
and a~ivnum in s_ivnum.
The table ITAB will have all required fields populated.
Let me know if this works.
Thanks
2007 Feb 04 6:42 AM
Shaheen,
Can you please provide your selection code for these two tables?
Thanks.
2007 Feb 04 6:46 AM
First table:
select lgnum ivnum ivpos istat lgpla idatu from linp into
corresponding fields of table itab where lgnum = pa_lgnum and ivnum
in s_ivnum.
Second table:
select lgnum ivnum lgtyp uname FROM link INTO CORRESPONDING
FIELDS OF TABLE itab1 where lgnum = pa_lgnum AND ivnum IN s_ivnum.
2007 Feb 04 6:51 AM
Hi,
Can you also provide the Internal table structures(itab and itab1)?
Srini
2007 Feb 04 6:58 AM
Types: begin of str1_tab,
lgnum type lgnum,
ivnum type LVS_IVNUM,
ivpos type LVS_IVPOS,
lgtyp type lgtyp,
lgpla type lgpla,
idatu type LVS_IDATU,
uname type LINK_UNAME,
end of str1_tab.
Data: itab type table of str1_tab,
wa_tab like line of itab,
wa_linp type linp,
wa_link type link.
DATA: itab1 TYPE TABLE OF str2_tab,
wa_tab1 LIKE LINE OF itab1.
Types: begin of str2_tab,
lgnum type lgnum,
charg type CHARG_D,
ivnum type LVS_IVNUM,
ivpos type LVS_IVPOS,
istat type LINV_ISTAT,
lgtyp type lgtyp,
lgpla type lgpla,
matnr type matnr,
uname type LINK_UNAME,
idatu type LVS_IDATU,
end of str2_tab.
Data: itab1 type table of str2_tab,
wa_tab1 like line of itab1,
wa_linv type linv.
2007 Feb 04 7:01 AM
Shaheen,
LINK is header table and LINP is item table so your first table should be LINK to improve the performance:
Write the code as below:
select lgnum ivnum lgtyp uname FROM link INTO CORRESPONDING
FIELDS OF TABLE itab1 where lgnum = pa_lgnum AND ivnum IN s_ivnum.
select lgnum ivnum ivpos istat lgpla idatu from linp into
corresponding fields of table itab for all entries in table itab1 where lgnum = itab-lgnum and ivnum = itab-ivnum.
And then you will have to populate the respective fields in to the final table.
-
There is one better option of writting a JOIN statement which do not require above select statements:
Write code as below
TABLES: link, linp.
data: begin of itab occurs 0,
lgnum like link-lgnum,
ivnum like link-ivnum,
lgtyp like link-lgtyp,
uname like link-uname,
ivpos like linp-ivpos,
istat like linp-istat,
lgpla like linp-lgpla,
idatu like linp-idatu,
end of itab.
parameters: pa_lgnum like link-lgnum.
select-options: s_ivnum for link-ivnum.
select algnum aivnum algtyp auname bivpos bistat blgpla bidatu
from link as a
inner join linp as b on algnum = blgnum and aivnum = bivnum
into table itab
where a~lgnum = pa_lgnum
and a~ivnum in s_ivnum.
The table ITAB will have all required fields populated.
Let me know if this works.
Thanks
2007 Feb 04 7:14 AM
2007 Feb 04 7:15 AM
Shaheen,
Can you please post your complete code??
The above should work in the report......
2007 Feb 04 7:36 AM
2007 Feb 04 8:09 AM
Hey Shaheen,
The Code looks fine...can you check the entries in the table(se16)
for the values you are entering int the parameters and the select-option, i think the table does have any values stored for your selection cretirea..
Srini.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |