This website is not affiliated with, sponsored by, or approved by SAP AG.

Internal Table

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Internal Table

Postby pazzuzu » Wed Apr 02, 2014 7:24 am

I have a table /Dir/STD_A181_VE which looks like follows with contents:

DocType MovType
ZVEB 122
ZVLP 122


Iam doing as follows to select value from the table.

SELECT * FROM /Dir/STD_A181_VE
INTO CORRESPONDING FIELDS OF TABLE LT_A181_VE.

SELECT SINGLE BSART FROM EKKO INTO LV_BSART
WHERE
EBELN = '4500000001' AND
( BSART = 'ZVEB' OR
BSART = 'ZVLP' ).
I want to modify the above coding so that it looks like follows:

SELECT SINGLE BSART FROM EKKO INTO LV_BSART
WHERE
EBELN = '4500000001' AND
( BSART in LT_A181_VE-bsart[] ) in one statement.
In one statement,I want to check for the DocType instead of hardcoding it.
Is there a trick to do it without looping the table.

Any hint is appreciated.
Thanks
K
pazzuzu
 
Posts: 45
Joined: Fri Jun 12, 2009 5:09 am

Re: Internal Table

Postby Gothmog » Wed Apr 02, 2014 7:36 am

Use the result of your selection on /Dir/STD_A181_VE to fill a RANGE of BSART, and use this range in your later selections.
You could also use 'FOR ALL ENTRIES' (check the table is not empty first).
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1943
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Internal Table

Postby pazzuzu » Wed Apr 02, 2014 8:05 am

Hi Gothmog,

Thanks for the reply.
If I want to use the FOR ALL entries;then it will take into account the movement type as well,right.
I want to check only the docType.

Can i do that?

SELECT SINGLE BSART FROM EKKO INTO LV_BSART
for ALL ENTRIES IN LT_A181_VE
WHERE
EBELN = '4500000001'
pazzuzu
 
Posts: 45
Joined: Fri Jun 12, 2009 5:09 am

Re: Internal Table

Postby Gothmog » Wed Apr 02, 2014 8:11 am

No, it will check whatever conditions you have in your WHERE clause.
Have a look at the ABAP help on FOR ALL ENTRIES for details of the syntax.
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1943
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Internal Table

Postby pazzuzu » Wed Apr 02, 2014 8:24 am

Thanks.Will Try it out.
pazzuzu
 
Posts: 45
Joined: Fri Jun 12, 2009 5:09 am

Re: Internal Table

Postby kristinabalai » Thu Apr 17, 2014 12:31 am

helo I'm facing similar problem, still not work.
kristinabalai
 
Posts: 1
Joined: Thu Apr 17, 2014 12:26 am

Re: Internal Table

Postby Gothmog » Thu Apr 17, 2014 4:11 am

It works if you code it right, but with such a precise description of your problem - no, not precise, the other word that means the exact opposite - I'm afraid we can't help you.
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1943
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home


Return to ABAP

Who is online

Users browsing this forum: No registered users and 4 guests





This website is not affiliated with, sponsored by, or approved by SAP AG.