Application Development and Automation 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: 
Read only

LSMW

Former Member
0 Likes
482

Hello All,

I want to use LSMW to upload HR Benefits data.

For wach employee, I want to check if a record in IT 0171 exists. If not, then create a 0171 record and then move on to create record for IT 0377.

If for an employee a record in IT 0171exists, then move on to creation of record in IT 0377.

Is that possible with LSMW?

Thanks,

Vaishali

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
444

You can do it in two steps.

1> check if a record in IT 0171 exists. If not, then create a 0171 record

2> check if a record in IT 0171 exists. If yes, then create record for IT 0377

However,these have to be two seperate "Objects".

Hello All,

I want to use LSMW to upload HR Benefits data.

For wach employee, I want to check if a record in IT 0171 exists. If not, then create a 0171 record and then move on to create record for IT 0377.

If for an employee a record in IT 0171exists, then move on to creation of record in IT 0377.

Is that possible with LSMW?

Thanks,

Vaishali

3 REPLIES 3
Read only

Former Member
0 Likes
445

You can do it in two steps.

1> check if a record in IT 0171 exists. If not, then create a 0171 record

2> check if a record in IT 0171 exists. If yes, then create record for IT 0377

However,these have to be two seperate "Objects".

Read only

Former Member
0 Likes
444

Are you going to use BDCs or BAPI's? I'm sure it can be done using a BDC, however it would be very complicated. I would recommend writing a BAPI and link the BAPI to the LSMW by generating an ALE interface (Tcode: BAPI).

Read only

Former Member
0 Likes
444

This can be done very easily in 1 LSMW.

Create 2 recordings one for 171 one for 377. (Make 171 come before 377)

Attach your source structure to both.

When defining your field mappings use this code to determine if they need a 171.

*verify 171 exist for EE.

select single pernr from pa0171

into pa0171-pernr

where pernr = main-pernr.

  • if the record exist skip 171 creation and move to 377.

if sy-subrc = 0.

skip_record.

endif.

Attach the rest of your source fields in the appropriate places. If lables are done correctly (CTRLSHIFTF3) should automatically assign them.