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: 

Adding attachment(s) to Vendor using LSMW (BDC Recording)

Former Member
0 Kudos

Hi,

The requirement is to create file attachments to existing Vendors using LSMW.

The transaction code is MK02.

When MK02 is executed on-line, the 'create attachement' icon appears on the second screen of the transaction. See steps below for details of attaching the file.

1. MK02 > Enter Vendor No

2. Enter Purchase Org. No.

3. Check the 'Address' checkbox and press 'Enter'

4. On the next screen, there is an icon next to the screen title

'Change Vendor: Address'. Click on the drop-down list next to this icon

and select 'Create' > 'Create Attachment'.

In the pop-screen 'Import file', select the file to be attached to the current

vendor.

5. Save the changes.

However, if I tried to do a BDC recording of the SAME transaction in LSMW,

the 'Create Attachment' icon is missing from the second screen.

Questions:

1. Is there a way I can achieve the file attachment requirements using LSMW?

2. Is there another similar transaction I can use to achieve the same requirement

( an automated attachment of files to existing Vendors?)

If you have a fix or alternative solution(s), I would love to hear from you ASAP.

Please provide specific details of the fix or solution(s).

Thank you in advance.

1 ACCEPTED SOLUTION

Former Member

Well this cant be done in BDC you have to make another program which will upload the attachment to the correspoding vendor.

Please use the fm BDS_BUSINESSDOCUMENT_CREATEF to attach the document.

the use of this fm in HR infotype is done like this

*/ local internal tables

DATA : lit_file TYPE STANDARD TABLE OF bapifiles WITH HEADER LINE,

lit_signature TYPE STANDARD TABLE OF bapisignat WITH HEADER LINE.

*/ local variable

DATA: l_filepath TYPE string,

l_objkey TYPE bapibds01-objkey,

l_ivdate(10) TYPE c,

l_filename TYPE string,

l_message TYPE string.

CHECK g_reject IS INITIAL.

l_objkey+0(8) = fu_ivdate. "End Date

l_objkey+8(8) = fu_ivdate. "Start Date

l_objkey+16(4) = '9029'. "Infotype

l_objkey+20(4) = fu_ivtype. "Subtype

l_objkey+24(8) = fu_pernr. "Employee Number

*/ to get file name

  • PERFORM f_get_file_name USING fu_filename CHANGING l_filename.

*/ to prepare file name

lit_file-doc_count = '00000001'.

lit_file-comp_count = '00000001'.

lit_file-filename = fu_filename.

lit_file-directory = p_folder.

APPEND lit_file.

*/ to set document type

lit_signature-doc_count = '00000001'.

lit_signature-prop_name = 'BDS_DOCUMENTCLASS'.

lit_signature-prop_value = 'xls'.

APPEND lit_signature.

*/ to set the attachment title

lit_signature-prop_name = 'DESCRIPTION'.

*/ to attached the form to personnel attachment list

CALL FUNCTION 'BDS_BUSINESSDOCUMENT_CREATEF'

EXPORTING

classname = 'ZIVATTKEY' "'ZIVOBKEY'

classtype = 'BO'

client = sy-mandt

object_key = l_objkey

TABLES

files = lit_file

signature = lit_signature

EXCEPTIONS

nothing_found = 1

parameter_error = 2

not_allowed = 3

error_kpro = 4

internal_error = 5

not_authorized = 6

OTHERS = 7.

IF sy-subrc <> 0.

endif.

You have to lookup for how it can be used with vendor master.

please reward points if its helpful

Babar.

Message was edited by:

Babar

2 REPLIES 2

Former Member

Well this cant be done in BDC you have to make another program which will upload the attachment to the correspoding vendor.

Please use the fm BDS_BUSINESSDOCUMENT_CREATEF to attach the document.

the use of this fm in HR infotype is done like this

*/ local internal tables

DATA : lit_file TYPE STANDARD TABLE OF bapifiles WITH HEADER LINE,

lit_signature TYPE STANDARD TABLE OF bapisignat WITH HEADER LINE.

*/ local variable

DATA: l_filepath TYPE string,

l_objkey TYPE bapibds01-objkey,

l_ivdate(10) TYPE c,

l_filename TYPE string,

l_message TYPE string.

CHECK g_reject IS INITIAL.

l_objkey+0(8) = fu_ivdate. "End Date

l_objkey+8(8) = fu_ivdate. "Start Date

l_objkey+16(4) = '9029'. "Infotype

l_objkey+20(4) = fu_ivtype. "Subtype

l_objkey+24(8) = fu_pernr. "Employee Number

*/ to get file name

  • PERFORM f_get_file_name USING fu_filename CHANGING l_filename.

*/ to prepare file name

lit_file-doc_count = '00000001'.

lit_file-comp_count = '00000001'.

lit_file-filename = fu_filename.

lit_file-directory = p_folder.

APPEND lit_file.

*/ to set document type

lit_signature-doc_count = '00000001'.

lit_signature-prop_name = 'BDS_DOCUMENTCLASS'.

lit_signature-prop_value = 'xls'.

APPEND lit_signature.

*/ to set the attachment title

lit_signature-prop_name = 'DESCRIPTION'.

*/ to attached the form to personnel attachment list

CALL FUNCTION 'BDS_BUSINESSDOCUMENT_CREATEF'

EXPORTING

classname = 'ZIVATTKEY' "'ZIVOBKEY'

classtype = 'BO'

client = sy-mandt

object_key = l_objkey

TABLES

files = lit_file

signature = lit_signature

EXCEPTIONS

nothing_found = 1

parameter_error = 2

not_allowed = 3

error_kpro = 4

internal_error = 5

not_authorized = 6

OTHERS = 7.

IF sy-subrc <> 0.

endif.

You have to lookup for how it can be used with vendor master.

please reward points if its helpful

Babar.

Message was edited by:

Babar

0 Kudos

Did you get the solution..??

If not,let me know I will guide you how to do this activity by using LSMW through batch input record. I have done it.

Thanks,

Senthil Kumar.S