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: 

Select statement is not retrieving the data in background

former_member569532
Participant
0 Kudos

Hi Experts,


I am facing the problem with the below select statement.This statement is working well in frontend.If I execute this in background it is not retrieving the data.Kindly any one assist how to solve this problem.




SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_ekkona_a

            FROM v_ekkona AS a INNER JOIN ekko AS b

              ON a~ebeln = b~ebeln

           WHERE a~ebeln IN s_ebeln[]

             AND a~bukrs EQ p_bukrs

             AND a~kappl = 'EF'

             AND a~bstyp = 'F'

             AND a~loekz = space

             AND a~bsart IN s_bsart[]

             AND a~lifnr IN s_lifnr[]

             AND a~kschl IN ('ZEML','ZNON'"IN s_kschl[]

             AND a~ekorg IN s_ekorg[]

             AND a~ekgrp IN s_ekgrp[]

             AND a~bedat IN s_bedat[]

             AND b~frgke EQ '1'

             AND b~ernam in s_ernam 

             AND a~vstat = p_vstat

             AND a~aktiv = space

             AND a~snddr = space.



Thanks & Regards,

Anusha

1 ACCEPTED SOLUTION

PeterJonker
Active Contributor
0 Kudos

Foreground or background, the same code will be execured AND on the same server. So there should be no difference.

I do see you use select-options with the table mark on it (e.g. s_ebeln[] ), Although this is not necessary, I also think that would not  be a reason to have different behavior in fore and background processing.

11 REPLIES 11

Former Member
0 Kudos

Did you get data in foreground run? check again

Did you run program with the help of variant? check again.

do you still receive blank.

then

debug background job. and check above mentioned values again.

karthikeyan_p3
Contributor
0 Kudos

Hi Anu,

If you are getting different output in the background job,

Compare the selection screen inputs in the variant & selection selection values of your report.

If your variant is corrupted/modified, try to recreate the variant and schedule the job.

Thanks,

Karthikeyan

0 Kudos

This should work both ways properly. But for more performance avoid using

Select * in to corresponding fields of.

Rather create a type and mention the fields in correct sequence which you want to fetech.

Example select XXX XXX XXX.......  into gt_ekkona_a FROM v_ekkona AS a INNER JOIN ekko AS b

This might be helpful. We can look in detail if there is any error generated in ST22.

Regards,

Veera

Former Member
0 Kudos

Hi Anu,

I don understand why your select is not working.

You can try use the follow fm:

call function 'VIEW_GET_DATA'

    exporting

      view_name = view

    tables

      data      = gt_data.

And then use FOR ALL ENTRIES instead of inner join.

If the view havent a lot of data. I think, It could work.

Regards.

David Cárceles.

raymond_giuseppi
Active Contributor
0 Kudos

SELECT execution is not related to execution in interactive or background, so « The truth is out there » (Plato, Heidegger, Fox Mulder)

Looking in actual values of selection criteria for some wrong formatted data, e.g. missing conversion-exit, should be your current aim.

Regards,

Raymond

Former Member
0 Kudos

Hi Anu,

This should work in both foreground and background.

Functioning of select query is same in both the modes.

Check your variants in both the ways and try to debug in background. I am sure there is some condition missing in your variant in background mode.

Regards,

Swati

Former Member
0 Kudos

Hello,

You can add the command WAIT UP TO XX SECONDS (XX should be enought time to the next operation) before the select, then while the process is waiting you can use the TCODE SM50 to debug it in background and check what parameters are in the where clause. To debug in SM50 select the PID with your program and click in the menu "Administration->Program->Debugging".

Regards,

Lucas

Former Member
0 Kudos

Anu Gottumukka wrote:

This statement is working well in frontend.If I execute this in background it is not retrieving the data

There is a difference between frontend/backend and foreground/background. What do you really mean??

Rob

PeterJonker
Active Contributor
0 Kudos

Foreground or background, the same code will be execured AND on the same server. So there should be no difference.

I do see you use select-options with the table mark on it (e.g. s_ebeln[] ), Although this is not necessary, I also think that would not  be a reason to have different behavior in fore and background processing.

0 Kudos

Hi All,

Thank you for your replies.

I am calling this in function module immediately after PO release.I check V_ekkona has data but my select statement is returning sy-subrc eq 4.

Thanks & Regards,

Anusha.B

0 Kudos

I have realised frgke is not set 1 after PO complete release,that is the reason select statement is not retrieving data.