|
|
This website is not affiliated with, sponsored by, or approved by SAP AG.
Development (ABAP Development WorkBench, ABAP/4 programming)
Moderators: thx4allthefish, Snowy, Gothmog, YuriT
by Alicealice » Tue Apr 03, 2012 9:31 pm
Dear All, I am facing some problem when created the new report. There is no any data appear on the report. After I debugged , the SY-SUBRC=4 in SELECT Statement. Could someone guide me on this? Below is my program. - Code: Select all
TYPES: BEGIN OF ty_lqua, lgnum TYPE lgnum, matnr TYPE matnr, werks TYPE werks_d, lgort TYPE lgort_d, charg TYPE charg_d, bestq TYPE bestq, lgtyp TYPE lgtyp, lgpla TYPE lgpla, verme TYPE lqua_verme, wdatu TYPE lvs_wdatu, END OF ty_lqua.
DATA: it_lqua TYPE TABLE OF ty_lqua, wa_lqua TYPE ty_lqua.
SELECT lgnum matnr werks lgort charg bestq lgtyp lgpla verme wdatu INTO TABLE it_lqua FROM lqua WHERE lgnum IN s_lgnum AND matnr IN s_matnr.
SORT it_lqua BY lgnum matnr.
IF sy-subrc = 0.
LOOP AT it_lqua INTO wa_lqua WHERE lgnum = wa_lqua-lgnum. wa_report-lgnum = wa_lqua-lgnum. wa_report-matnr = wa_lqua-matnr. wa_report-werks = wa_lqua-werks. wa_report-lgort = wa_lqua-lgort. wa_report-charg = wa_lqua-charg. wa_report-bestq = wa_lqua-bestq. wa_report-lgtyp = wa_lqua-lgtyp. wa_report-lgpla = wa_lqua-lgpla. wa_report-verme = wa_lqua-verme. wa_report-wdatu = wa_lqua-wdatu. * wa_report-line_colour = 'C300'. * wa_report-check = 'X'. APPEND wa_report TO it_report. ENDLOOP.
ENDIF.
Thank you
-
Alicealice
-
- Posts: 49
- Joined: Sun Oct 02, 2011 11:52 pm
by Gothmog » Wed Apr 04, 2012 3:29 am
There's no data corresponding to your selection. Did you check in SE16 on table LQUA ?
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
-
Gothmog
-
- Posts: 1467
- Joined: Wed Sep 12, 2007 4:46 am
- Location: Probably not home
by Alicealice » Wed Apr 04, 2012 3:51 am
Yes, I had checked in SE16 on table LQUA. There is a data in the table. Could you please advice? Thanks.
-
Alicealice
-
- Posts: 49
- Joined: Sun Oct 02, 2011 11:52 pm
by Gothmog » Wed Apr 04, 2012 3:58 am
What do you have in s_lgnum and s_matnr ? Does your data in LQUA match these selections ?
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
-
Gothmog
-
- Posts: 1467
- Joined: Wed Sep 12, 2007 4:46 am
- Location: Probably not home
by Alicealice » Wed Apr 04, 2012 4:22 am
s_lgnum and s_matnr are for report parameter. Yes, data in LQUA match the selections. Could you help me? There is no any data appear in the report, only have data.Thanks.
-
Alicealice
-
- Posts: 49
- Joined: Sun Oct 02, 2011 11:52 pm
by Gothmog » Wed Apr 04, 2012 4:26 am
Alicealice wrote:Yes, data in LQUA match the selections.
It seems it doesn't. That's what sy-subrc 4 means after a SELECT. Are you sure you're not missing leading zeroes in your matnr selection ?
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
-
Gothmog
-
- Posts: 1467
- Joined: Wed Sep 12, 2007 4:46 am
- Location: Probably not home
by Alicealice » Wed Apr 04, 2012 4:34 am
I have no idea on it. Any mistake in the SELECT statement? Thanks.
-
Alicealice
-
- Posts: 49
- Joined: Sun Oct 02, 2011 11:52 pm
by Rich » Wed Apr 04, 2012 9:13 am
First, as has been pointed out, make sure that your selectoin parameters have been passed through the correct conversion exits. If they are as you say they are SELECT-OPTIONS then this should have already been cdarried out otherwise you will have to do it programatocally. Second: - Code: Select all
LOOP AT it_lqua INTO wa_lqua WHERE lgnum = wa_lqua-lgnum.
This will not work. How can you provide a filter to a loop clause that is initially empty and then changing with each loop ? - Code: Select all
LOOP AT it_lqua INTO wa_lqua .
Will do the job.
-
Rich
-
- Posts: 6919
- Joined: Thu Oct 31, 2002 4:47 pm
- Location: Geneva
-
by YuriT » Wed Apr 04, 2012 8:16 pm
Like pointed out above by Gothmog and Rich, if you are sure your data actually exists, only thing left is types. Looking at your select statement, MATNR is the most likely suspect.
Try to do following. Create your select statement gradually increasing complexity and see when is it failing.
Start with select * from lqua, then add lgnum then remove it and add matnr, then add them together, try hard-coding matnr and lgnum. This will localize your problem if there ifs one.
-
YuriT
-
- Posts: 888
- Joined: Fri Feb 03, 2006 6:40 am
- Location: Basel/Riga
by Deeler Stan » Fri Apr 13, 2012 7:57 am
This may seem like a stupid thought, but:
The selection-screen code has not been included with the code extract, so:
Like others I am assuming S_LGNUM and S_MATNR are select options, but am basing this on the fact that they begin S_.
Has Alicealice used parameters rather than select-options, this would fail the select.
Stan
-
Deeler Stan
-
- Posts: 410
- Joined: Thu Mar 31, 2005 3:44 am
Return to ABAP
Who is online
Users browsing this forum: No registered users and 17 guests
|
|