Skip to Content
author's profile photo Former Member
Former Member

help in the abap code

hi folks,

I am checking for various condition types through this code for various orders. Each order has a different set of condition records.

My requirement: when a order has a condition record for the condition type 'ZAGR' (AGREED PRICE) it should execute that block and ignore all the other condition types for that record and directly go to 'ZBET'to fetch the final amount

How to incorporate that piece code here?

The code goes like this...

loop at cdata into zcdata where

knumv = bodyitabtotal-knumv.

case zcdata-kschl.

when 'ZRAT' OR 'ZFLE' OR 'ZRCR' OR 'ZFIX'.

.

.

.

when 'ZAGR'.

.

.

.

when 'ZONT'.

concatenate zzkeyword zpofield

into CTEXT3

separated by space

MOVE zcdata-kbetr to w_accitab-zrate.

MOVE zcdata-kwert to w_accitab-zsubtotal.

.

.

.

when 'ZSMG'.

.

.

.

when 'ZBET'.

if zcdata-kbetr = ' ' AND zcdata-kwert = ' '.

MOVE ' ' TO w_accitab-zamount.

ELSE.

MOVE zcdata-kwert to w_accitab-zamount.

ENDIF.

when others.

continue.

endcase.

Thanks

Santhosh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2005 at 04:09 PM

    Hi

    First option:

    You prepare ne ITab and fill all the records with condition type ZBET. Read the itab in each condition type statements for the final amount.

    Second option:

    Set a flag to 'X' when ever condition record found. then execute the ZBET only when the flag is 'X'. startign of the case statement the flag will be clear for the order.

    so for every condition record add the check if flad is initial. so ass soon as it encounters the first condition record...the next is ZBET is executed.

    Hope this helps

    Thanks

    Balu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2005 at 04:27 PM

    Hi

    so your reqirement is:

    you have orders with multiple condition records. When you program loop encounters the ZAGR condition it should only process that condtion for the order and exit from the loop and proceed with other order....and what ever condition records exceuted prior to ZAGR they will stay..

    When ZAGR is executed.. ZBET shouldnot be executed...ZBET should execute only for other condition types..is this your requirement??

    I need more clarity on your requirement.

    Thanks

    Balu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2005 at 04:33 PM

    hi

    Further to previous reply.. you can set a flag in ZAGR to 'X' and check that in ZBET if the flag is initial then process other wise donot process.

    Clear the flag at new order.

    This will work

    Thanks

    Balu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2005 at 08:54 PM

    Hi,

    Sort the ITab with KNUMV and KSCHL... this case the ZAGR excutes first....if no other condition rec starts with ZA..

    this is may not be right solution but according to your condition records...this should work....

    Thanks

    balu

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.