Application Development 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: 

Regarding data transfer

Former Member
0 Kudos

Hi Experts,

SELECT keyseg

datseg

FROM /alogis/cdpos

INTO TABLE lt_/alogis/cdpos

WHERE keytyp EQ lc_keytyp.

if not is lt_/alogis/cdpos[] initial.

SELECT matnr

FROM mvke

INTO TABLE gt_mvke

FOR ALL ENTRIES IN lt_/alogis/cdpos

WHERE mtpos = 'YVWH'

or mtpos = lt_/alogis/cdpos-dataseg+0(4).

AND vkorg = pa_vkorg

AND vtweg = pa_vtweg.

endif.

where "lt_/alogis/cdpos" is an internal table of type "/alogis/cdpos" which is a DB table and which have the following fields"KEYSEG" and "DATASEG" and again "DATASEG" contain 4 fileds and first field is MTPOS(4),

now my question i want to extract data into gt_mvke which shld contain only those entries of MTPOS which r present in "/alogis/cdpos" and as well as MTPOS = 'YVWH'.

so i have extracted data from /alogis/cdpos into one internal table"lt_/alogis/cdpos" and now for all entries of this table shld be equal to MTPOS of MVKE.

but its giving some error message. wht could b the best method.

Please help me

Thanx in Advance

1 ACCEPTED SOLUTION

former_member181962
Active Contributor
0 Kudos

Change the code as follows

if not is lt_/alogis/cdpos[] initial.

loop at lt_/alogis/cdpos.

itab-mtpos = lt_/alogis/cdpos-dataseg+0(4).

append itab.

clear itab.

endloop.

SELECT matnr

FROM mvke

INTO TABLE gt_mvke

FOR ALL ENTRIES IN itab

WHERE ( mtpos = 'YVWH'

or mtpos = itab-mtpos )

AND vkorg = pa_vkorg

AND vtweg = pa_vtweg.

endif.

Regards,

Ravi

6 REPLIES 6

former_member181962
Active Contributor
0 Kudos

Change the code as follows

if not is lt_/alogis/cdpos[] initial.

loop at lt_/alogis/cdpos.

itab-mtpos = lt_/alogis/cdpos-dataseg+0(4).

append itab.

clear itab.

endloop.

SELECT matnr

FROM mvke

INTO TABLE gt_mvke

FOR ALL ENTRIES IN itab

WHERE ( mtpos = 'YVWH'

or mtpos = itab-mtpos )

AND vkorg = pa_vkorg

AND vtweg = pa_vtweg.

endif.

Regards,

Ravi

0 Kudos

so now i shld create a internal table itab and it shld contain one field that is MTPOS .

Thanks in advance. It it works inshallah i wil give u 10 pts.

0 Kudos

HI Abdul,

Yes, you should create an internal table itab.

Do revert in case of any other issues.

Regards,

Ravi

Former Member
0 Kudos

yes u have to declare a field as mtpos is a large field and u want to use only first 4 char of this....

in a select statement u can't use field+0(4) or such things....

so declare a internal table with a field and move the data to this field and append the internal table.....now use this in ur select statement using for all entries and the field in where condition....

0 Kudos

Thanks alot for helping me........May God fulfill all ur desires and dreams.

0 Kudos

thanks