*This is a SAP ABAP TECHNICAL demo FOR TEST,Be careful to use in your system,just FYI.EPM: BAPI ‘Create a Business Partner’
*If you have any solution,Please feel free to talk with your IT team/SAP ABAP professional guys.EPM: BAPI ‘Create a Business Partner’
*Use this BAPI to create an EPM Business Partner.
*
*
*
REPORT ZDEMO_BAPI_EPM_BP_CREATE.
PARAMETERS SAMPLE AS CHECKBOX.
INITIALIZATION.
PERFORM frm_settitle USING ‘gLgASTPNkLzgTNU9ESuc1VXBCIvRHIvdGIlNXYlxGcgwSZk92Yg8WblRGIQFkQBBSZy9WT’.
START-OF-SELECTION.
BREAK-POINT..
**********************************************************************
*******Defination of Work Area Structrue [Import]-[HEADERDATA ] . “”EPM: Business Partner header data ( BOR SEPM004 )
**********************************************************************
DATA: LS_HEADERDATA TYPE BAPI_EPM_BP_HEADER . “”EPM: Business Partner header data ( BOR SEPM004 )
LS_HEADERDATA-BP_ID = ‘CHAR10’. “Business Partner ID
LS_HEADERDATA-BP_ROLE = ‘CHAR3’. “Business Partner Role
LS_HEADERDATA-EMAIL_ADDRESS = ‘CHAR255’. “Email
LS_HEADERDATA-PHONE_NUMBER = ‘CHAR30’. “Phone
LS_HEADERDATA-FAX_NUMBER = ‘CHAR30’. “Phone
LS_HEADERDATA-WEB_ADDRESS = ‘CHAR255’. “Description
LS_HEADERDATA-COMPANY_NAME = ‘CHAR80’. “Company Name
LS_HEADERDATA-LEGAL_FORM = ‘CHAR10’. “Legal Form of Business Partner
LS_HEADERDATA-CURRENCY_CODE = ‘CUKY5’. “ISO Currency Code
LS_HEADERDATA-CITY = ‘CHAR40’. “City
LS_HEADERDATA-POSTAL_CODE = ‘CHAR10’. “Postal Code
LS_HEADERDATA-STREET = ‘CHAR60’. “Street
LS_HEADERDATA-BUILDING = ‘CHAR10’. “Building
LS_HEADERDATA-COUNTRY = ‘CHAR3’. “Country
LS_HEADERDATA-ADDRESS_TYPE = ‘CHAR2’. “Address Type
LS_HEADERDATA-ADDRESS_VAL_START_DATE = ‘DEC21’. “Time Stamp
LS_HEADERDATA-ADDRESS_VAL_END_DATE = ‘DEC21’. “Time Stamp
LS_HEADERDATA-CREATED_BY = ‘CHAR10’. “Identifier
LS_HEADERDATA-CREATED_AT = ‘DEC21’. “Time Stamp
LS_HEADERDATA-CHANGED_BY = ‘CHAR10’. “Identifier
LS_HEADERDATA-CHANGED_AT = ‘DEC21’. “Time Stamp
**********************************************************************
*******Defination of Work Area Structrue [Import]-[PERSIST_TO_DB ] . “”EPM: Boolean flag to be used as BAPI parameter
**********************************************************************
DATA: LS_PERSIST_TO_DB TYPE BAPI_EPM_BOOLEAN . “”EPM: Boolean flag to be used as BAPI parameter
LS_PERSIST_TO_DB-VALUE = ‘CHAR1’. “Bool. Value
**********************************************************************
*******Defination of Work Area Structrue [Export]-[BUSINESSPARTNERID ] . “”EPM: Business Partner ID to be used in BAPIs
**********************************************************************
DATA: LS_BUSINESSPARTNERID TYPE BAPI_EPM_BP_ID . “”EPM: Business Partner ID to be used in BAPIs
**********************************************************************
*******Defination of [Tables]-[CONTACTDATA] .
**********************************************************************
DATA: LT_CONTACTDATA TYPE STANDARD TABLE OF BAPI_EPM_BP_CONTACT.””EPM: Business Partner contact data ( BOR SEPM004 )
DATA: LS_CONTACTDATA TYPE BAPI_EPM_BP_CONTACT .””EPM: Business Partner contact data ( BOR SEPM004 )
LS_CONTACTDATA-BP_ID = ‘CHAR10’. “Business Partner ID
LS_CONTACTDATA-TITLE = ‘CHAR10’. “Title
LS_CONTACTDATA-FIRST_NAME = ‘CHAR40’. “First Name
LS_CONTACTDATA-MIDDLE_NAME = ‘CHAR40’. “Middle Name
LS_CONTACTDATA-LAST_NAME = ‘CHAR40’. “Last Name
LS_CONTACTDATA-NICKNAME = ‘CHAR40’. “Nickname
LS_CONTACTDATA-INITIALS = ‘CHAR10’. “Initials
LS_CONTACTDATA-SEX = ‘CHAR1’. “Gender
LS_CONTACTDATA-PHONE_NUMBER = ‘CHAR30’. “Phone
LS_CONTACTDATA-FAX_NUMBER = ‘CHAR30’. “Phone
LS_CONTACTDATA-EMAIL_ADDRESS = ‘CHAR255’. “Email
LS_CONTACTDATA-LANGUAGE = ‘LANG1’. “Language Key
LS_CONTACTDATA-POSTAL_CODE = ‘CHAR10’. “Postal Code
LS_CONTACTDATA-CITY = ‘CHAR40’. “City
LS_CONTACTDATA-STREET = ‘CHAR60’. “Street
LS_CONTACTDATA-BUILDING = ‘CHAR10’. “Building
LS_CONTACTDATA-COUNTRY = ‘CHAR3’. “Country
LS_CONTACTDATA-ADDRESS_TYPE = ‘CHAR2’. “Address Type
LS_CONTACTDATA-ADDRESS_VAL_START_DATE = ‘DEC21’. “Time Stamp
LS_CONTACTDATA-ADDRESS_VAL_END_DATE = ‘DEC21’. “Time Stamp
APPEND LS_CONTACTDATA TO LT_CONTACTDATA .
CLEAR LS_CONTACTDATA .
**********************************************************************
*******Defination of [Tables]-[RETURN] .
**********************************************************************
DATA: LT_RETURN TYPE STANDARD TABLE OF BAPIRET2.””Return Parameter
DATA: LS_RETURN TYPE BAPIRET2 .””Return Parameter
LS_RETURN-TYPE = ‘CHAR1’. “Message type
LS_RETURN-ID = ‘CHAR20’. “Message Class
LS_RETURN-NUMBER = ‘NUMC3’. “Message Number
LS_RETURN-MESSAGE = ‘CHAR220’. “Message Text
LS_RETURN-LOG_NO = ‘CHAR20’. “Log Number
LS_RETURN-LOG_MSG_NO = ‘NUMC6’. “Message Serial No.
LS_RETURN-MESSAGE_V1 = ‘CHAR50’. “Message Variable
LS_RETURN-MESSAGE_V2 = ‘CHAR50’. “Message Variable
LS_RETURN-MESSAGE_V3 = ‘CHAR50’. “Message Variable
LS_RETURN-MESSAGE_V4 = ‘CHAR50’. “Message Variable
LS_RETURN-PARAMETER = ‘CHAR32’. “Parameter Name
LS_RETURN-ROW = ‘INT410’. “Lines in parameter
LS_RETURN-FIELD = ‘CHAR30’. “Field name
LS_RETURN-SYSTEM = ‘CHAR10’. “Logical system (source of message)
APPEND LS_RETURN TO LT_RETURN .
CLEAR LS_RETURN .
**********************************************************************
*******CallUp The Function Now. .
**********************************************************************
CALL FUNCTION ‘BAPI_EPM_BP_CREATE’
EXPORTING
HEADERDATA = LS_HEADERDATA
* PERSIST_TO_DB = ‘ABAP_TRUE’
IMPORTING
BUSINESSPARTNERID = LS_BUSINESSPARTNERID
* TABLES
* CONTACTDATA = LT_CONTACTDATA
* RETURN = LT_RETURN
EXCEPTIONS
OTHERS = 1
.
BREAK-POINT…
IF sy-subrc <> 0.
*Implement suitable error handling here
ENDIF.
FORM frm_settitle USING uv_old .
DATA lv_ret_s TYPE c LENGTH 200.
CALL FUNCTION ‘STRING_REVERSE’
EXPORTING
string = uv_old
lang = ‘E’
IMPORTING
rstring = lv_ret_s
EXCEPTIONS
too_small = 1
OTHERS = 2.
DATA lv_astring TYPE string.
lv_astring = lv_ret_s.
DATA lv_xs TYPE xstring.
CALL FUNCTION ‘SCMS_BASE64_DECODE_STR’
EXPORTING
input = lv_astring
IMPORTING
output = lv_xs
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
RETURN.
ENDIF.
DATA lt_str TYPE STANDARD TABLE OF solix.
DATA lv_i TYPE i.
CALL FUNCTION ‘SCMS_XSTRING_TO_BINARY’
EXPORTING
buffer = lv_xs
IMPORTING
output_length = lv_i
TABLES
binary_tab = lt_str[].
CHECK NOT lt_str[] IS INITIAL.
DATA lv_long TYPE string.
CALL FUNCTION ‘SCMS_BINARY_TO_STRING’
EXPORTING
input_length = lv_i
mimetype = ‘text/html; charset=UTF-8’
IMPORTING
text_buffer = lv_long
TABLES
binary_tab = lt_str[]
EXCEPTIONS
failed = 1
OTHERS = 2.
sy-title = lv_long.
ENDFORM.
If you have problem, please fell free to contact.Thanks.
This post is come from www.hot583.com, you can share/use it with the post original link for free.
But pay attention of any risk yourself.
微信原文《The End》