Skip to Content
avatar image
Former Member

Add Activity Journals using BAPI_ACTIVITYCRM_CHANGEMULTI

Hi SAP experts,

I'm trayng to use <b>BAPI BAPI_ACTIVITYCRM_CHANGEMULTI</b> to create an Activity Journal with a line product. I thing that I have to fill structures <i><b>journal</b></i> and <i><b>material</b></i>, but when I consult de activity created there is a problem in the Activity Journal screen.

Does anyone have a code example how to fill these structures?

Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    May 12, 2006 at 09:35 AM

    Hi,

    do you want to CREATE a new activity with journal, material, etc. or change an existing one?

    It would help if you poste your code you already have because the problem is not to fill the journal or the material but to fill the input_fields, header, etc. in a correct way.

    Greetings

    Chris

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I don't have problems if I want to change the Activity Journal, the problem is to add a new one.

      Finaly last week I found a solution, the problem was obtain a guid for the Activity Journal and now I'm using FM CRM_DETERMINE_SINGLE_JOURNAL to obtain the guid that I need.

      This is the code that I used and works fine.

      DATA:
        lt_journal	       TYPE TABLE OF bapibus2000110_journal WITH HEADER LINE,
        lt_journalx	       TYPE TABLE OF bapibus2000110_journalx WITH HEADER LINE,
        lt_material	       TYPE TABLE OF bapibus2000110_material WITH HEADER LINE,
        lt_materialx	TYPE TABLE OF bapibus2000110_materialx WITH HEADER LINE.
      
        lt_material-handle            = '1'.
        lt_material-header            = lt_header-guid.
        lt_material-ordered_prod      = 'GAS'.
        lt_material-volume            = '5'.
        lt_material-volume_unit       = 'L'.
        APPEND lt_material.
      
        lt_materialx-ordered_prod      = 'X'.
        lt_materialx-volume            = 'X'.
        lt_materialx-volume_unit       = 'X'.
        APPEND lt_materialx.
      
        DATA:
          iv_header_guid TYPE crmt_object_guid,
          es_act_journal_determined TYPE   crmt_act_journal_determined,
          cv_journal_guid TYPE crmt_act_journal_guid.
      
        iv_header_guid  = lt_header-guid.
      
        CALL FUNCTION 'CRM_DETERMINE_SINGLE_JOURNAL'
          EXPORTING
            iv_header_guid            = iv_header_guid
          IMPORTING
            es_act_journal_determined = es_act_journal_determined
          CHANGING
            cv_journal_guid           = cv_journal_guid
          EXCEPTIONS
            jrnl_not_valid            = 1
            guid_not_valid            = 2
            OTHERS                    = 3.
      
        lt_journal-journal_guid = cv_journal_guid.
        lt_journal-ref_handle         = '1'.
        APPEND lt_journal.
      
        lt_journalx-journal_guid = 'X'.
        APPEND lt_journalx.
      
        REFRESH lt_return.
        CALL FUNCTION 'BAPI_ACTIVITYCRM_CHANGEMULTI'
          TABLES
            journal   = lt_journal
            journalx  = lt_journalx
            material  = lt_material
            materialx = lt_materialx
            return    = lt_return.
      
      

      Message was edited by: Oscar Valdes