Quantcast
Channel: SCN: Message List - SAP CRM: Master Data & Middleware
Viewing all articles
Browse latest Browse all 4270

Re: Bapi for business partners creation in CRM

$
0
0

All these are really nice but I recently had to automatically create bussness partner for users created the same day, so I ended up using a standart FM that uses the BAPI but makes the life a lot easier when supplying the data. I had a UNAME of the user so this is what I used:

 

TYPES: BEGIN OF ltype_gen,

          fieldname(30)   TYPE c,

          counter         TYPE i,

          fieldvalue(132) TYPE c,

        END OF ltype_gen.

 

DATA: lt_gen_tab         TYPE STANDARD TABLE OF ltype_gen.

 

     SELECT BNAME FROM USR02 INTO ls_gen_tab-fieldvalue

      WHERE ERDAT EQ sy-datum.

      IF SY-SUBRC = 0.

        ls_gen_tab-fieldname  = 'UNAME'.

        APPEND ls_gen_tab TO lt_gen_tab.

      ENDIF.

      EXIT.

    ENDSELECT.

 

*---FILL user DETAILS ---*

    CALL FUNCTION '/SDF/SOLMAN_GET_USER_DETAIL'

*    DESTINATION lf_rfcdest

      TABLES

        pt_gen_tab = lt_gen_tab

        return     = lt_return.

      

      

*--- CREATE THE BP---*

    CALL FUNCTION 'CRM_DNO_MAINTAIN_BUPA_FROM_USR'

* EXPORTING

*   IV_COMMIT       = TRUE

      TABLES

        TI_DATA         = lt_gen_tab

        TE_RETURN       = lt_return

So the magic FM is CRM_DNO_MAINTAIN_BUPA_FROM_USR.

I tried to simplify the example code here so read it before running it

I got this by debugging tcode BP_gen.

And do not forget the authority checks:

  AUTHORITY-CHECK OBJECT 'B_BUPA_RLT'

      ID 'ACTVT' FIELD '03'

      ID 'RLTYP' DUMMY.

  AUTHORITY-CHECK OBJECT 'B_BUPA_GRP'

      ID 'ACTVT' FIELD '03'.


Viewing all articles
Browse latest Browse all 4270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>