Skip to Content
avatar image
Former Member

AT NEW COMMAND

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,

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Oct 20, 2008 at 10:53 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 20, 2008 at 10:53 AM

    your itab must be sorted by field BELNR.

    A.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 20, 2008 at 10:55 AM

    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.

    .

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 20, 2008 at 11:01 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 20, 2008 at 11:01 AM

    hi,

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

    Add comment
    10|10000 characters needed characters exceeded