cancel
Showing results for 
Search instead for 
Did you mean: 

Create SC with attachments via RFC.

Former Member
0 Kudos

Hi everybody,

We have a customer requeriment to create SC with attachments in background.

The information to create the SC is not coming from backend, if not from another system.

Anybody have any idea to develop this?

Many thanks in advanced.

David

Accepted Solutions (1)

Accepted Solutions (1)

pedro_santos6
Contributor
0 Kudos

Hey David,

I have the same problem, I´m trying to use the FM BBP_PD_SC_CREATE to crate news SC. If I know something I´ll tell you.

Rgs,

Pedro

Former Member
0 Kudos

Hi Pedro,

I'm working on it. I have used a copy of BAPI_SCEC_CREATE due to custom requirement.

Have you tried to use the function module BBP_PDATT_CREATE to create the attachment once SC is created?

Regards,

David.

Edited by: David Est. on Dec 5, 2011 11:33 AM

Former Member
0 Kudos

Hi David,

Creating SC with attachment is standard functionality of SRM . Can you please elaborate what problem are you facing

Regards

Ashish

Former Member
0 Kudos

Hello,

Please use below code to create a attachement.

MOVE-CORRESPONDING ls_header_po TO ls_header_u .

ls_header_u-object_type = /sapsrm/if_pdo_obj_types_c=>gc_pdo_sc.

  • Call standard function module to attach PDF to Purchase Order Document

CALL FUNCTION 'BBP_PROCDOC_UPDATE'

EXPORTING

  • i_park = iv_park

  • i_save = iv_save

i_header = ls_header_u

it_attach = lt_attach

IMPORTING

es_header = ls_header_c

TABLES

e_messages = lt_messages

CHANGING

e_changed = lv_changed.

Regards,

Neelima

Former Member
0 Kudos

Hi Ashish,

We need to create a SC with attachments, but not from web browser, if not from another system via RFC. Create a simple SC is not a problem, but if we want attach one file, we don't know how.

To create a simple shopping cart, we use a FM 'BAPI_SCEC_CRRATE'.

Regards,

David.

Former Member
0 Kudos

Hi Neelima,

How do you fill the strcuture it_attach for update the SC?

Thanks,

David.

Answers (2)

Answers (2)

Former Member
0 Kudos

I solved with custom development.

Former Member
0 Kudos

Hi David,

I have a similar requirement and when I try to create the attachment using ABAP program I get a popup box asking for the username and password. Did you face this issue? If yes, how did you resolve it?

Thanks,

Chan

Former Member
0 Kudos

Hi All,

Does anybody know how fill the table IT_ATTACH in the function 'BAPI_SCEC_CREATE'?

Many thanks in advanced.

Former Member
0 Kudos

Hello,

In my case it was PDF attachment

Fill IT_ATTACH as below:-

DATA: ls_attach TYPE bbp_pds_att,

ls_attach_kw TYPE bbp_pds_att_kw,

ls_attach_all TYPE bbp_pds_att_t,

lt_attach TYPE bbpt_pds_att_t.

*Creating the GUID for attachment

CALL FUNCTION 'GUID_CREATE'

IMPORTING

ev_guid_16 = lv_guid.

ls_attach-guid = lv_guid.

ls_attach-p_guid = ls_item-p_guid.(header or item guid)

ls_attach-loio_class = 'BBP_L_DOC'.

ls_attach_kw-phio_class = 'BBP_P_DOC'.

ls_attach_kw-phio_version_no = '00000001'.

ls_attach_kw-phio_ext = 'PDF'

ls_attach_kw-phio_fsize = '240'. (size)

ls_attach_kw-phio_mime = 'application/pdf'.

ls_attach_kw-phio_fname = lv_ext. ('name.pdf')

ls_attach_kw-phio_ps_mime = 'application/postscript'.

MOVE-CORRESPONDING ls_attach TO ls_attach_all.

MOVE-CORRESPONDING ls_attach_kw TO ls_attach_all.

APPEND ls_attach_all TO lt_attach.

Now you can use this lt_attach to 'BAPI_SCEC_CREATE'.

Regards,

Neelima

Former Member
0 Kudos

Hi Neelima,

Thanks for your response.

Do you use 'BAPI_SCEC_CREATE?

The fields into IT_ATTACH are different from yours.

IT_ATTACH table in the BAPI_SCEC_CREATE has the structure BAPI_ATT_C

What do you use to create the SC with the attachment?

Thanks,

David.

Former Member
0 Kudos

Hello ,

Try using the below code after above one

Now it_attach is type bbpt_pds_att_t and et_attach is bapi_att_c

  • Attachments

LOOP AT it_attach INTO ls_attach WHERE del_ind IS initial.

MOVE-CORRESPONDING ls_attach TO et_attach.

  • extend internal url to have unique attachment access

IF NOT ( ls_attach-loio_class IS INITIAL

OR ls_attach-loio_objid IS INITIAL ).

CALL FUNCTION 'BBP_ATTACH_CONTENT_ACCESS_GET'

EXPORTING

is_attach = ls_attach

IMPORTING

ev_doc_url = lv_doc_url

ev_error = lv_error.

IF lv_error IS INITIAL.

MOVE lv_doc_url TO et_attach-url.

ENDIF.

it_attach-parent_guid = ls_attach-p_guid.

APPEND it_attach.

ENDIF.

ENDLOOP.