2010 Mar 10 12:46 PM
Dear Friends,
Does IF and Elseif statement work in validation?
The requirement is if first line item contains business area "ABC", the second line item should also contain "ABC".
If the document type is ZA or ZB, first line item should be 'ABC, second line item can be DEF.
Please suggest.
All the help will be greatly appreciated.
Regards
Sridhar
2010 Mar 11 5:58 AM
hi Sridahr,
According to me If elseif endif block will definetly work in validation block...
you can try like this
if wa_firstlineitem EQ 'ABC'.
wa_secondlineitem = 'ABC'.
elseif wa_document_type EQ 'ZA' or wa_document_type EQ 'ZB'.
wa_firstlineitem = 'ABC'.
endif."as second line item can be anything so no need to write its value in wa.
append wa to itab.
hope this will help you,can u please be move clear whats your exact requirement is so that i can help you out in a better way.
Thanks
Tanmaya
Dear Friends,
Does IF and Elseif statement work in validation?
The requirement is if first line item contains business area "ABC", the second line item should also contain "ABC".
If the document type is ZA or ZB, first line item should be 'ABC, second line item can be DEF.
Please suggest.
All the help will be greatly appreciated.
Regards
Sridhar
2010 Mar 10 1:02 PM
2010 Mar 11 5:26 AM
Hi Keshav ,
Data is present in internal table.
You have given very little information .
Please explain how to use if and end if in valiation.
I got very little information while searching in google.
All the help will be greatly appreciated.
Regards
Sridhar
2010 Mar 11 5:36 AM
Hi,
Instead of google, Clicking F1 on the word IF in your ABAP code editor would give you more information. Below is the basic syntax.
IF (source variable) <Logical expression> (Target variable/constant/space).
ELSEIF.....
ENDIF.
Thanks,
Vinod.
2010 Mar 11 5:39 AM
Hi,
>
> The requirement is if first line item contains business area "ABC", the second line item should also contain "ABC".
loop it.
if sy-tabix ne 1.
if local variable = 'ABC' and it-busnessarea = 'ABC'.
*If condition passed then it means second item also contians ABC.
endif.
endif.
>If the document type is ZA or ZB, first line item should be 'ABC, second line item can be DEF.
**Consediring IT has item no as well
if it-itmno = 1 and ( it-docno = 'ZA' or it-docno = 'ZB' ) and it-busnessarea = 'ABC'.
*If condition passed then it means first item also contians ABC.
endif.
*Moving First item to local variable inorder to chec for next time.
move it-busnessarea to local variable.
endloop.
Can you provide me the strucure of Internal table. It will be easy to explian.
2010 Mar 11 5:41 AM
Hello Sridhar,
Are you talking about FI Validations ?
BR,
Suhas
2010 Mar 11 5:44 AM
2010 Mar 11 5:56 AM
Hello Sridhar,
You should mention this in your subject line, else you will get crappy responses
Anyways back to your question, what makes you think you cannot use IF ... ELESIF condition in your validation.
For this you have to create an exit in your validation & put your ABAP code there.
BR,
Suhas
2010 Mar 11 5:53 AM
You can do like this i give simple logic in simple english u convert into abap syntex
loop at itab where business are = 'abc'
FIND FIRST OCCURRENCES document type = za or document type = zb
if sy-subtc = 0.
continue.
else.
replace business are = 'ABC' into itab-business are with 'DEF'
MODIFY itab INDEX sy-tabix .
endif.
Edited by: kk.adhvaryu on Mar 11, 2010 6:54 AM
2010 Mar 11 5:58 AM
hi Sridahr,
According to me If elseif endif block will definetly work in validation block...
you can try like this
if wa_firstlineitem EQ 'ABC'.
wa_secondlineitem = 'ABC'.
elseif wa_document_type EQ 'ZA' or wa_document_type EQ 'ZB'.
wa_firstlineitem = 'ABC'.
endif."as second line item can be anything so no need to write its value in wa.
append wa to itab.
hope this will help you,can u please be move clear whats your exact requirement is so that i can help you out in a better way.
Thanks
Tanmaya
2010 Jun 22 8:37 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |