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

Help

Former Member
0 Likes
1,105

I'm using LINK and LINP tables.... I don't know why in my output I'm not getting lgtyp and uname filled.

9 REPLIES 9
Read only

Former Member
0 Likes
1,075

Shaheen,

Can you please provide your selection code for these two tables?

Thanks.

Read only

0 Likes
1,075

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.

Read only

0 Likes
1,075

Hi,

Can you also provide the Internal table structures(itab and itab1)?

Srini

Read only

0 Likes
1,075

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.

Read only

0 Likes
1,075

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

Read only

0 Likes
1,075

sorry but none of them are wroking

Read only

0 Likes
1,075

Shaheen,

Can you please post your complete code??

The above should work in the report......

Read only

0 Likes
1,075

mine is a report too

Read only

Former Member
0 Likes
1,075

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.