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: 

how to write the select statement when the I.T table is with header line

Former Member
0 Kudos

Hi,

i have a select statement..

SELECT matnr

werks

lvorm

mmsta

mmstd

FROM marc

INTO TABLE i_marc

WHERE matnr = xt_iotab-matnr.

here xt_iotab is the internal table with header line. but is showing the error like.. xt_iotab is with out header line.

how to write the above select statement when the I.T table is with header line..

5 REPLIES 5

Former Member
0 Kudos

HI Mythily



IF xt_iotab[] IS NOT INITIAL.
SELECT matnr
werks
lvorm
mmsta
mmstd
FROM marc
INTO TABLE i_marc
FOR ALL ENTRIES IN xt_iotab
WHERE matnr EQ xt_iotab-matnr.
ENDIF.

Pushpraj

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Mythily,

Are you doing a FOR ALL ENTRIES or selecting data by LOOP'ing on the table xt_iotab?

Please be more specific when you post your code, else it is not possible to analyse.

BR,

Suhas

0 Kudos

hi , mithily ,

use if xt_iotabp[] is not initial .

endif.

Don't use xt_iotab[] is initial .

Deepak

deepak_dhamat
Active Contributor
0 Kudos

Try this ,

types : Begin of w_iotab ,

matnr type mara-matnr ,

bismt type mara-bismt ,

end of w_iotab.

types : begin of w_marc ,

matnr type marc-matnr ,

werks type marc-werks,

lvorm type marc-ivorm ,

mmsta type marc-mmsta ,

mmstd type marc-mmstd,

end of w_marc .

data : xt_iotab type standard table of w_iotab with header line .

data : i_marc type standard table of w_marc with header line .

select bismt

matnr

from mara into corresponding fields of table xt_iotab.

if sy-subrc = 0 .

if xt_iotab[] is initial .

SELECT matnr

werks

lvorm

mmsta

mmstd

FROM marc

INTO corresponding fields of TABLE i_marc

for all entries in xt_iotab

WHERE matnr = xt_iotab-matnr.

endif.

endif.

use this code ....

Regards

Deepak .

Former Member
0 Kudos

Hi,

First you need to check if the internal table is initial or not and then use for all entries in your select statement as told above.

Regards,

Rahul