BAPI_FAMILYUS_CREATESUCCESSOR Create subsequent family rec

To day I have know use of  Sample code example demo for BAPI_FAMILYUS_CREATESUCCESSOR Create subsequent family record.

I am 20 years of SAP ABAP experice as a SAP consultant.

*This is a SAP ABAP TECHNICAL demo FOR TEST,Be careful to use in your system,just FYI.EFamily US: Create subsequent family record
*If you have any solution,Please feel free to talk with your IT team/SAP ABAP professional guys.EFamily US: Create subsequent family record
*You can use this method to create family/related-person records for US
*employees (infotypes 0021/0106).
*INCLUDE BAPI_RET
*The key fields used by the method are described in the parameter
*documentation.
*You can use this method only if you have called the <zh>ENQUEUE
*method of the business object EMPLOYEE beforehand. For more information
*on the ENQUEUE method, read the documentation on the function module
*BAPI_EMPLOYEE_ENQUEUE.
REPORT ZDEMO_BAPI_FAMILYUS_CREATESUCCESSOR.
PARAMETERS SAMPLE AS CHECKBOX.
INITIALIZATION.
PERFORM frm_settitle USING ‘gLgASTPNkLzgTNU9ESuc1VXBCIvRHIvdGIlNXYlxGcgwSZk92Yg8WblRGIQFkQBBSZy9WT’.
START-OF-SELECTION.
BREAK-POINT..
DATA: LV_EMPLOYEENUMBER TYPE BAPIP0021-PERNR .”Obligatory
DATA: LV_VALIDITYBEGIN TYPE BAPIP0021-BEGDA .”Obligatory
DATA: LV_VALIDITYEND TYPE BAPIP0021-ENDDA .”Obligatory
DATA: LV_MEMBERTYPE TYPE BAPIP0021-FAMSA .”Obligatory
DATA: LV_MEMBERID TYPE BAPIP0021-OBJPS .”Obligatory
DATA: LV_FIRSTNAME TYPE BAPIP0021-FAVOR .”Obligatory
DATA: LV_LASTNAME TYPE BAPIP0021-FANAM .”Obligatory
DATA: LV_MAIDENNAME TYPE BAPIP0021-FGBNA .”Obligatory
DATA: LV_GENDER TYPE BAPIP0021-FASEX .”Obligatory
DATA: LV_DATEOFBIRTH TYPE BAPIP0021-FGBDT .”Obligatory
DATA: LV_NATIONALITY TYPE BAPIP0021-FANAT .”Obligatory
DATA: LV_NATIONALITY2 TYPE BAPIP0021-FANA2 .”Obligatory
DATA: LV_NATIONALITY3 TYPE BAPIP0021-FANA3 .”Obligatory
DATA: LV_REFPERSNO TYPE BAPIP0021US-REFPERSNO .”Obligatory
DATA: LV_IDNUMBER TYPE BAPIP0021US-IDNUMBER .”Obligatory
DATA: LV_PHONENUMBER TYPE BAPIP0021US-PHONENUMBER .”Obligatory
DATA: LV_STREETANDHOUSENO TYPE BAPIP0021US-STREETANDHOUSE .”Obligatory
DATA: LV_SECONDADDRESSLINE TYPE BAPIP0021US-SECONDADDRLINE .”Obligatory
DATA: LV_CITY TYPE BAPIP0021US-CITY .”Obligatory
DATA: LV_STATE TYPE BAPIP0021US-STATE .”Obligatory
DATA: LV_POSTALCODE TYPE BAPIP0021US-POSTALCODE .”Obligatory
DATA: LV_COUNTRY TYPE BAPIP0021US-COUNTRY .”Obligatory
DATA: LV_DATEOFSEPARATION TYPE BAPIP0021US-DATEOFSEP .”Obligatory
DATA: LV_NAMEOFPHYSICIAN1 TYPE BAPIP0021US-NAMEOFPHYS1 .”Obligatory
DATA: LV_PHYSICIANID1 TYPE BAPIP0021US-PHYSICIANID1 .”Obligatory
DATA: LV_NAMEOFPHYSICIAN2 TYPE BAPIP0021US-NAMEOFPHYS2 .”Obligatory
DATA: LV_PHYSICIANID2 TYPE BAPIP0021US-PHYSICIANID2 .”Obligatory
DATA: LV_STUDENT TYPE BAPIP0021US-STUDENT .”Obligatory
DATA: LV_COBRA TYPE BAPIP0021US-COBRA .”Obligatory
DATA: LV_MEDICARE TYPE BAPIP0021US-MEDICARE .”Obligatory
DATA: LV_SMOKER TYPE BAPIP0021US-SMOKER .”Obligatory
DATA: LV_DISABILITY TYPE BAPIP0021US-DISABILITY .”Obligatory
DATA: LV_DATEOFDISABILITY TYPE BAPIP0021US-DATEOFDISAB .”Obligatory
DATA: LV_DATEDISABLEARNED TYPE BAPIP0021US-DATEDISABLEARN .”Obligatory
DATA: LV_NOCOMMIT TYPE BAPI_STAND-NO_COMMIT .”Obligatory
DATA: LV_MARITAL_STATUS TYPE BAPIP0021US-MARITAL_STATUS .”Obligatory

**********************************************************************
*******Defination of Work Area Structrue [Export]-[RETURN ] . “”Return Parameter
**********************************************************************
DATA: LS_RETURN TYPE BAPIRETURN1 . “”Return Parameter
DATA: LV_EMPLOYEENUMBER TYPE BAPIP0021-PERNR .”Obligatory
DATA: LV_SUBTYPE TYPE BAPIP0021-SUBTY .”Obligatory
DATA: LV_OBJECTID TYPE BAPIP0021-OBJPS .”Obligatory
DATA: LV_LOCKINDICATOR TYPE BAPIP0021-SPRPS .”Obligatory
DATA: LV_VALIDITYBEGIN TYPE BAPIP0021-BEGDA .”Obligatory
DATA: LV_VALIDITYEND TYPE BAPIP0021-ENDDA .”Obligatory
DATA: LV_RECORDNUMBER TYPE BAPIP0021-SEQNR .”Obligatory

**********************************************************************
*******CallUp The Function Now. .
**********************************************************************
CALL FUNCTION ‘BAPI_FAMILYUS_CREATESUCCESSOR’
EXPORTING
EMPLOYEENUMBER = LV_EMPLOYEENUMBER
VALIDITYBEGIN = LV_VALIDITYBEGIN
VALIDITYEND = LV_VALIDITYEND
* MEMBERTYPE = LV_MEMBERTYPE
* MEMBERID = LV_MEMBERID
* FIRSTNAME = LV_FIRSTNAME
* LASTNAME = LV_LASTNAME
* MAIDENNAME = LV_MAIDENNAME
* GENDER = LV_GENDER
* DATEOFBIRTH = LV_DATEOFBIRTH
* NATIONALITY = LV_NATIONALITY
* NATIONALITY2 = LV_NATIONALITY2
* NATIONALITY3 = LV_NATIONALITY3
* REFPERSNO = LV_REFPERSNO
* IDNUMBER = LV_IDNUMBER
* PHONENUMBER = LV_PHONENUMBER
* STREETANDHOUSENO = LV_STREETANDHOUSENO
* SECONDADDRESSLINE = LV_SECONDADDRESSLINE
* CITY = LV_CITY
* STATE = LV_STATE
* POSTALCODE = LV_POSTALCODE
* COUNTRY = LV_COUNTRY
* DATEOFSEPARATION = LV_DATEOFSEPARATION
* NAMEOFPHYSICIAN1 = LV_NAMEOFPHYSICIAN1
* PHYSICIANID1 = LV_PHYSICIANID1
* NAMEOFPHYSICIAN2 = LV_NAMEOFPHYSICIAN2
* PHYSICIANID2 = LV_PHYSICIANID2
* STUDENT = LV_STUDENT
* COBRA = LV_COBRA
* MEDICARE = LV_MEDICARE
* SMOKER = LV_SMOKER
* DISABILITY = LV_DISABILITY
* DATEOFDISABILITY = LV_DATEOFDISABILITY
* DATEDISABLEARNED = LV_DATEDISABLEARNED
* NOCOMMIT = LV_NOCOMMIT
* MARITAL_STATUS = LV_MARITAL_STATUS
IMPORTING
RETURN = LS_RETURN
EMPLOYEENUMBER = LV_EMPLOYEENUMBER
SUBTYPE = LV_SUBTYPE
OBJECTID = LV_OBJECTID
LOCKINDICATOR = LV_LOCKINDICATOR
VALIDITYBEGIN = LV_VALIDITYBEGIN
VALIDITYEND = LV_VALIDITYEND
RECORDNUMBER = LV_RECORDNUMBER
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.

 

 

About me:

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》

今日热点在看SAP HOT583