Skip to Content
author's profile photo Former Member
Former Member

How to create a sales activity using BAPI_BPCONTACT_CREATEFROMDATA 170183

Hello everyone ,

Please help me to create a sales activity using this BAPI's :

BAPI_BPCONTACT_CREATEFROMDATA

BAPI_BPCONTACT_SAVEFROMMEMORY

BAPI_TRANSACTION_COMMIT

Ref. OSS 170183

advance thank for all

Halley

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Sep 21, 2009 at 10:31 PM

    Here is an example. Values and partners depend on your config of course. I'm assuming you can define the local variables - the code is too long for me to post it.

    * BAPI field initialization
      LS_GENERALDATA-ACTIVITY_TYPE    = 'Your value'.
      LS_GENERALDATA-SALESORG         = 'Your value'.
      LS_GENERALDATA-DISTR_CHAN       = 'Your value'.
      LS_GENERALDATA-DIVISION         = 'Your value'.
      LS_GENERALDATA-FROM_DATE        =  SY-DATUM.
      LS_GENERALDATA-TO_DATE          =  SY-DATUM.
      LS_GENERALDATA-FROM_TIME        =  SY-UZEIT.
      LS_GENERALDATA-TO_TIME          =  SY-UZEIT.
      LS_GENERALDATA-REASON           = 'Your value'.
      LS_GENERALDATA-RESULT           = 'Your value'.
      LS_GENERALDATA-STATE            = '0'.
      LS_GENERALDATA-ACTIVITY_COMMENT = 'Your value'.
      LS_GENERALDATA-PARTN_ROLE       = 'AG'.
      LS_GENERALDATA-PARTN_ID         = 'Sold-to account number'.
    
      APPEND LS_GENERALDATA TO LT_GENERALDATA.
    
      LS_BUSINESSPARTNER-ITM_NUMBER   = '000000'.
      LS_BUSINESSPARTNER-PARTN_ROLE   = 'AG'.
      LS_BUSINESSPARTNER-PARTN_ID     =  'Sold-to Account'.
    
      APPEND LS_BUSINESSPARTNER TO LT_BUSINESSPARTNER.
    
    * MRL notes
      LS_NOTES-TDFORMAT = '*'.
      LS_NOTES-TDLINE = 'Your long comments text here'.
    
      LS_TEXT-TEXT_ID   = '0001'.
      LS_TEXT-FUNCTION  = '009'.
      LS_TEXT-LANGU     =  SY-LANGU.
      LS_TEXT-TEXT_LINE =  LS_NOTES.
    
      APPEND LS_TEXT TO LT_TEXT.
    
      CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
        IMPORTING
          OWN_LOGICAL_SYSTEM             = LV_SYS
        EXCEPTIONS
          OWN_LOGICAL_SYSTEM_NOT_DEFINED = 1
          OTHERS                         = 2.
    
    * Call BAPI
      CALL FUNCTION 'BAPI_BPCONTACT_CREATEFROMDATA'
        EXPORTING
          SENDER          = LV_SYS
        TABLES
          GENERALDATA     = LT_GENERALDATA
          BUSINESSPARTNER = LT_BUSINESSPARTNER
          TEXT            = LT_TEXT
          RETURN          = LT_RETURN.
    
    * Check for error
      LOOP AT LT_RETURN INTO LS_RETURN WHERE TYPE CA 'AEX'.
        EXIT.
      ENDLOOP.
    
      IF SY-SUBRC NE 0.
    
        REFRESH LT_RETURN.
    
        CALL FUNCTION 'BAPI_BPCONTACT_SAVEFROMMEMORY'
          TABLES
            SALESACTIVITYIDOUT = LT_SALESACTIVITYIDOUT
            RETURN             = LT_RETURN.
    
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    
      ENDIF.
    

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 12, 2011 at 03:23 PM

    Hello ,

    I can create a sales activity with this bapi but i need to create a sales activity like a follow up action type sales activity and see it in the flow document

    I dont find how to do that in the bapi

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      It's posible. I solved the issue. Thanks.

      ls_object_reference_list-doc_number = quote number.

      ls_object_reference_list-roletype_ab = 'B'.

      APPEND ls_object_reference_list TO lt_object_reference_list.

      Regards,

      Asier.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.