2012 Aug 04 9:05 AM
Dear all;
I am having an issue with the output for my code.
what i want to see as an output the Delivery Quantity and Order Quantity (lips-lfimg and vbap-kwmeng) after the user selects the Reference document (lips-vgbel)
when i run the code i get empty output
please can you tell me what is the mistake i am doing in my code.
===================================================================================
REPORT ZDEMO_SELECTION_SCREEN.
DATA: VGBEL TYPE LIPS-VGBEL,
BEGIN OF wa,
KWMENG TYPE VBAP-kwmeng,
LFIMG TYPE LIPS-LFIMG,
END OF wa,
itab LIKE SORTED TABLE OF wa WITH NON-UNIQUE KEY LFIMG KWMENG.
SELECT-OPTIONS: S_VGBEL FOR VGBEL.
SELECT f~LFIMG q~kwmeng INTO CORRESPONDING FIELDS OF TABLE itab
FROM VBAP AS q LEFT OUTER JOIN LIPS AS f ON f~vgbel = q~vbeln AND f~VGPOS = q~POSNR.
WRITE: /10 'Delivery Quantity', 40 'Order Quantity'.
AT SELECTION-SCREEN OUTPUT.
LOOP AT itab INTO wa.
WRITE: /10 wa-LFIMG, 40 wa-KWMENG.
ENDLOOP.
========================================================================================
2012 Aug 04 9:14 AM
hi madam,
can u comment this line & write like this?
*AT SELECTION-SCREEN OUTPUT.
LOOP AT itab INTO wa.
WRITE: /10 wa-LFIMG, 40 wa-KWMENG.
ENDLOOP.
let me know output is coming or not.
gourav.
Dear all;
I am having an issue with the output for my code.
what i want to see as an output the Delivery Quantity and Order Quantity (lips-lfimg and vbap-kwmeng) after the user selects the Reference document (lips-vgbel)
when i run the code i get empty output
please can you tell me what is the mistake i am doing in my code.
===================================================================================
REPORT ZDEMO_SELECTION_SCREEN.
DATA: VGBEL TYPE LIPS-VGBEL,
BEGIN OF wa,
KWMENG TYPE VBAP-kwmeng,
LFIMG TYPE LIPS-LFIMG,
END OF wa,
itab LIKE SORTED TABLE OF wa WITH NON-UNIQUE KEY LFIMG KWMENG.
SELECT-OPTIONS: S_VGBEL FOR VGBEL.
SELECT f~LFIMG q~kwmeng INTO CORRESPONDING FIELDS OF TABLE itab
FROM VBAP AS q LEFT OUTER JOIN LIPS AS f ON f~vgbel = q~vbeln AND f~VGPOS = q~POSNR.
WRITE: /10 'Delivery Quantity', 40 'Order Quantity'.
AT SELECTION-SCREEN OUTPUT.
LOOP AT itab INTO wa.
WRITE: /10 wa-LFIMG, 40 wa-KWMENG.
ENDLOOP.
========================================================================================
2012 Aug 04 9:14 AM
hi madam,
can u comment this line & write like this?
*AT SELECTION-SCREEN OUTPUT.
LOOP AT itab INTO wa.
WRITE: /10 wa-LFIMG, 40 wa-KWMENG.
ENDLOOP.
let me know output is coming or not.
gourav.
2012 Aug 04 9:21 AM
Dear gourav;
I comment the AT SELECTION-SCREEN OUTPUT as you recommended. i am getting now an output but the values are wrong. now it is giving me the delivery quantity, and the order quantity the same value as you can see in the following image:
how can i get the correct output?
2012 Aug 04 9:30 AM
I think the issue i am having is that the output is not connected to the selction input.
what i need as anoutput is only the Delivery Quantity and Order Quantity that corresponds to the sales document
Best Regards
~Amal
2012 Aug 04 9:44 AM
Yes How Can you get output connected to your selection input. As you have not passed S_VGBEL to anywhere. Have you consider checking that? Kindly Debug your select query you will get your answers.
2012 Aug 04 9:52 AM
Dear Mehta;
I will check the debugger, but can you tell me how can i connect the selection input to the output.
2012 Aug 04 9:52 AM
try like this
SELECT kwmeng INTO table wa FROM vbap
WHERE vgbel in s_vgbel.
SELECT lfimg INTO table wa2 FROM lips"declare another internal table
for all entries in wa
WHERE vgbel in s_vgbel .
then read table .
instead of join use for all entries .it is good.
2012 Aug 04 12:42 PM
Dear Kumar;
is this is how it should be?
REPORT ZDEMO_SELECTION_SCREEN.
DATA: VGBEL TYPE LIPS-VGBEL.
TYPES: BEGIN OF wa,
KWMENG TYPE VBAP-kwmeng OCCURS 0,
END OF wa.
TYPES: BEGIN OF wa2,
LFIMG TYPE LIPS-LFIMG occurs 0,
END OF wa2.
SELECT-OPTIONS: S_VGBEL FOR VGBEL.
SELECT kwmeng INTO table wa FROM vbap for all entries in wa WHERE vgbel in s_vgbel.
SELECT lfimg INTO TABLE wa2 FROM lips FOR ALL ENTRIES IN wa2 WHERE vgbel in s_vgbel.
WRITE: /10 'Delivery Quantity', 40 'Order Quantity'.
LOOP AT itab INTO wa.
WRITE 10 wa-KWMENG.
ENDLOOP.
LOOP AT itab INTO wa2.
WRITE 40 wa1-LFIMG.
ENDLOOP.
2012 Aug 04 1:18 PM
Hi madam,
forget this report,
some simple thing i want to tell you now before this,
always go for some coding standard like now i am writing one small report here & explaning you the whole process,
1)imagine report name is zdemo,
2)vbap is master table & lips is secondary table,
3)there will be some common primary key field or selection screen field,
at first declare internal table
tables : vbap,lips. "useful to write all table name used in program.
types: begin of ty_vbap,
vbeln type vbap-vbeln,
kwmeng type kwmeng,"refer to data element directly is good practice
vgbel type vgbel,
end of ty_vbap.
types: begin of ty_lips,
vbeln type lips-vbeln,
lfimg type lfimg"refer to data element directly is good practice
vgbel type vgbel, " i forget the sequence but try to declare sequentially from table
end of ty_vbap.
types : begin of ty_final,"table for final o/p display
kwmeng type kwmeng,"maintain sequence
lfimg type lfimg,
end of..............
data: it_vbap type table of ty_vbap,"internal table
wa_vbap type ty_vbap,"work area
like this declare the others.
then selection screen
select-options: s_vb for vbap-vbveln,
s_vg for vbap-vgbel.
now select
select vbeln kwmeng from vbap into table it_vbap "into table is keyword
where vbeln in s_vb
vgbel in s_vg.
now come to for all entries it is better than inner or other join for good perormance
so see here
select vbeln lfimg vgbel into table it_lips
for all entries in it_vbap "comparing with it_vbap like join
where vbeln in s_vb
and vgbel in s_vg.
here selection screen matching but sometimes not matching then for all entries is best
>>>>>
loop will on master table here &
now read table from table to work area & displying the data in final tbale
loop at it_vbap into wa_vbap.
wa_final-kwmeng = wa_vbap-kwmeng.
read table it_lips into wa_lips with key vbeln = s_vbeln vgbel = s_vgbel " with key for simple tbale
wa_final-lfimg = wa_lips-kwmeng.
endloop.
>>>>>
1) do not use occurs , inner join it is costly & time consuming
AT LAST write Your write statement for values or you can write in alv also this report.
ALL the best for next report.
any confusion u can tell me.
Gourav.
2012 Aug 05 8:54 AM
Hello Kumar;
I know i am asking too many question but i need your help in checking the error i am facing.
I followed your recomendation and i replaced the join with the slect statement.
I am getting an error in my second select statement: the wehere condition does not refer to the for all entries table.
please help me in this error.
===================================================================
TABLES: VBAP, LIPS.
types: begin of ty_vbap,
vbeln type vbap-vbeln,
kwmeng type kwmeng,"refer to data element directly is good practice
vgbel type vgbel,
end of ty_vbap.
types: begin of ty_lips,
vbeln type lips-vbeln,
lfimg type lfimg,
vgbel type vgbel,
end of ty_lips.
types: begin of ty_final,
kwmeng type kwmeng,
lfimg type lfimg,
end of ty_final.
data: it_vbap type table of ty_vbap,
wa_vbap type ty_vbap.
data: it_lips type table of ty_lips,
wa_lips type ty_lips.
data: it_final type table of ty_final,
wa_final type ty_final.
select-options: s_vb for vbap-vbeln,
s_vg for vbap-vgbel.
select vbeln kwmeng vgbel from vbap into table it_vbap
where vbeln in s_vb AND vgbel in s_vg.
select vbeln lfimg vgbel into table it_lips from lips
FOR ALL ENTRIES IN it_vbap
where vbeln in s_vb
and vgbel in s_vg.
loop at it_vbap into wa_vbap.
wa_final-kwmeng = wa_vbap-kwmeng.
read table it_lips into wa_lips with key vbeln = s_vbeln vgbel = s_vgbel
endloop.
write: /10 wa_final-lfimg, 40 wa_final-kwmeng.
========================================================================
2012 Aug 05 10:07 AM
Hi ,
Few things i am telling now,
in that example i write for all entries for just example here it is not needed.
1)that if u delete for all entries your error will gone,
2)after with key use vbeln = s_vb & vgbel = s_vg.
3) after read table ,write wa_final-lfimg = wa_lips-lfimg.
4)put . after read table.
reason is for all entries is use for where instead of selection screen some common fields comparison u need. for your clarification i am attaching one real time scenario in mm module .read it.
Real time scenario in SAP MM report
SELECT ebeln bsart ekgrp bedat FROM ekko INTO TABLE it_ekko
WHERE ( bsart = 'Z1NB' or bsart = 'Z2NB')
AND ekgrp in s_ekgrp
AND ( bedat IN s_bedat OR bedat GE LV_DATE_LOW OR bedat LE LV_DATE_HIGH ).
SELECT ebeln ebelp werks netwr knttp mwskz FROM ekpo INTO TABLE it_ekpo
FOR ALL ENTRIES IN it_ekko
WHERE ebeln eq it_ekko-ebeln "here ebeln in ekko need comparison
AND werks In s_werks
AND knttp in s_knttp.
>>>>
For all entries need where instead of selection screen fields we need some common fields comparison,like here
ebeln is common, but not present in selection screen.
>>>
lastly your proper output will come if u give proper input in selection screen like
from se11 u have to find out the proper matching input & data have to present in table for that.
gourav.
2012 Aug 05 11:23 AM
Thank you gourav;
the code you explained to me very very helpful.
========================================================================
*&---------------------------------------------------------------------*
*& Report ZDEMO_SELECTION_SCREEN5
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZDEMO_SELECTION_SCREEN5.
TABLES: VBAP, LIPS.
types: begin of ty_vbap,
vbeln type vbap-vbeln,
kwmeng type kwmeng,"refer to data element directly is good practice
vgbel type vgbel,
end of ty_vbap.
types: begin of ty_lips,
vbeln type lips-vbeln,
lfimg type lfimg,
vgbel type vgbel,
end of ty_lips.
types: begin of ty_final,
kwmeng type kwmeng,
lfimg type lfimg,
end of ty_final.
data: it_vbap type table of ty_vbap,
wa_vbap type ty_vbap.
data: it_lips type table of ty_lips,
wa_lips type ty_lips.
data: it_final type table of ty_final,
wa_final type ty_final.
select-options: s_vb for vbap-vbeln,
s_vg for vbap-vgbel.
select vbeln kwmeng vgbel from vbap into table it_vbap
where vbeln in s_vb AND vgbel in s_vg.
select vbeln lfimg vgbel into table it_lips from lips
where vbeln in s_vb
and vgbel in s_vg.
loop at it_vbap into wa_vbap.
wa_final-kwmeng = wa_vbap-kwmeng.
read table it_lips into wa_lips with key vbeln = s_vb vgbel = s_vg.
wa_final-lfimg = wa_lips-lfimg.
endloop.
write: /10 wa_final-lfimg, 40 wa_final-kwmeng.
========================================================================
2012 Aug 04 9:16 AM
Hi
1.check the value are present or not in SE11 ans also check it is partialy active or fully active
2. Through debugging you can retrieve the error are transferring of values through F5
2012 Aug 04 2:05 PM
occurs !!! you should not use,,, missing coding standards!..
2012 Aug 04 2:14 PM
occurs 0 !!!!
there are many like this.
select endselect,
into corresponding fields of table ,
but sometimes occurs 0 have to use..
2012 Aug 04 2:47 PM
2012 Aug 04 2:50 PM
yes surya,
in new version of abap occurs 0 obsolete,types declaration is new way to declare. but there are rare case have to use occurs 0. as per my little knowledge.
2012 Aug 04 2:53 PM
hmm.. yeah.. i am working with 4.5b, all the code is written with occurs 0, have nothing to do.. agreed
2012 Aug 04 2:54 PM
yes u r right in 4.5 but i am working in ecc 6.0 where this keyword is obsolete.
2012 Aug 04 2:58 PM
2012 Aug 04 3:01 PM
2012 Aug 04 3:02 PM
2012 Aug 04 3:03 PM
2012 Aug 04 3:06 PM
2012 Aug 04 8:44 PM
Please do not ask for mail addresses, all exchange of knowledge (whether obsolete or not) should be public.
Thomas
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |