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

AT NEW COMMAND

Former Member
0 Likes
643

hi all,

i have problem with AT NEW COMMAND.

IF THE BELNR IS DIFFERENT THEN IT SHOULD goto prps-post1 and pass post1 to

gt_line_item-postl, if the same belnr repeats 2 times varaible.

at new command is not working

please see my code as below.

gt_line_item-BELNR = bseg-belnr.

at new belnr.

gt_line_item-post1 = prps-post1.

endat.

gt_line_item-name1 = gt_lfa1-name1.

please help me if the belnr is same as previoue belnr it should not goto post1 filed,

5 REPLIES 5
Read only

Former Member
0 Likes
589

Hello hemal latha,

At new commnad will work only in Loop and Endloop.

It will not work in IF conditions

Example.

Loop at gt_line_item.

at new belnr.

Write u r logic.

endat.

endloop.

Read only

andreas_mann3
Active Contributor
0 Likes
589

your itab must be sorted by field BELNR.

A.

Read only

Former Member
0 Likes
589

Hi,

First store first belnr in other table or field then compare the current belnr with the previous.If the entries in the second table is available then continue.

.

Read only

Former Member
0 Likes
589

Hi,

Please go for the following code. It may solve your problem.

gt_line_item-BELNR = bseg-belnr.

Loop at gt_line_item.

at new belnr.

gt_line_item-post1 = prps-post1.

endat.

ENDLOOP.

gt_line_item-name1 = gt_lfa1-name1.

Thanks.

Nitesh

Read only

Former Member
0 Likes
589

hi,

you can use 'on change of' statement to apply this requirement.