Application Development 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: 

AT NEW COMMAND

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

andreas_mann3
Active Contributor
0 Kudos

your itab must be sorted by field BELNR.

A.

Former Member
0 Kudos

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.

.

Former Member
0 Kudos

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

Former Member
0 Kudos

hi,

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