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: 

Checking NULL value

Former Member
0 Kudos

Hello to ABAP Gurus

First of all I am zero in ABAP hence please ingnore my lack of knowledge.

Question is that I have written an ABAP routine in transfer rule where I am pulling data from R/3 system into my info objects.

What I would like to do here is that if the date is NULL "Not present at source", I would like to assign the default date to my info object.

My small piece of code looks like below

If TRAN_STRUCTURE-birthdt = ' '.

RESULT = '01/01/9999'.

else.

RESULT = TRAN_STRUCTURE-birthdt.

endif.

Please let me have your expert advice.

Many thanks in Advance.

Regards,

Bobby

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Try the following code.

<b>IF NOT </b> TRAN_STRUCTURE-birthdt <b>IS INITIAL.</b>

RESULT = TRAN_STRUCTURE-birthdt.

else.

RESULT = '01/01/9999'.

endif.

5 REPLIES 5

Former Member
0 Kudos

Try the following code.

<b>IF NOT </b> TRAN_STRUCTURE-birthdt <b>IS INITIAL.</b>

RESULT = TRAN_STRUCTURE-birthdt.

else.

RESULT = '01/01/9999'.

endif.

0 Kudos

Hi Sarvan,

Fantastic answer and thanks you very much.

My next issue here is that I have extracted date from R/3 structure from 0BPARTNER where the birthdate is of type DATS.

I have an info object which is of type date char 8.

All dates are pulled correctly in the format of mm/dd/yyyy but where the birthdate is null in source system, I am defaulting it to either 99990101 or 19000101 but it picks up really random date.

Do I have to use any function here to convert the date format to mm/dd/yyyy?

Any idea?

Many thanks in advance.

Regards,

Bobby

0 Kudos

Hi Gopal

Use function module <b>CONVERT_DATE_TO_EXTERNAL</b>. This will convert the date to the user specific format. So if your user specific format is mm/dd/yyyy, then this is all you need.

Check below threads as well...

hope it will solve ur problem..

<b>Reward Points if helpful.</b>

Thanks & Regards

ilesh 24x7

Former Member
0 Kudos

ALWAYS CHECK NULL VALUES BY USING INITIAL STATEMENT

Former Member
0 Kudos

Hi,

if tran_strcuture-birthdt is initial.

result = '99990101'.

else.

result = tran_strucutre-birthdt.

endif.

Thanks,

Sriram Ponna.