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: 

Help with insert into table, using work area.

Former Member
0 Kudos

Hi,

What maybe wrong with the insert statement.

tables hrp9007.

data testtab type hrp9007.

testtab-plvar = '99'.

testtab-istat = '1'.

testtab-begda ='03/14/2007'.

testtab-endda = '12/31/9999'.

insert into hrp9007 values testtab.

select single begda from hrp9007 into subloc

where plvar eq '99'.

I am getting garbage value when I print "begda"

Regards.

Srinivas

12 REPLIES 12

Former Member
0 Kudos

Hi,

I think the date format maybe problem, try with YYYYMMDD format.

Regards

R. Rengaraj

former_member194669
Active Contributor
0 Kudos

insert hrp9007 from testtab

aRs

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


tables hrp9007.

data testtab type hrp9007.
testtab-plvar = '99'.
testtab-istat = '1'.
testtab-begda ='20070314'.
testtab-endda = '99991231'.
insert hrp9007 from testtab.

commit work.

select single begda from hrp9007 into subloc
where plvar eq '99'.

If it does not work, please check the appropriate date format for begda and endda fields.

Perhaps you can use FM CONVERSION_EXIT_BEGDA_INPUT for date conversion.

Regards,

Ferry Lianto

Former Member
0 Kudos

This is because of the date formats. since you are hardcoding the date in a specific format, the system will give garbage values.

Here is the solution. use WRITE TO statement.

WRITE 20070314 TO testtab-begda.

WRITE 99991231 TO testtab-endda

Also try using COMMIT WORK after the insert statement.

Former Member
0 Kudos

Srinivas,

Try with this .

INSERT hrp9007 FROM testtab.

( OR )

I think date format might be not compatable.

Pls. reward if useful

Former Member
0 Kudos

tables hrp9007.

data testtab type hrp9007.

testtab-plvar = '99'.

testtab-istat = '1'.

testtab-begda ='20070314'.

testtab-endda = '99991231'.

insert into hrp9007 values testtab.

commit work.

select single begda from hrp9007 into subloc

where plvar eq '99'.

if begda and endda are date fields...

regards

shiba dutta

0 Kudos

I copied and pasted your code.

I still get the same garbage value when I print.

4//20/03/1

Thanks and regards.

Srinivas

former_member194669
Active Contributor
0 Kudos

Check that field in the domain level, may be some convertion routines attached to the domain.

aRs

0 Kudos

The domain is DATUM

Date field (YYYYMMDD) stored as char(8)

And I am using the same in my code too.

Still getting same garbage value.

Thanks and Regards.

Former Member
0 Kudos

hi Srinivas,

Please try testtab-begda = sy-datum and testtab-endda = sy-datum. This is just

to ensure that it is the data type datum is working fine.

Also, i was wondering why there is no infotype specific fields in your insert statement? your statement inserts data only in to the infotype key fields, not into the data fields...(i mean not into any of the HRI structure fields).

Hope this helps.

Sajan Joseph.

0 Kudos

I am new to ABAP. What do you mean by infotype specific fields in the insert statements. Would you please be more elaborate "your statement inserts data only in to the infotype key fields, not into the data fields...(i mean not into any of the HRI structure fields)."

Regards

Srinivas

0 Kudos

hi Srinivas,

What do you mean by infotype specific fields

<i>Ans: The table HRP9007 is the database table for custom infotype 9007.

infotypes are information units used to maintain master data in HR module. it is a framework provided by SAP, with a combination of tables, structures and modulepool screens.

<b>infotype 9007 has the following basic componets:

HRP9007 - table

HRI9007 - structure

MP900700 - module pool program (with screens 1000, 2000 and 3000)</b>

if you go into HRP9007 from SE11, you can see three includes, HRIKEY, HRIADMIN and HRI9007.

HRIKEY fields are the key fields common to any PD (personnel development)infotypes.

HRIADMIN fields are the administration fields like last changed by...etc..

HRI9007 include contains the fields which will be populated by the end user from infotype maintenance screen (PP01 transaction for PD infotypes).

hence, HRI include/structure is also called as include with the data fields.</i>

Hope this answers your question.

Sajan Joseph.