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

Former Member
0 Likes
833

Hi all,

im getting some problems with the program when im trying to achieving this

select all LIFSP from table TVLSP for LFART eq ' LF'

get description from table TVLST

i wrote the code like this.

FORM f_extract_delivery_blocks .

CLEAR i_tvlsp.

REFRESH i_tvlsp.

SELECT lifsp lfart INTO TABLE i_tvlsp

FROM tvlsp

WHERE lfart EQ c_lf. " c_lf value LF

IF sy-subrc NE 0.

PERFORM f_send_message USING 'TVLSP'.

RETURN.

ENDIF.

select spras lifsp vtext into corresponding fields of table i_tvlst

from tvlst

for all entries in i_tvlsp

where lifsp eq i_tvlsp-lifsp.

If sy-subrc = 0.

sort i_tvlst by lifsp vtext.

else.

PERFORM f_send_message USING 'TVLST'.

RETURN.

endif.

  • Transfer to the consolidated table

LOOP AT i_tvlsp.

CLEAR : i_cons_tab.

MOVE c_lf TO i_cons_tab-id.

MOVE i_tvlsp-lifsp TO i_cons_tab-dlb.

read table i_tvlst with table key lifsp = c_lf.

if sy-subrc = 0.

move i_tvlst-spras to i_cons_tab-spras.

MOVE i_tvlst-vtext TO i_cons_tab-text.

endif.

APPEND i_cons_tab.

ENDLOOP.

im getting error like

The declaration for the key field "VTEXT" is incomplete. However,"VTEXT" is is contained in the key of table "I_TVLST". and must be filled.

2)

SAP Config Table - TVAPT - Extract only Z prefixed values and text. how can extract value pstyv from table tvapt where pstyv starts with z.

could somebody help me with this.

thanks,

kiran.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
800

Hi Kiran,

1. Couldn't figure out your first error.

2.SAP Config Table - TVAPT - Extract only Z prefixed values and text. how can extract value pstyv from table tvapt where pstyv starts with z.

You can extract field values starting with Z* with the following code.

RANGES range for tvapt-pstyv.
range-sign = 'I'.
range-option = 'CP'.
range-low = 'Z*'.
APPEND range.

TABLES tvapt.
SELECT * FROM tvapt INTO TABLE itab WHERE pstyv IN range.

Regards,

Wenceslaus.

4 REPLIES 4
Read only

Former Member
0 Likes
800

Hi Kiran.

instead of read, use Loop with where condition..dat works.

also for 2nd query u can use select **** where pstyv like 'Z%'.

Hope it helps.

Regards,

Bikash

Read only

Former Member
0 Likes
800

I'll try to answer the secong question first.

do like this

select *

from tvapt

into table t_tvapt

where pstyv like 'Z%'.

  • Sample usage of like statement:

PARAMETERS srch_str(20) TYPE c.

CONCATENATE '%' srch_str '%' INTO srch_str.

DATA text_tab TYPE TABLE OF doktl.

SELECT *

FROM doktl

INTO TABLE text_tab

WHERE doktext LIKE srch_str.

REgards,

Ravi

Read only

Former Member
0 Likes
801

Hi Kiran,

1. Couldn't figure out your first error.

2.SAP Config Table - TVAPT - Extract only Z prefixed values and text. how can extract value pstyv from table tvapt where pstyv starts with z.

You can extract field values starting with Z* with the following code.

RANGES range for tvapt-pstyv.
range-sign = 'I'.
range-option = 'CP'.
range-low = 'Z*'.
APPEND range.

TABLES tvapt.
SELECT * FROM tvapt INTO TABLE itab WHERE pstyv IN range.

Regards,

Wenceslaus.

Read only

Former Member
0 Likes
800

Regarding the first question of yours, the error is something related to the declaration, so paste your declaration of the variables.

And one more thing is that when you use the for all entries statement,

you better check for initial before the select.

if not i_tvlst[] is initial.

select spras lifsp vtext into corresponding fields of table i_tvlst

from tvlst

for all entries in i_tvlsp

where lifsp eq i_tvlsp-lifsp.

Endif.