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

BAPI Issue!

Hi!

In BAPI what is that IF 1 = 2 concept.

Can u pls explain.

I give an eg.

SELECT SINGLE aufnr

FROM afko

INTO l_aufnr

WHERE aufnr = BAPI_ORDER_STATUS_IMPORT-orderid.

IF sy-subrc NE 0.

CLEAR message.

message-msgty = 'E'.

message-msgid = 'Z3'.

message-msgno = '000'.

message-msgv1 = BAPI_ORDER_STATUS_IMPORT-orderid.

PERFORM set_return_message USING message

CHANGING return.

IF 1 = 2.

  • The only reason to include this statement, that will obviously

  • never execute, is that it will create a referecence so that you

  • can find out where a particular message is being used. This

  • functionality is used by the BAPIs programmed by SAP

MESSAGE e000(z3).

ENDIF.

ENDIF.

CHECK return IS INITIAL.

.................................

................

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 03, 2007 at 06:20 AM

    If 1=2 will never execute.

    This is treated similar to commented code and can be used in future.

    Kartavya

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 03, 2007 at 07:26 AM

    Actually BAPI will throw an error in Number and Msg Type and by using FM like Format_message, we format the message. So the message which u retrieve from the format_message by supplying msg number and msg type to the FM, that particular message is saved within Z3.

    Hence, this is just for reference.

    I hope u got my point.

    Reward if u find it useful.

    Kartavya

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 03, 2007 at 08:24 AM

    Hi Rahul,

    This an intresting way to comment a peice of code.Instead of commenting a large peice of code , it is a good way that this peice of code is never executed.

    there is no other meaning other than this . Reward if it helped .

    Thanks,

    Anoop

    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.