Application Development 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: 

While fetching Sy-subrc Eq 0. But no records are appending.

former_member196331
Active Contributor
0 Kudos

HI,

I need a small clarification

Below is my Structure i was Declared.


TYPES: BEGIN OF TEMP_AFVC.

TYPES: BEARZ_PTIME TYPE P LENGTH 16 DECIMALS 3.

TYPES: BEAZE_PUNIT TYPE  AFVV-BEAZE.

TYPES: BEARZ_PTIME_H TYPE P LENGTH 16  DECIMALS 3.

TYPES: BEAZE_PUNIT_H TYPE AFVV-BEAZE.

         INCLUDE STRUCTURE AFVC.

TYPES: END OF TEMP_AFVC.

DATA:IT_TEMP_AFVC TYPE TABLE OF TEMP_AFVC,

      WA_TEMP_AFVC TYPE TEMP_AFVC.


Now i would like to Fetch the data from the Data base to My internal table. query like below.


IF NOT SIT_AUFPL IS INITIAL.

     SELECT * INTO CORRESPONDING FIELDS OF TABLE  IT_TEMP_AFVC FROM AFVC. "

*      FOR ALL ENTRIES IN SIT_AUFPL[]

*      WHERE  AUFPL EQ SIT_AUFPL-AUFPL.

   ENDIF.



But no data is fetching , May i know why. Things i did.


1)Data is available. No doubt.


2)In debugging Query is running, means , cursor is moving into the if condition.


3)I changes Aufpl instead of * but no use.



Any information please Update me.

.

1 ACCEPTED SOLUTION

matt
Active Contributor
0 Kudos

I've checked everything and run this on my own system without errors. It gets data.

This is my test code. The trick with writing test code is to remove all the complexities except your exact problem. In this case, the select seems not to be working - so remove the IF... ENDIF around it:

TYPES: BEGIN OF temp_afvc.

TYPES: bearz_ptime TYPE p LENGTH 16 DECIMALS 3.

TYPES: beaze_punit TYPE  afvv-beaze.

TYPES: bearz_ptime_h TYPE p LENGTH 16  DECIMALS 3.

TYPES: beaze_punit_h TYPE afvv-beaze.

         INCLUDE STRUCTURE afvc.

TYPES: END OF temp_afvc.

DATA:it_temp_afvc TYPE TABLE OF temp_afvc,

       wa_temp_afvc TYPE temp_afvc.

SELECT * INTO CORRESPONDING FIELDS OF TABLE  it_temp_afvc FROM afvc. "

LOOP AT it_temp_afvc INTO wa_temp_afvc.

   WRITE / wa_temp_afvc-aufpl.

ENDLOOP.

Do the following.

1. Create a test program in your system with the above code and run it. Does it work?

2. If not please post a screen dump of SE16 on AFVC. Because the most likely cause of your problem is that, despite your statement to the contrary, there is no data in the table.

3. If you really have got data then you need to send your SAP system back to SAP because it's clearly broken.

7 REPLIES 7

former_member226239
Contributor
0 Kudos

How many records are there in AFVC?

Can you try up to 10 rows at the end of the select statement and see what is happening?

-Chandra

0 Kudos

Hi, Thanks for your reply. No use. Still not appending to my internal table.

I have two structures. Both are behaving the Same.

Can any body please Tell me what is the mistake i Did it in the above Declaration. Never faced this type of problem.

IF NOT SIT_AUFPL IS INITIAL.

     SELECT * UP TO 10 rows INTO CORRESPONDING FIELDS OF TABLE  IT_TEMP_AFVC FROM AFVC. "

*      FOR ALL ENTRIES IN SIT_AUFPL[]

*      WHERE  AUFPL EQ SIT_AUFPL-AUFPL.

   ENDIF.

   IF NOT SIT_AUFPL IS INITIAL.

     SELECT * up to 10  rows INTO CORRESPONDING FIELDS OF TABLE   IT_TEMP_FAFVV FROM AFVV .

     " WHERE  AUFPL = 0000000099.

*       FOR ALL ENTRIES IN SIT_AUFPL[]

*      WHERE AUFPL EQ SIT_AUFPL-AUFPL.

   ENDIF.

0 Kudos

This message was moderated.

0 Kudos

This message was moderated.

0 Kudos

This message was moderated.

matt
Active Contributor
0 Kudos

I've checked everything and run this on my own system without errors. It gets data.

This is my test code. The trick with writing test code is to remove all the complexities except your exact problem. In this case, the select seems not to be working - so remove the IF... ENDIF around it:

TYPES: BEGIN OF temp_afvc.

TYPES: bearz_ptime TYPE p LENGTH 16 DECIMALS 3.

TYPES: beaze_punit TYPE  afvv-beaze.

TYPES: bearz_ptime_h TYPE p LENGTH 16  DECIMALS 3.

TYPES: beaze_punit_h TYPE afvv-beaze.

         INCLUDE STRUCTURE afvc.

TYPES: END OF temp_afvc.

DATA:it_temp_afvc TYPE TABLE OF temp_afvc,

       wa_temp_afvc TYPE temp_afvc.

SELECT * INTO CORRESPONDING FIELDS OF TABLE  it_temp_afvc FROM afvc. "

LOOP AT it_temp_afvc INTO wa_temp_afvc.

   WRITE / wa_temp_afvc-aufpl.

ENDLOOP.

Do the following.

1. Create a test program in your system with the above code and run it. Does it work?

2. If not please post a screen dump of SE16 on AFVC. Because the most likely cause of your problem is that, despite your statement to the contrary, there is no data in the table.

3. If you really have got data then you need to send your SAP system back to SAP because it's clearly broken.

0 Kudos

Hi,

Thanks for your reply. Yes, Checking. Some problem From my side.