09-26-2008 11:52 AM
Guruz,
my code:
SORT gt_output BY storeno.
LOOP AT gt_output.
AT NEW storeno.
***store branch number
PERFORM get_kna1 USING gt_output-storeno
CHANGING gv_adrnr.
ENDAT.
**storeno
gt_output-storeno = gv_sort2.
MODIFY gt_output.
CLEAR gt_output.
ENDLOOP.
..here im having same branch number in gt_output as iam modifying it within the loop its hitting at new again for the same branch..how can i overcome this?
pla advise..
thanks
09-26-2008 12:02 PM
Instead of at new use following logic.
clear gw_output. "work area for gt_output.
LOOP AT gt_output.
IF gw_output-storeno NE gt_output-storeno.
***store branch number
PERFORM get_kna1 USING gt_output-storeno
CHANGING gv_adrnr.
ENDIF.
clear gw_output.
READ gt_output into gw_output index sy-tabix.
gt_output-storeno = gv_sort2.
MODIFY gt_output.
CLEAR gt_output.
ENDLOOP.
09-26-2008 11:57 AM
Hello,
I need more information related formation of the internal table gs_output.
regards
suresh nair
Edited by: Suresh Krishnan on Sep 26, 2008 12:57 PM
09-26-2008 11:57 AM
Hi
One way is take help of a temp table
Data: L_TB_OUTPUT Like gt_output[]
Data: L_TABIX Type Sy-TABIX.
L_TB_OUTPUT[] = gt_output[]
SORT gt_output BY storeno.
LOOP AT L_TB_OUTPUT.
L_TABIX = Sy-TABIX.
AT NEW storeno.
***store branch number
PERFORM get_kna1 USING gt_output-storeno
CHANGING gv_adrnr.
ENDAT.
**storeno
Clear gt_output.
gt_output-storeno = gv_sort2.
MODIFY gt_output Index L_TABIX Transporting storeno.
CLEAR gt_output.
ENDLOOP.
santhosh
09-26-2008 12:02 PM
Instead of at new use following logic.
clear gw_output. "work area for gt_output.
LOOP AT gt_output.
IF gw_output-storeno NE gt_output-storeno.
***store branch number
PERFORM get_kna1 USING gt_output-storeno
CHANGING gv_adrnr.
ENDIF.
clear gw_output.
READ gt_output into gw_output index sy-tabix.
gt_output-storeno = gv_sort2.
MODIFY gt_output.
CLEAR gt_output.
ENDLOOP.
09-26-2008 12:05 PM
Hello,
Please try following code
SORT gt_output BY storeno.
LOOP AT gt_output.
AT NEW storeno.
***store branch number
PERFORM get_kna1 USING gt_output-storeno
CHANGING gv_adrnr.
ENDAT.
**storeno
gt_output-storeno = gv_sort2.
MODIFY gt_output.
SORT gt_output BY storeno.
CLEAR gt_output.
ENDLOOP.
-Raj
09-26-2008 12:21 PM
Hello
As you want to write the code At New Value of storeno, the internal table GT_OUTPUT should have storeno as first column in the structure. Then only your code will work.
Thanks
Amol Lohade