cancel
Showing results for 
Search instead for 
Did you mean: 

LSMW - where to write subroutine

Former Member
0 Kudos

I want to create Business partners using LSMW (BAPI), for one field i want to write a subroutine. can anybody pls tell me how to write and call a subroutine(FORM..) for particular field in LSMW?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
Former Member
0 Kudos

6th step means in 'Maintain Fixed Values, Translations and User-written' ? in user-defined routines?

Former Member
0 Kudos

yup,

for more info check the above links lucky

~~Guduri

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Lucky,

Write the following code in form Routines section under " Maintain Field Mapping and Conversion Rules"

1 * __FORM_ROUTINES__

2 * Convert date(sy-datum format) in date format set for the user

3 FORM convert_date USING cv_idate TYPE any

4 cv_datfm TYPE xudatfm

5 CHANGING cv_odate TYPE any.

6 DATA: l_idate TYPE char8, "input date

7 l_odate TYPE char10. "output date

8 l_idate = cv_idate.

9 CASE cv_datfm.

0 WHEN '1'.

1 CONCATENATE l_idate+6(2)

2 l_idate+4(2)

3 l_idate+0(4)

4 INTO l_odate.

5 WHEN '2' OR '3'.

6 CONCATENATE l_idate+4(2)

7 l_idate+6(2)

8 l_idate+0(4)

9 INTO l_odate.

0 WHEN OTHERS.

1 l_odate = l_idate.

2 ENDCASE.

3 cv_odate = l_odate.

4 ENDFORM. "convert_date

In the same section for the field which you wrote this FORM routine add the following code to it.

For ex.

BLDAT - Date (batch input)

Source: ZBBKPF-BLDAT (Date (batch input))

Code: PERFORM convert_date USING zbbkpf-bldat

v_datfm

CHANGING bbkpf-bldat.

Let me know if this helps.

Cheers.

Swanand

Former Member
0 Kudos

thanx i will try this,

one more question, For one of the field depending upon the source field data i want to search in transaction table(table in SAP) and depending upup the search i want to put the value in target field, so can i get the transaction table data in internal table which will be global ... i mean the internal table will be filled initially, how to do this?

Thanks

Former Member
0 Kudos

Hi Lucky,

Write the following code in form Routines section under " Maintain Field Mapping and Conversion Rules"

1 * __FORM_ROUTINES__

2 * Convert date(sy-datum format) in date format set for the user

3 FORM convert_date USING cv_idate TYPE any

4 cv_datfm TYPE xudatfm

5 CHANGING cv_odate TYPE any.

6 DATA: l_idate TYPE char8, "input date

7 l_odate TYPE char10. "output date

8 l_idate = cv_idate.

9 CASE cv_datfm.

0 WHEN '1'.

1 CONCATENATE l_idate+6(2)

2 l_idate+4(2)

3 l_idate+0(4)

4 INTO l_odate.

5 WHEN '2' OR '3'.

6 CONCATENATE l_idate+4(2)

7 l_idate+6(2)

8 l_idate+0(4)

9 INTO l_odate.

0 WHEN OTHERS.

1 l_odate = l_idate.

2 ENDCASE.

3 cv_odate = l_odate.

4 ENDFORM. "convert_date

In the same section for the field which you wrote this FORM routine add the following code to it.

For ex.

BLDAT - Date (batch input)

Source: ZBBKPF-BLDAT (Date (batch input))

Code: PERFORM convert_date USING zbbkpf-bldat

v_datfm

CHANGING bbkpf-bldat.

Former Member
0 Kudos

hi

In field mapping and conversion rules goto change mode and select layout.

check form routines(this will appear in the bottom of the window) and write your code in this.

Former Member
0 Kudos

Hi,

Check the following link:

http://www.sapbrain.com/TUTORIALS/TECHNICAL/LSMW_tutorial.html

Regards,

Bhaskar