Application Development and Automation 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: 
Read only

output error

Former Member
0 Likes
3,790

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,735

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

47 REPLIES 47
Read only

Former Member
0 Likes
3,736

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

Read only

0 Likes
254

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.

Read only

0 Likes
254

Why seperate conditions for 000040000200000001 ?

Just place one condition and write all the move statements inside it.

Read only

0 Likes
254

okay but for 000010000100000002 and all other i have to give individual move statements.

Read only

0 Likes
254

Please debug and find it out. Also check how IF / ELSEIF statement works.

Read only

0 Likes
254

Hi

just Try with 'commit work' statement.

Read only

0 Likes
254

in debugging mode everything is coming correct.

Read only

0 Likes
254

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

Read only

0 Likes
254

assign is not working here.

Read only

0 Likes
254

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.

Read only

0 Likes
254

Hi,

Use clear  <fs>-fkimg statement after every move statement.

It will clear all the temp data assigned to <fs>.

Regards,

Read only

0 Likes
254

it is clearing fkimg from the final display table also.

Read only

0 Likes
254

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.

Read only

0 Likes
254

after debugging final table in REUSE_ALV_GRID_DISPLAY,it is showing correct output but when it comes to display again op is incorrect.

Read only

0 Likes
254

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

Read only

0 Likes
254

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 ???

Read only

0 Likes
254

no this is simple an alv report.nothing related to module pol programming.

Read only

0 Likes
254

no this is simple an alv report.nothing related to module pol programming.

Read only

0 Likes
254

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.

.

Read only

0 Likes
254

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.

Read only

0 Likes
254

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'      ''.

Read only

0 Likes
254

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

Read only

0 Likes
254

thank you..

Read only

0 Likes
254

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

billnumbername of holderplacebillin quantityprod1prod2prod3prod4prod5prod6prod7prod8prod9prod10prod11prod12prod13prod14
19.08.201097502691RSBCL-Sold to Party TestJAIPUR3000000000000000300
19.08.201097502691RSBCL-Sold to Party TestJAIPUR3000000000000000300
Read only

0 Likes
254

Use DELETE ADJACENT DUPLICATES ENTRIES in your output table.

Read only

0 Likes
254

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.

datebillnumbername of holderplacebillin quantityq1q2q3q4q5q6q7q8q9q10q11q12q13q14

19.08.201097502691RSBCL-Sold to Party TestJAIPUR3000000000000000300
19.08.201097502691RSBCL-Sold to Party TestJAIPUR1000000000000000100

by using DELETE it will remove output 100 and i want it to come together as a sum.

Read only

0 Likes
254

Hi Ankan,

Use :

SUM.

{field need to be added}

*then

APPEND wa into itab. " or modify as per our requirement.

Regards

Manu Bhatnagar

Read only

0 Likes
254

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.

Read only

0 Likes
254

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

Read only

0 Likes
254

nothing is happening with this.

Read only

0 Likes
254

in debugging mode output is coming correct but in final display the old output is coming.

Read only

0 Likes
254

Can you post the code you have written using this approach.?

Read only

0 Likes
254

If your new internal table is populating correctly (in debugger), then check which table you are passing the the method for displaying ALV.

Read only

0 Likes
254

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.

Read only

0 Likes
254

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

Read only

0 Likes
254

hi

thanks for your solution but still output is coming incosistent.

Read only

0 Likes
254

HI Ankan,

Can you explain the inconsistency ?

What type of problem you are facing ?

Regards

ManuB

Read only

0 Likes
254

in final display the output is same as before.there is no change in the output.

Read only

0 Likes
254

can u post your complete code as attachment ?