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

select statement coding needed

Former Member
0 Likes
612

Hi,

I need some coding to select data from table and insert in a target field.

In the definition of start routine I have this:

TYPES : BEGIN OF TYITAB,

MATERIAL TYPE /BI0/ASD_O0100-MATERIAL,

ITEM_CATEG TYPE /BI0/ASD_O0100-ITEM_CATEG,

END OF TYITAB.

DATA: ITAB TYPE STANDARD TABLE OF TYITAB,

WA TYPE TYITAB.

In the implementation:

I need it to write material and item category from /BI0/ASD_O0100 to itab where source_fields-material are identical with material.

Any help on select statement in implementation would be great.

Br,

Sonni

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
583

HI,

SELECT MATERIAL ITEM_CATEG  
 FROM  /BI0/ASD_O0100
 INTO TABLE ITAB
WHERE <Condt>.

5 REPLIES 5
Read only

Former Member
0 Likes
584

HI,

SELECT MATERIAL ITEM_CATEG  
 FROM  /BI0/ASD_O0100
 INTO TABLE ITAB
WHERE <Condt>.

Read only

0 Likes
583

Hi,

Thank you - it does give me a runtime error when executing which stops at the select statement beginning:

Error: GETWA_NOT_ASSIGNED.

> SELECT MATERIAL ITEM_CATEG

FROM /BI0/ASD_O0100

INTO TABLE ITAB

WHERE MATERIAL = <SOURCE_FIELDS>-MATERIAL.

What could be wrong?

Br,

Sonni

Edited by: Sonni Jacobsen on Jan 28, 2009 8:20 PM

Read only

0 Likes
583

Hi,

The problem could be with <SOURCE_FIELDS>-MATERIAL ..instead of this try to hard code the material number and test it.

Read only

0 Likes
583

Hi Sonni,

Error is because of the field symbol.

You are using field symbol without assigning it.

For example <fs> is a field symbol, you can not directly use it like

SELECT PERID

FROM PA0002

WHERE PERNR = <FS>-PERNR.

Actual procedure is

ASSIGN ITAB TO <FS> (please check syntax of ASSIGN).

and use

SELECT PERID

FROMPA0002

WHERE PERNR = <FS>-PERNR.

where itab is your internal table with field PERNR in it.

just assign your field symbol before using it.

mubeen

Read only

Former Member
0 Likes
583

Hi Sonni,

SELECT statement is a very important statement in ABAP and it is very simple.

SELECT field names

FROM database table name / view name

INTO TABLE internal table name

WHERE conditions

AND/OR more conditions.

ex: SELECT nachn vorna perid

from pa0002

into table itab

where pernr = '10001'.

There are other forms of SELECT like if you want to select just one record

SELECT SINGLE *

FROM data base table name

INTO stucture

WHERE conditions

AND/OR more conditions

There are many other forms, check syntax in ABAP editor

Let me know if you want to know more.

mubeen