‎2012 May 21 8:44 AM
i am making a sales report and 8 of my feilds are displaying correct.and rest all are coming correct in debugging mode but when i am executing it,rest fields are copying the values of last feild irrespective of the input.please tell me how to correct it.
‎2012 May 21 9:33 AM
Hi
clear the work area after appending into internal table.
if you want more info reg to this copy the code after analyzing i can say wt the error
Regards
Mahesh
‎2012 May 21 9:33 AM
Hi
clear the work area after appending into internal table.
if you want more info reg to this copy the code after analyzing i can say wt the error
Regards
Mahesh
‎2012 May 21 10:03 AM
firstly in final table i have displayed all the feilds then i make a feild symbol fs like that of final table.now based on the product heirarchy i want to send the value of billing quantity to respective places.
if <fs>-prodh = '000010000100000002'.
move <fs>-fkimg to <fs>-a.
elseif <fs>-prodh = '000010000100000004'.
move <fs>-fkimg to <fs>-b.
elseif <fs>-prodh = '000010000100000005'.
move <fs>-fkimg to <fs>-c.
elseif <fs>-prodh = '000040000200000001'.
move <fs>-fkimg to <fs>-d.
elseif <fs>-prodh = '000040000200000001'.
move <fs>-fkimg to <fs>-e.
elseif <fs>-prodh = '000040000200000001'.
move <fs>-fkimg to <fs>-f.
elseif <fs>-prodh = '000040000200000001'.
move <fs>-fkimg to <fs>-g.
elseif <fs>-prodh = '000040000200000001'.
move <fs>-fkimg to <fs>-h.
elseif <fs>-prodh = '000040000200000001'.
move <fs>-fkimg to <fs>-i.
elseif <fs>-prodh = '000360000100000001'.
move <fs>-fkimg to <fs>-j.
elseif <fs>-prodh = '000360000100000002'.
move <fs>-fkimg to <fs>-k.
elseif <fs>-prodh = '000360000100000003'.
move <fs>-fkimg to <fs>-l.
else.
move <fs>-fkimg to <fs>-m.
endif.
‎2012 May 21 10:06 AM
Why seperate conditions for 000040000200000001 ?
Just place one condition and write all the move statements inside it.
‎2012 May 21 10:12 AM
okay but for 000010000100000002 and all other i have to give individual move statements.
‎2012 May 21 10:16 AM
Please debug and find it out. Also check how IF / ELSEIF statement works.
‎2012 May 21 10:18 AM
‎2012 May 21 10:22 AM
‎2012 May 21 10:47 AM
hi
in the place of move keyword use the Assigning keyword like below example
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb387a358411d1829f0000e829fbfe/content.htm
‎2012 May 21 10:55 AM
‎2012 May 21 11:34 AM
I guess the above conditions you have mentioned is in loop and also you have assigned the table rows to the field symbol (LOOP AT lt_final ASSIGNING <fs>.).
Looking at your case, it seems you have missed the above LOOP part( you have not assigned the table row to the field symbol).
Also, please use CASE ENDCASE. for the all above mentioned conditions instead of a IF ELSEIF.
‎2012 May 21 11:40 AM
Hi,
Use clear <fs>-fkimg statement after every move statement.
It will clear all the temp data assigned to <fs>.
Regards,
‎2012 May 21 11:50 AM
it is clearing fkimg from the final display table also.
‎2012 May 22 8:18 AM
Hi Ankan,
IF it is the ALV output then you must check output table values just before the FM REUSE_ALV_GRID_DISPLAY.
There should be some logic clearing those fields before the actual ALV display, please use watchpoint on one of the fields for easy identification.
Please confirm the same, it would be difficult to tell the reason without actually looking at the code.
‎2012 May 22 8:47 AM
after debugging final table in REUSE_ALV_GRID_DISPLAY,it is showing correct output but when it comes to display again op is incorrect.
‎2012 May 23 7:40 AM
this is my final arrangement of data.at debugging mode,everything is coming correct but at the tym of display,values from prod1 to prod13 is copying the last column feild. plz help where i am wrong.
select a~fkdat a~vkorg a~spart a~vtweg a~kunag a~vbeln a~zuonr b~werks b~kondm b~matnr b~fkimg b~vgbel b~prodh b~arktx d~tknum e~tknum e~exti1 e~exti2
into corresponding fields of table gt_final
from vbrp as b inner join
vbrk as a on a~vbeln = b~vbeln
inner join likp as c on a~zuonr = c~vbeln
inner join vttp as d on d~vbeln = c~vbeln
inner join vttk as e on e~tknum = d~tknum
where a~fkdat in s_datum
and a~vkorg in s_vkorg
and regio in s_regi
and a~spart in s_spart
and a~vtweg in s_vtweg
and a~kunag in s_kunag
and b~werks in s_werks
and b~kondm in s_kondm
and b~matnr in s_matnr.
unassign <fs>.
loop at gt_final assigning <fs>.
case <fs>-prodh.
when '000010000100000002'.
<fs>-prod1 = <fs>-fkimg.
when '000010000100000004'.
move <fs>-fkimg to <fs>-prod2.
when '000010000100000005'.
move <fs>-fkimg to <fs>-prod3.
when '000040000200000001'.
move <fs>-fkimg to <fs>-prod4.
when '000040000200000001'.
move <fs>-fkimg to <fs>-prod5.
when '000040000200000001'.
move <fs>-fkimg to <fs>-prod6.
when '000040000200000001'.
move <fs>-fkimg to <fs>-prod7.
when '000040000200000001'.
move <fs>-fkimg to <fs>-prod8.
when '000040000200000001'.
move <fs>-fkimg to <fs>-prod9.
when '000360000100000001'.
move <fs>-fkimg to <fs>-prod10.
when '000360000100000002'.
move <fs>-fkimg to <fs>-prod11.
when '000360000100000003'.
move <fs>-fkimg to <fs>-prod12.
when others.
move <fs>-fkimg to <fs>-prod13.
endcase.
endloop.
unassign <fs>.
loop at gt_final assigning <fs>.
select single name1 ort01 from kna1 into
(<fs>-name1, <fs>-ort01)
where kunnr = <fs>-kunag.
endloop.
endform. " arrange_data
‎2012 May 23 8:02 AM
Are you trying this out in module pool program and does your program has a screen with a table control in where your contents has to be displayed ???
‎2012 May 23 8:11 AM
no this is simple an alv report.nothing related to module pol programming.
‎2012 May 23 8:11 AM
no this is simple an alv report.nothing related to module pol programming.
‎2012 May 23 12:15 PM
Dear Ankan,
In loop statement when new case <fs>-prodh found, it will clear previous value stored in <fs>. That's why only for last <fs>-prodh value stores in <fs>.
To get all values assigned to <fs> during the loop you need to append or Modify <fs> to an internal table before endloop statement.
Regards,
Ravi Singh.
.
‎2012 May 23 12:24 PM
Hi Ankan,
There doesn't seems a problem with the code, please check your field catalog.
As Manu Bhatnagar was pointing out, you might have assigned the same field name to all prod* fields in the field catalog.
One more thing, avoid using corresponding fields of , if the fields mentioned in the select are the fields in sequence from the left (it means that in the structure of the table if the fields are at start and in sequence mentioned in select) then you can remove corresponding fields of.
Even you can combine both the loops, avoid writing a select within a loop, and in CASE only 5 WHEN conditions would come.
‎2012 May 23 12:30 PM
i have given different name to all prod*
i have pasted my feild catalog so that you can see.
'GT_FINAL' '25' 'DATE' 'FKDAT' '',
'GT_FINAL' '25' 'BILL NUMBER' 'VBELN' '',
'GT_FINAL' '25' 'TRANSPORT' 'TKNUM' '',
'GT_FINAL' '25' 'TRUCK NUMBER' 'EXTI1' '',
'GT_FINAL' '25' 'G.R.NUMBER' 'EXTI2' '',
'GT_FINAL' '25' 'NAME OF LICENCEE' 'NAME1' '',
'GT_FINAL' '25' 'PLACE' 'ORT01' '',
'GT_FINAL' '25' 'BILLING QUANTITY' 'FKIMG' '',
'GT_FINAL' '25' '8 PM WHISKY 750ML' 'prod1' '',
'GT_FINAL' '25' '8 PM WHISKY 375ML' 'prod2' '',
'GT_FINAL' '25' '8 PM WHISKY 180ML' 'prod3' '',
'GT_FINAL' '25' 'M2 VODKA COOL BLUE 750ML' 'prod4' '',
'GT_FINAL' '25' 'M2 VODKA COOL BLUE 375ML' 'prod5' '',
'GT_FINAL' '25' 'M2 VODKA COOL BLUE 180ML' 'prod6' '',
'GT_FINAL' '25' 'M2 REMIX LE/G A/ OR 750ML' 'prod7' '',
'GT_FINAL' '25' 'M2 REMIX LE/G A/ OR 375ML' 'prod8' '',
'GT_FINAL' '25' 'M2 REMIX LE/G A/ OR 180ML' 'prod9' '',
'GT_FINAL' '25' 'AFTER DARK 750ML' 'prod10' '',
'GT_FINAL' '25' 'AFTER DARK 375ML' 'prod11' '',
'GT_FINAL' '25' 'AFTER DARK 180ML' 'prod12' '',
'GT_FINAL' '25' 'OTHERS' 'prod13' ''.
‎2012 May 24 2:25 AM
That's it! Make your fieldcatalog-fieldname capital.
Try:
'GT_FINAL' '25' '8 PM WHISKY 750ML' 'PROD1' '',
'GT_FINAL' '25' '8 PM WHISKY 750ML' 'PROD2' '',
'GT_FINAL' '25' '8 PM WHISKY 750ML' 'PROD3' '',
'GT_FINAL' '25' '8 PM WHISKY 750ML' 'PROD4' '',
......... and so on so forth..
Regards,
Jake
‎2012 May 24 5:58 AM
‎2012 May 25 9:04 AM
hello
plz help me again.this is the snapshot of my output.the code was if billing quantity matches to prod1 on the basis of product heirarchy then the quantity will goto prod1 else upto prod14.now what i want is one billnumber should come in one line.like here it is coming in two lines.i want it to be in one line and rest information should follow this.how to do this.plz help.
date | billnumber | name of holder | place | billin quantity | prod1 | prod2 | prod3 | prod4 | prod5 | prod6 | prod7 | prod8 | prod9 | prod10 | prod11 | prod12 | prod13 | prod14 |
| 19.08.2010 | 97502691 | RSBCL-Sold to Party Test | JAIPUR | 300 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 300 |
| 19.08.2010 | 97502691 | RSBCL-Sold to Party Test | JAIPUR | 300 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 300 |
‎2012 May 25 9:11 AM
Use DELETE ADJACENT DUPLICATES ENTRIES in your output table.
‎2012 May 25 9:55 AM
i have used that but it will make my op inconsistent.as it will remove my last line but i want both the ouput to be merged.
| date | billnumber | name of holder | place | billin quantity | q1 | q2 | q3 | q4 | q5 | q6 | q7 | q8 | q9 | q10 | q11 | q12 | q13 | q14 |
| 19.08.2010 | 97502691 | RSBCL-Sold to Party Test | JAIPUR | 300 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 300 |
| 19.08.2010 | 97502691 | RSBCL-Sold to Party Test | JAIPUR | 100 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 100 |
by using DELETE it will remove output 100 and i want it to come together as a sum.
‎2012 May 25 12:16 PM
Hi Ankan,
Use :
SUM.
{field need to be added}
*then
APPEND wa into itab. " or modify as per our requirement.
Regards
Manu Bhatnagar
‎2012 May 28 7:32 AM
no i dont want like this.i want that same bill number with different product values should lie in one line and billing quantity then will be the sum of all the product quantities.
‎2012 May 28 7:44 AM
Hi Ankan,
Try this.
* declare a new internal table of same type and new werkarea.
loop at gt_final into wa.
at new vbeln.
move corresponding wa to wa_temp.
sum.
* Fields to be added i.e.
wa_temp-q1 = wa-q1. " and so on.
append wa_temp to gt_final_new.
endat.
endloop.
Regards,
Manu
‎2012 May 28 10:31 AM
‎2012 May 28 10:39 AM
in debugging mode output is coming correct but in final display the old output is coming.
‎2012 May 28 10:44 AM
Can you post the code you have written using this approach.?
‎2012 May 28 10:47 AM
If your new internal table is populating correctly (in debugger), then check which table you are passing the the method for displaying ALV.
‎2012 May 28 10:49 AM
loop at gt_final.
at new vbeln.
move-corresponding gt_final to gt_temp.
sum .
gt_temp-prod1 = gt_final-prod1.
gt_temp-prod2 = gt_final-prod2.
gt_temp-prod3 = gt_final-prod3.
gt_temp-prod4 = gt_final-prod4.
gt_temp-prod5 = gt_final-prod5.
gt_temp-prod6 = gt_final-prod6.
gt_temp-prod7 = gt_final-prod7.
gt_temp-prod8 = gt_final-prod8.
gt_temp-prod9 = gt_final-prod9.
gt_temp-prod10 = gt_final-prod10.
gt_temp-prod11 = gt_final-prod11.
gt_temp-prod12 = gt_final-prod12.
gt_temp-prod13 = gt_final-prod13.
gt_temp-prod14 = gt_final-prod14.
append gt_temp.
endat.
endloop.
‎2012 May 28 10:56 AM
make sure that VBELN is the first field of your internal table. As per your Field Catlog, date is first field.
Move VBELN to the first position. This is typical problem with 'AT' events, they consider the sequence of internal table. Even if VBELN is same but date is different, AT NEW will trigger.
The field you need to check for NEW should be first (or previous field should contains same values.)
i.e.
BUKRS VBLEN DATE
US11 12345 01.01.01
US11 12345 01.01.01
US11 54213 01.01.01
US11 54213 01.01.01
‎2012 May 31 6:42 AM
hi
thanks for your solution but still output is coming incosistent.
‎2012 May 31 6:49 AM
HI Ankan,
Can you explain the inconsistency ?
What type of problem you are facing ?
Regards
ManuB
‎2012 May 31 6:56 AM
in final display the output is same as before.there is no change in the output.
‎2012 May 31 7:00 AM