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

Problem in select statement(urgent)

Former Member
0 Likes
1,522

hi experts,

I am Developing one Screen.In that screen i am using one listbox for year.Here i give my code.

IF YEAR_LIST IS INITIAL.

CLEAR ITAB_YEAR.

SELECT YEAR_A FROM ZRLNG_ACQ INTO CORRESPONDING FIELDS OF TABLE

ITAB_YEAR

WHERE CUSTNO_A = CUST.

CLEAR WA_YEAR.

CLEAR G_LIST.CLEAR VALUE.

LOOP AT ITAB_YEAR INTO WA_YEAR.

VALUE-KEY = WA_YEAR-YEAR_LIST.

VALUE-TEXT = WA_YEAR-YEAR_LIST.

APPEND VALUE TO G_LIST.

ENDLOOP.

SORT G_LIST BY KEY.

CLEAR WA_YEAR.CLEAR ITAB_YEAR.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = 'YEAR_LIST'

VALUES = G_LIST.

ENDIF.

In the above code i am selecting the year(YEAR_A) from the ztable which i created.But i am not getting the data.I checked in debugging mode it does not selects the YEAR_A from table i don't know why.

Please give me a solution.

Thanks in advance.

regards,

Ashok.

1 ACCEPTED SOLUTION
Read only

former_member404244
Active Contributor
0 Likes
1,483

Hi Ashok,

did u declare

DATA: g_list TYPE vrm_values.

i have given u one sample code,and it worked for me.So check the where conditions while retrieving the data.

regards,

nagaraj

14 REPLIES 14
Read only

former_member404244
Active Contributor
0 Likes
1,483

Hi Ashok,

check one sample code...

TYPE-POOLS: vrm.

PARAMETER: pr_spart TYPE spart AS LISTBOX VISIBLE LENGTH 7.

*AT SELECTION-SCREEN ON VALUE-REQUEST FOR pr_spart.

INITIALIZATION.

*----Code for Drop down list....

DATA: lit_spart_list TYPE vrm_values, "Table for list of Divisions

lwa_spart_list TYPE vrm_value,

lw_name TYPE vrm_id. "Name of parameter with list-box.

*---Assign selected values to table that would be passed to FM VRM_SET_VALUES

CLEAR : lwa_spart_list,

lw_name.

*---Pass required values for list-box display.

lwa_spart_list-key = 'H'.

lwa_spart_list-text = 'HL'.

APPEND lwa_spart_list TO lit_spart_list.

lwa_spart_list-key = 'S'.

lwa_spart_list-text = 'SL'.

APPEND lwa_spart_list TO lit_spart_list.

lwa_spart_list-key = 'P'.

lwa_spart_list-text = 'PP'.

APPEND lwa_spart_list TO lit_spart_list.

lwa_spart_list-key = 'F'.

lwa_spart_list-text = 'FR'.

APPEND lwa_spart_list TO lit_spart_list.

*Name of parameter to which list is to be assigned

lw_name = 'PR_SPART'.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = lw_name

values = lit_spart_list

EXCEPTIONS

id_illegal_name = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

also chek the data base,that it contains value for YEAR_A.

regards,

nagaraj

Message was edited by: nagaraj kumar nishtala

Read only

Former Member
0 Likes
1,483

SELECT <b>YEAR</b>_ -


FROM ZRLNG_ACQ INTO CORRESPONDING FIELDS OF TABLE

ITAB_YEAR

WHERE CUSTNO_A = CUST.

CLEAR WA_YEAR.

CLEAR G_LIST.CLEAR VALUE.

LOOP AT ITAB_YEAR INTO WA_YEAR.

VALUE-KEY = WA_YEAR-YEAR_LIST.

VALUE-TEXT = WA_YEAR-YEAR_LIST.

endloop.

just see if u r populating other fields from ur select criteria,,

cause it seems u r populating only one field year_a

into ur itab .

regards,

VIjay

Read only

anversha_s
Active Contributor
0 Likes
1,483

hi,

pls chk the data base,that it contains value for YEAR_A

rgds

anver

Read only

0 Likes
1,483

hi,

i checked the database table it contains the data.my doubt is 'year' is a key field and 'cust' also a key field.I am selecting the one key field with another key field.

regards,

Ashok.

Read only

0 Likes
1,483

Hi ashok,

<i>SELECT YEAR_A FROM ZRLNG_ACQ INTO CORRESPONDING FIELDS OF TABLE

ITAB_YEAR

WHERE CUSTNO_A = <b>CUST</b>.</i>

pls chk the where condition.

if it satisfies or not. if the where condition is not correct it will not fetch values.

so see the query with out the where condition.

<b>also check the cust has correct value or not</b>

rgds

anver

if hlped pls mark points

Read only

0 Likes
1,483

hi,

i checked the where condition.it contains the correct data.there is no problem.

regards,

Ashok.

Read only

Former Member
0 Likes
1,483

Hi,

check whather field named 'YEAR_A' is there in internal table ITAB_YEAR?

dafinition of internal table should be

DATA : BEGIN OF ITAB_YEAR OCCURS 0,

YEAR_A LIKE ZRLNG_ACQ-YEAR_A,

END OF ITAB_YEAR.

Looking into your code i feel that internal table definition of your may not be proper.

Kindly take only required field in intenal table.

try to avoid using "into correspoinding" .

  • REWARD if this helps

Message was edited by: Palak Limbachiya

Read only

0 Likes
1,483

hi,

i declared the internal table and work area correctly.internal table contains 'year_a'.

regards,

Ashok.

Read only

Former Member
0 Likes
1,483

hi

good

did you check in the ztable wheather it contains the value for the value you r giving in teh list box.

check that in se11, if value would be there than it must select that particular value, if value wont be there in the ztable than you wont find out any data.

thanks

mrutyun^

Read only

Former Member
0 Likes
1,483

Hi Ashok ,

can u just give ur code (i mean the whole code )..

we are not able to give u the correct solution as the options for the scope are very less.

regards,

vijay.

Read only

former_member404244
Active Contributor
0 Likes
1,484

Hi Ashok,

did u declare

DATA: g_list TYPE vrm_values.

i have given u one sample code,and it worked for me.So check the where conditions while retrieving the data.

regards,

nagaraj

Read only

0 Likes
1,483

hi Ashok,

this is really bad.

we all give a lot of time into ur problem.

but in the end not a single point for our effort.

i think this not good in forum.

rgds

anver

<b><i>pls mark all helpful answers</i></b>

Read only

Former Member
0 Likes
1,483

Agreed with Anversha.

Message was edited by: Palak Limbachiya

Read only

0 Likes
1,483

hi experts,

Sorry buddies...i am very sorry.

Problem solved.

Problem is in sql query.I should not use

SELECT YEAR_A FROM ZRLNG_ACQ INTO CORRESPONDING FIELDS OF TABLE ITAB_YEAR WHERE CUSTNO_A = CUST_NO.

instead of above statement i should use the below statement.

SELECT YEAR_A FROM ZRLNG_ACQ INTO TABLE ITAB_YEAR WHERE CUSTNO_A = CUST_NO.

Thank you very much for your cooperation.I need this cooperation from you guys for my every doubts.

Once again Sorry.

regards,

Ashok.