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

Data not Retrieved through internal table.

Former Member
0 Likes
476

Hello Experts!!!!!

I have a structure yomresponse, which i have created through se11.

I have to get values of SHORT and STEXT from table HRP1000 into an internal table

it_yomresponse based on the pernr. I have written the following code but i am not

getting the right values.

DATA: it_yomresponse TYPE standard TABLE OF yomresponse,
wa_yomresponse TYPE yomresponse.
 SELECT SINGLE plans FROM  pa0001 INTO wa_yomresponse-eposid
    WHERE pernr = pa_objid.  "Pa_objid is coming from Selection screen

SELECT short stext FROM hrp1000
    INTO CORRESPONDING FIELDS OF TABLE it_yomresponse
WHERE objid =  wa_yomresponse-eposid.

 LOOP AT it_yomresponse INTO wa_yomresponse.
    WRITE:/ wa_yomresponse-eposstxt,
            wa_yomresponse-eposdesc.
  ENDLOOP.

Any pointers will be helpful.

Thanks

Nitesh.

3 REPLIES 3
Read only

Former Member
0 Likes
443

Hi,

Its always better to use all the key fileds while using select single. Please modify the selct statemnt to check for all key fields.


SELECT SINGLE plans FROM  pa0001 INTO wa_yomresponse-eposid
    WHERE pernr = pa_objid.  

Please modify the select statement :

Intead of using 'into corresponding fields' declare the internal table with only those fields required...


SELECT short stext FROM hrp1000
    INTO TABLE it_yomresponse
 WHERE objid =  wa_yomresponse-eposid.
 

Read only

Former Member
0 Likes
443

Hi,

Check this



DATA: BEGIN OF it_yomresponse OCCURS 0,
      short TYPE hrp1000-short,
      stext TYPE hrp1000-stext,
      eposid TYPE pa0001-plans,
      END OF it_yomresponse.

DATA: lv_eposid TYPE pa0001-plans.

DATA: wa_yomresponse LIKE LINE OF it_yomresponse.
SELECT SINGLE plans FROM  pa0001 INTO lv_eposid
   WHERE pernr EQ '10'.  "Pa_objid is coming from Selection screen


SELECT short stext FROM hrp1000
    INTO CORRESPONDING FIELDS OF TABLE it_yomresponse
WHERE objid EQ  lv_eposid.

LOOP AT it_yomresponse.
  it_yomresponse-eposid = lv_eposid.

  MODIFY it_yomresponse TRANSPORTING eposid.

ENDLOOP.

LOOP AT it_yomresponse INTO wa_yomresponse.
  WRITE:/ wa_yomresponse-short,
          wa_yomresponse-stext,
          wa_yomresponse-eposid.
ENDLOOP.

Your fields in the internal table were eposstxt and eposdesc, but in the SELECT query, you are trying to use corresponding fields (short, stext). Also you havent updated your eposid into the internal table. You gotto append them for every record you retrieve in the second select query.

Read only

Former Member
0 Likes
443

Hi,

You are comparing PLANS field value to OBJID to fetch the records from the table.

It may be the case that these both fields have different values.

I check in my system.These two fields doesnt have one single common value.

Regards,

Sunny