2019年9月24日星期二
F4 help Multi-fields
REPORT ZMULTIHELP.
PARAMETERS:
P_EBELN TYPE C LENGTH 20,
P_EBELP TYPE C LENGTH 10.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_EBELN.
DATA:
LT_EKPO TYPE STANDARD TABLE OF EKPO,
LT_FIELDS TYPE STANDARD TABLE OF DFIES,
LT_MAPPING TYPE STANDARD TABLE OF DSELC.
"Fetching only 100 sales documents
SELECT * FROM EKPO
INTO TABLE LT_EKPO
UP TO 100 ROWS.
"Adding the fields we need to be shown in the
"search help
PERFORM ADD_FIELD
TABLES LT_FIELDS
USING 'EKPO'
'EBELN'.
PERFORM ADD_FIELD
TABLES LT_FIELDS
USING 'EKPO'
'EBELP'.
"Adding fields that has to be mapped to
"selection screen fields
PERFORM APPEND_MAPPING
TABLES LT_MAPPING
USING 'EBELN' 'P_EBELN'.
PERFORM APPEND_MAPPING
TABLES LT_MAPPING
USING 'EBELP' 'P_EBELP'.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'EBELN'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_EBELN'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = LT_EKPO
FIELD_TAB = LT_FIELDS
DYNPFLD_MAPPING = LT_MAPPING
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*&------------------------------------------------------*
*& Form add_field
*&------------------------------------------------------*
* Add field info to fieldtab given its table name and
* field name
*-------------------------------------------------------*
* -->TABNAME text
* -->FIELDNAME text
*-------------------------------------------------------*
FORM ADD_FIELD
TABLES P_FIELDS
USING TABNAME TYPE TABNAME
FIELDNAME TYPE FIELDNAME.
DATA: LS_FIELD TYPE DFIES,
LT_FIELDS TYPE STANDARD TABLE OF DFIES.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
TABNAME = TABNAME
FIELDNAME = FIELDNAME
TABLES
DFIES_TAB = LT_FIELDS
EXCEPTIONS
NOT_FOUND = 1
INTERNAL_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
APPEND LINES OF LT_FIELDS TO P_FIELDS.
ENDFORM. "add_field
*&------------------------------------------------------*
*& Form append_mapping
*&------------------------------------------------------*
* Append field mapping to mapping table
*-------------------------------------------------------*
* -->P_MAPPING Mapping table
* -->P_FIELD Field in Itab
* -->P_DYNPRO_FIELD Field in screen
*-------------------------------------------------------*
FORM APPEND_MAPPING
TABLES P_MAPPING
USING P_FIELD
P_DYNPRO_FIELD.
DATA:
LS_MAPPING TYPE DSELC.
LS_MAPPING-FLDNAME = P_FIELD.
LS_MAPPING-DYFLDNAME = P_DYNPRO_FIELD.
APPEND LS_MAPPING TO P_MAPPING.
ENDFORM. "append_mapping
PARAMETERS:
P_EBELN TYPE C LENGTH 20,
P_EBELP TYPE C LENGTH 10.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_EBELN.
DATA:
LT_EKPO TYPE STANDARD TABLE OF EKPO,
LT_FIELDS TYPE STANDARD TABLE OF DFIES,
LT_MAPPING TYPE STANDARD TABLE OF DSELC.
"Fetching only 100 sales documents
SELECT * FROM EKPO
INTO TABLE LT_EKPO
UP TO 100 ROWS.
"Adding the fields we need to be shown in the
"search help
PERFORM ADD_FIELD
TABLES LT_FIELDS
USING 'EKPO'
'EBELN'.
PERFORM ADD_FIELD
TABLES LT_FIELDS
USING 'EKPO'
'EBELP'.
"Adding fields that has to be mapped to
"selection screen fields
PERFORM APPEND_MAPPING
TABLES LT_MAPPING
USING 'EBELN' 'P_EBELN'.
PERFORM APPEND_MAPPING
TABLES LT_MAPPING
USING 'EBELP' 'P_EBELP'.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'EBELN'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_EBELN'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = LT_EKPO
FIELD_TAB = LT_FIELDS
DYNPFLD_MAPPING = LT_MAPPING
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*&------------------------------------------------------*
*& Form add_field
*&------------------------------------------------------*
* Add field info to fieldtab given its table name and
* field name
*-------------------------------------------------------*
* -->TABNAME text
* -->FIELDNAME text
*-------------------------------------------------------*
FORM ADD_FIELD
TABLES P_FIELDS
USING TABNAME TYPE TABNAME
FIELDNAME TYPE FIELDNAME.
DATA: LS_FIELD TYPE DFIES,
LT_FIELDS TYPE STANDARD TABLE OF DFIES.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
TABNAME = TABNAME
FIELDNAME = FIELDNAME
TABLES
DFIES_TAB = LT_FIELDS
EXCEPTIONS
NOT_FOUND = 1
INTERNAL_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
APPEND LINES OF LT_FIELDS TO P_FIELDS.
ENDFORM. "add_field
*&------------------------------------------------------*
*& Form append_mapping
*&------------------------------------------------------*
* Append field mapping to mapping table
*-------------------------------------------------------*
* -->P_MAPPING Mapping table
* -->P_FIELD Field in Itab
* -->P_DYNPRO_FIELD Field in screen
*-------------------------------------------------------*
FORM APPEND_MAPPING
TABLES P_MAPPING
USING P_FIELD
P_DYNPRO_FIELD.
DATA:
LS_MAPPING TYPE DSELC.
LS_MAPPING-FLDNAME = P_FIELD.
LS_MAPPING-DYFLDNAME = P_DYNPRO_FIELD.
APPEND LS_MAPPING TO P_MAPPING.
ENDFORM. "append_mapping
2019年9月4日星期三
BP Create Vendor
REPORT ZBPADD2.
DATA:L_PARTN_CAT TYPE BAPIBUS1006_HEAD-PARTN_CAT,
LS_CENTRAL TYPE BAPIBUS1006_CENTRAL,
LS_PARTN_GROUP TYPE BAPIBUS1006_HEAD,
LS_CENTRAL_PERSON TYPE BAPIBUS1006_CENTRAL_PERSON,
LS_CENTRAL_ORGAN TYPE BAPIBUS1006_CENTRAL_ORGAN,
L_PARTN_GRP TYPE BAPIBUS1006_HEAD-PARTN_GRP,
LS_CENTRAL_GROUP TYPE BAPIBUS1006_CENTRAL_GROUP,
LS_ADDRESS TYPE BAPIBUS1006_ADDRESS,
L_BPARTNER TYPE BAPIBUS1006_HEAD-BPARTNER,
LT_BAPIADTEL LIKE TABLE OF BAPIADTEL WITH HEADER LINE,
LT_BAPIRET2 LIKE TABLE OF BAPIRET2 WITH HEADER LINE,
LT_GUID LIKE TABLE OF BUS000___I WITH HEADER LINE,
LT_CUSTO TYPE TABLE OF BUS000_EEW WITH HEADER LINE.
DATA:LS_BUT0BK TYPE BUT0BK,
LV_BKVID TYPE BUT0BK-BKVID,
LV_TYPE TYPE CHAR1,
L_STR TYPE STRING,
L_ROLE TYPE BAPIBUS1006_HEAD-PARTNERROLE VALUE 'FLVN00'.
DATA:LS_BANKDETAIL TYPE BAPIBUS1006_BANKDETAIL.
DATA:LS_BANKDETAIL_X TYPE BAPIBUS1006_BANKDETAIL_X.
DATA:LT_RETURN TYPE TABLE OF BAPIRET2.
DATA:LS_RETURN TYPE BAPIRET2.
L_PARTN_CAT = '2'.
LS_CENTRAL_ORGAN-NAME1 = 'aaa'.
LS_CENTRAL-SEARCHTERM1 = 'aaa'.
LS_CENTRAL_ORGAN-FOUNDATIONDATE = '20190220'.
LS_ADDRESS-COUNTRY = 'JP'.
LS_ADDRESS-CITY = 'TOKYO'.
LS_ADDRESS-POSTL_COD1 = '270-2261'.
LS_ADDRESS-STREET = 'aaa'.
L_PARTN_GRP = 'Z001'.
CLEAR LT_BAPIADTEL.
LT_BAPIADTEL-COUNTRY = 'JP'.
LT_BAPIADTEL-STD_NO = 'X'.
"電話
LT_BAPIADTEL-TELEPHONE = '010-84522355'.
APPEND LT_BAPIADTEL.
LS_ADDRESS-LANGU = '1'.
LS_ADDRESS-STREET = 'BACK STRET'.
CALL FUNCTION 'BAPI_BUPA_CREATE_FROM_DATA'
EXPORTING
* USINESSPARTNEREXTERN =
BUSINESSPARTNEREXTERN = '0000999962'
PARTNERCATEGORY = L_PARTN_CAT
PARTNERGROUP = L_PARTN_GRP
CENTRALDATA = LS_CENTRAL
CENTRALDATAPERSON = LS_CENTRAL_PERSON
CENTRALDATAORGANIZATION = LS_CENTRAL_ORGAN
CENTRALDATAGROUP = LS_CENTRAL_GROUP
ADDRESSDATA = LS_ADDRESS
* UPLICATE_MESSAGE_TYPE =
* CCEPT_ERROR = ' '
IMPORTING
BUSINESSPARTNER = L_BPARTNER
TABLES
TELEFONDATA = LT_BAPIADTEL
* AXDATA =
* ELETEXDATA =
* ELEXDATA =
* _MAILDATA =
* MLADDRESSDATA =
* 400ADDRESSDATA =
* FCADDRESSDATA =
* RTADDRESSDATA =
* SFADDRESSDATA =
* RIADDRESSDATA =
* AGADDRESSDATA =
* DDRESSNOTES =
* OMMUNICATIONNOTES =
* OMMUNICATIONUSAGE =
* ELEFONDATANONADDRESS =
* AXDATANONADDRESS =
* ELETEXDATANONADDRESS =
* ELEXDATANONADDRESS =
* _MAILDATANONADDRESS =
* MLADDRESSDATANONADDRESS =
* 400ADDRESSDATANONADDRESS =
* FCADDRESSDATANONADDRESS =
* RTADDRESSDATANONADDRESS =
* SFADDRESSDATANONADDRESS =
* RIADDRESSDATANONADDRESS =
* AGADDRESSDATANONADDRESS =
* OMMUNICATIONNOTESNONADDRESS =
* OMMUNICATIONUSAGENONADDRESS =
RETURN = LT_BAPIRET2.
* DDRESSDUPLICATES =
IF LT_BAPIRET2[] IS INITIAL.
CALL FUNCTION 'BUP_MEMORY_BUT000_GET'
EXPORTING
IV_PARTNER = L_BPARTNER
IMPORTING
ES_BUT000 = LT_GUID
EXCEPTIONS
NOT_FOUND = 1
PARAMETER_ERROR = 2
BPEXT_NOT_UNIQUE = 3
OTHERS = 4.
READ TABLE LT_GUID INDEX 1.
LT_CUSTO-PARTNR_GUID = LT_GUID-PARTNER_GUID.
APPEND LT_CUSTO.
CALL FUNCTION 'BUPA_CENTRAL_CI_CHANGE'
EXPORTING
IS_BUS000_EEW = LT_CUSTO.
IF SY-SUBRC EQ 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDIF.
ELSE.
CLEAR L_STR.
LOOP AT LT_BAPIRET2 WHERE TYPE = 'E'.
IF L_STR IS INITIAL.
L_STR = LT_BAPIRET2-MESSAGE.
ELSE.
CONCATENATE L_STR LT_BAPIRET2-MESSAGE INTO L_STR.
ENDIF.
ENDLOOP.
ENDIF.
*->添加银行数据
IF L_BPARTNER IS NOT INITIAL.
*->添加业务角色
CALL FUNCTION 'BAPI_BUPA_ROLE_ADD'
EXPORTING
BUSINESSPARTNER = L_BPARTNER
BUSINESSPARTNERROLE = L_ROLE
TABLES
RETURN = LT_RETURN.
CALL FUNCTION 'BAPI_BUPA_ROLE_ADD'
EXPORTING
BUSINESSPARTNER = L_BPARTNER
BUSINESSPARTNERROLE = 'FLVN01'
TABLES
RETURN = LT_RETURN.
LS_BANKDETAIL-BANK_CTRY = 'JP'.
LS_BANKDETAIL-BANK_KEY = '0001027'.
LS_BANKDETAIL-BANK_ACCT = '100122'.
LS_BANKDETAIL-BANKACCOUNTNAME = 'aaaa'.
LS_BANKDETAIL-CTRL_KEY = '01'.
LS_BANKDETAIL-ACCOUNTHOLDER = 'aa'.
CALL FUNCTION 'BAPI_BUPA_BANKDETAIL_ADD'
EXPORTING
BUSINESSPARTNER = L_BPARTNER
BANKDETAILDATA = LS_BANKDETAIL
TABLES
RETURN = LT_RETURN.
READ TABLE LT_RETURN INTO LS_RETURN WITH KEY TYPE = 'E'.
IF SY-SUBRC NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDIF.
ENDIF.
CLEAR LT_RETURN[].
DATA: LS_MASTER_DATA TYPE VMDS_EI_MAIN,
LS_MASTER_DATA_CORRECT TYPE VMDS_EI_MAIN,
LS_MESSAGE_CORRECT TYPE CVIS_MESSAGE,
LS_MASTER_DATA_DEFECTIVE TYPE VMDS_EI_MAIN,
LS_MESSAGE_DEFECTIVE TYPE CVIS_MESSAGE.
DATA: LT_VENDOR TYPE VMDS_EI_EXTERN_T,
LS_VENDOR TYPE VMDS_EI_EXTERN,
LS_PURCHASE_DATA TYPE VMDS_EI_VMD_PURCHASING,
LT_PURCHASE TYPE VMDS_EI_PURCHASING_T,
LS_PURCHASE TYPE VMDS_EI_PURCHASING,
LS_COMPANY TYPE VMDS_EI_COMPANY,
LT_FUNCTIONS TYPE STANDARD TABLE OF VMDS_EI_FUNCTIONS,
LS_FUNCTION TYPE VMDS_EI_FUNCTIONS.
REFRESH : LT_FUNCTIONS, LT_VENDOR.
CLEAR: LS_VENDOR, LS_PURCHASE_DATA.
LS_VENDOR-HEADER-OBJECT_INSTANCE-LIFNR = L_BPARTNER.
LS_VENDOR-HEADER-OBJECT_TASK = 'U'. " I/U/D
LS_PURCHASE_DATA-CURRENT_STATE = SPACE.
LS_VENDOR-CENTRAL_DATA-CENTRAL-DATA-KTOKK = 'SUPL'.
LS_VENDOR-CENTRAL_DATA-CENTRAL-DATAX-KTOKK = 'X'.
LS_COMPANY-TASK = 'I'.
LS_COMPANY-DATA_KEY-BUKRS = '1000'.
LS_COMPANY-DATA-AKONT = '0004142000'.
LS_COMPANY-DATAX-AKONT = 'X'.
APPEND LS_COMPANY TO LS_VENDOR-COMPANY_DATA-COMPANY.
LS_PURCHASE-TASK = 'I' .
LS_PURCHASE-DATA_KEY-EKORG = '1000'.
LS_PURCHASE-FUNCTIONS-CURRENT_STATE = SPACE.
LS_PURCHASE-DATA-WAERS = 'JPY'.
LS_PURCHASE-DATAX-WAERS = 'X'.
CLEAR LS_FUNCTION.
LS_FUNCTION-TASK = 'I'.
LS_FUNCTION-DATA_KEY-PARVW = 'LF'.
LS_FUNCTION-DATA-PARTNER = L_BPARTNER.
*ls_function-datax-partner = 'X'.
APPEND LS_FUNCTION TO LT_FUNCTIONS.
LS_FUNCTION-TASK = 'I'.
LS_FUNCTION-DATA_KEY-PARVW = 'RS'.
LS_FUNCTION-DATA-PARTNER = L_BPARTNER.
*ls_function-datax-partner = 'X'.
APPEND LS_FUNCTION TO LT_FUNCTIONS.
LS_PURCHASE-FUNCTIONS-FUNCTIONS = LT_FUNCTIONS[].
APPEND LS_PURCHASE TO LT_PURCHASE.
LS_PURCHASE_DATA-PURCHASING[] = LT_PURCHASE[].
LS_VENDOR-PURCHASING_DATA = LS_PURCHASE_DATA.
APPEND LS_VENDOR TO LT_VENDOR.
LS_MASTER_DATA-VENDORS = LT_VENDOR[].
VMD_EI_API=>INITIALIZE( ).
VMD_EI_API=>LOCK( IV_LIFNR = LS_VENDOR-HEADER-OBJECT_INSTANCE-LIFNR ).
CALL METHOD VMD_EI_API=>MAINTAIN_BAPI
EXPORTING
IV_TEST_RUN = SPACE
* IV_COLLECT_MESSAGES = SPACE
IS_MASTER_DATA = LS_MASTER_DATA
IMPORTING
ES_MASTER_DATA_CORRECT = LS_MASTER_DATA_CORRECT
ES_MESSAGE_CORRECT = LS_MESSAGE_CORRECT
ES_MASTER_DATA_DEFECTIVE = LS_MASTER_DATA_DEFECTIVE
ES_MESSAGE_DEFECTIVE = LS_MESSAGE_DEFECTIVE.
IF LS_MESSAGE_DEFECTIVE IS INITIAL.
BREAK-POINT.
COMMIT WORK.
ELSE.
BREAK-POINT.
ENDIF.
VMD_EI_API=>UNLOCK( IV_LIFNR = LS_VENDOR-HEADER-OBJECT_INSTANCE-LIFNR ).
DATA:L_PARTN_CAT TYPE BAPIBUS1006_HEAD-PARTN_CAT,
LS_CENTRAL TYPE BAPIBUS1006_CENTRAL,
LS_PARTN_GROUP TYPE BAPIBUS1006_HEAD,
LS_CENTRAL_PERSON TYPE BAPIBUS1006_CENTRAL_PERSON,
LS_CENTRAL_ORGAN TYPE BAPIBUS1006_CENTRAL_ORGAN,
L_PARTN_GRP TYPE BAPIBUS1006_HEAD-PARTN_GRP,
LS_CENTRAL_GROUP TYPE BAPIBUS1006_CENTRAL_GROUP,
LS_ADDRESS TYPE BAPIBUS1006_ADDRESS,
L_BPARTNER TYPE BAPIBUS1006_HEAD-BPARTNER,
LT_BAPIADTEL LIKE TABLE OF BAPIADTEL WITH HEADER LINE,
LT_BAPIRET2 LIKE TABLE OF BAPIRET2 WITH HEADER LINE,
LT_GUID LIKE TABLE OF BUS000___I WITH HEADER LINE,
LT_CUSTO TYPE TABLE OF BUS000_EEW WITH HEADER LINE.
DATA:LS_BUT0BK TYPE BUT0BK,
LV_BKVID TYPE BUT0BK-BKVID,
LV_TYPE TYPE CHAR1,
L_STR TYPE STRING,
L_ROLE TYPE BAPIBUS1006_HEAD-PARTNERROLE VALUE 'FLVN00'.
DATA:LS_BANKDETAIL TYPE BAPIBUS1006_BANKDETAIL.
DATA:LS_BANKDETAIL_X TYPE BAPIBUS1006_BANKDETAIL_X.
DATA:LT_RETURN TYPE TABLE OF BAPIRET2.
DATA:LS_RETURN TYPE BAPIRET2.
L_PARTN_CAT = '2'.
LS_CENTRAL_ORGAN-NAME1 = 'aaa'.
LS_CENTRAL-SEARCHTERM1 = 'aaa'.
LS_CENTRAL_ORGAN-FOUNDATIONDATE = '20190220'.
LS_ADDRESS-COUNTRY = 'JP'.
LS_ADDRESS-CITY = 'TOKYO'.
LS_ADDRESS-POSTL_COD1 = '270-2261'.
LS_ADDRESS-STREET = 'aaa'.
L_PARTN_GRP = 'Z001'.
CLEAR LT_BAPIADTEL.
LT_BAPIADTEL-COUNTRY = 'JP'.
LT_BAPIADTEL-STD_NO = 'X'.
"電話
LT_BAPIADTEL-TELEPHONE = '010-84522355'.
APPEND LT_BAPIADTEL.
LS_ADDRESS-LANGU = '1'.
LS_ADDRESS-STREET = 'BACK STRET'.
CALL FUNCTION 'BAPI_BUPA_CREATE_FROM_DATA'
EXPORTING
* USINESSPARTNEREXTERN =
BUSINESSPARTNEREXTERN = '0000999962'
PARTNERCATEGORY = L_PARTN_CAT
PARTNERGROUP = L_PARTN_GRP
CENTRALDATA = LS_CENTRAL
CENTRALDATAPERSON = LS_CENTRAL_PERSON
CENTRALDATAORGANIZATION = LS_CENTRAL_ORGAN
CENTRALDATAGROUP = LS_CENTRAL_GROUP
ADDRESSDATA = LS_ADDRESS
* UPLICATE_MESSAGE_TYPE =
* CCEPT_ERROR = ' '
IMPORTING
BUSINESSPARTNER = L_BPARTNER
TABLES
TELEFONDATA = LT_BAPIADTEL
* AXDATA =
* ELETEXDATA =
* ELEXDATA =
* _MAILDATA =
* MLADDRESSDATA =
* 400ADDRESSDATA =
* FCADDRESSDATA =
* RTADDRESSDATA =
* SFADDRESSDATA =
* RIADDRESSDATA =
* AGADDRESSDATA =
* DDRESSNOTES =
* OMMUNICATIONNOTES =
* OMMUNICATIONUSAGE =
* ELEFONDATANONADDRESS =
* AXDATANONADDRESS =
* ELETEXDATANONADDRESS =
* ELEXDATANONADDRESS =
* _MAILDATANONADDRESS =
* MLADDRESSDATANONADDRESS =
* 400ADDRESSDATANONADDRESS =
* FCADDRESSDATANONADDRESS =
* RTADDRESSDATANONADDRESS =
* SFADDRESSDATANONADDRESS =
* RIADDRESSDATANONADDRESS =
* AGADDRESSDATANONADDRESS =
* OMMUNICATIONNOTESNONADDRESS =
* OMMUNICATIONUSAGENONADDRESS =
RETURN = LT_BAPIRET2.
* DDRESSDUPLICATES =
IF LT_BAPIRET2[] IS INITIAL.
CALL FUNCTION 'BUP_MEMORY_BUT000_GET'
EXPORTING
IV_PARTNER = L_BPARTNER
IMPORTING
ES_BUT000 = LT_GUID
EXCEPTIONS
NOT_FOUND = 1
PARAMETER_ERROR = 2
BPEXT_NOT_UNIQUE = 3
OTHERS = 4.
READ TABLE LT_GUID INDEX 1.
LT_CUSTO-PARTNR_GUID = LT_GUID-PARTNER_GUID.
APPEND LT_CUSTO.
CALL FUNCTION 'BUPA_CENTRAL_CI_CHANGE'
EXPORTING
IS_BUS000_EEW = LT_CUSTO.
IF SY-SUBRC EQ 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDIF.
ELSE.
CLEAR L_STR.
LOOP AT LT_BAPIRET2 WHERE TYPE = 'E'.
IF L_STR IS INITIAL.
L_STR = LT_BAPIRET2-MESSAGE.
ELSE.
CONCATENATE L_STR LT_BAPIRET2-MESSAGE INTO L_STR.
ENDIF.
ENDLOOP.
ENDIF.
*->添加银行数据
IF L_BPARTNER IS NOT INITIAL.
*->添加业务角色
CALL FUNCTION 'BAPI_BUPA_ROLE_ADD'
EXPORTING
BUSINESSPARTNER = L_BPARTNER
BUSINESSPARTNERROLE = L_ROLE
TABLES
RETURN = LT_RETURN.
CALL FUNCTION 'BAPI_BUPA_ROLE_ADD'
EXPORTING
BUSINESSPARTNER = L_BPARTNER
BUSINESSPARTNERROLE = 'FLVN01'
TABLES
RETURN = LT_RETURN.
LS_BANKDETAIL-BANK_CTRY = 'JP'.
LS_BANKDETAIL-BANK_KEY = '0001027'.
LS_BANKDETAIL-BANK_ACCT = '100122'.
LS_BANKDETAIL-BANKACCOUNTNAME = 'aaaa'.
LS_BANKDETAIL-CTRL_KEY = '01'.
LS_BANKDETAIL-ACCOUNTHOLDER = 'aa'.
CALL FUNCTION 'BAPI_BUPA_BANKDETAIL_ADD'
EXPORTING
BUSINESSPARTNER = L_BPARTNER
BANKDETAILDATA = LS_BANKDETAIL
TABLES
RETURN = LT_RETURN.
READ TABLE LT_RETURN INTO LS_RETURN WITH KEY TYPE = 'E'.
IF SY-SUBRC NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDIF.
ENDIF.
CLEAR LT_RETURN[].
DATA: LS_MASTER_DATA TYPE VMDS_EI_MAIN,
LS_MASTER_DATA_CORRECT TYPE VMDS_EI_MAIN,
LS_MESSAGE_CORRECT TYPE CVIS_MESSAGE,
LS_MASTER_DATA_DEFECTIVE TYPE VMDS_EI_MAIN,
LS_MESSAGE_DEFECTIVE TYPE CVIS_MESSAGE.
DATA: LT_VENDOR TYPE VMDS_EI_EXTERN_T,
LS_VENDOR TYPE VMDS_EI_EXTERN,
LS_PURCHASE_DATA TYPE VMDS_EI_VMD_PURCHASING,
LT_PURCHASE TYPE VMDS_EI_PURCHASING_T,
LS_PURCHASE TYPE VMDS_EI_PURCHASING,
LS_COMPANY TYPE VMDS_EI_COMPANY,
LT_FUNCTIONS TYPE STANDARD TABLE OF VMDS_EI_FUNCTIONS,
LS_FUNCTION TYPE VMDS_EI_FUNCTIONS.
REFRESH : LT_FUNCTIONS, LT_VENDOR.
CLEAR: LS_VENDOR, LS_PURCHASE_DATA.
LS_VENDOR-HEADER-OBJECT_INSTANCE-LIFNR = L_BPARTNER.
LS_VENDOR-HEADER-OBJECT_TASK = 'U'. " I/U/D
LS_PURCHASE_DATA-CURRENT_STATE = SPACE.
LS_VENDOR-CENTRAL_DATA-CENTRAL-DATA-KTOKK = 'SUPL'.
LS_VENDOR-CENTRAL_DATA-CENTRAL-DATAX-KTOKK = 'X'.
LS_COMPANY-TASK = 'I'.
LS_COMPANY-DATA_KEY-BUKRS = '1000'.
LS_COMPANY-DATA-AKONT = '0004142000'.
LS_COMPANY-DATAX-AKONT = 'X'.
APPEND LS_COMPANY TO LS_VENDOR-COMPANY_DATA-COMPANY.
LS_PURCHASE-TASK = 'I' .
LS_PURCHASE-DATA_KEY-EKORG = '1000'.
LS_PURCHASE-FUNCTIONS-CURRENT_STATE = SPACE.
LS_PURCHASE-DATA-WAERS = 'JPY'.
LS_PURCHASE-DATAX-WAERS = 'X'.
CLEAR LS_FUNCTION.
LS_FUNCTION-TASK = 'I'.
LS_FUNCTION-DATA_KEY-PARVW = 'LF'.
LS_FUNCTION-DATA-PARTNER = L_BPARTNER.
*ls_function-datax-partner = 'X'.
APPEND LS_FUNCTION TO LT_FUNCTIONS.
LS_FUNCTION-TASK = 'I'.
LS_FUNCTION-DATA_KEY-PARVW = 'RS'.
LS_FUNCTION-DATA-PARTNER = L_BPARTNER.
*ls_function-datax-partner = 'X'.
APPEND LS_FUNCTION TO LT_FUNCTIONS.
LS_PURCHASE-FUNCTIONS-FUNCTIONS = LT_FUNCTIONS[].
APPEND LS_PURCHASE TO LT_PURCHASE.
LS_PURCHASE_DATA-PURCHASING[] = LT_PURCHASE[].
LS_VENDOR-PURCHASING_DATA = LS_PURCHASE_DATA.
APPEND LS_VENDOR TO LT_VENDOR.
LS_MASTER_DATA-VENDORS = LT_VENDOR[].
VMD_EI_API=>INITIALIZE( ).
VMD_EI_API=>LOCK( IV_LIFNR = LS_VENDOR-HEADER-OBJECT_INSTANCE-LIFNR ).
CALL METHOD VMD_EI_API=>MAINTAIN_BAPI
EXPORTING
IV_TEST_RUN = SPACE
* IV_COLLECT_MESSAGES = SPACE
IS_MASTER_DATA = LS_MASTER_DATA
IMPORTING
ES_MASTER_DATA_CORRECT = LS_MASTER_DATA_CORRECT
ES_MESSAGE_CORRECT = LS_MESSAGE_CORRECT
ES_MASTER_DATA_DEFECTIVE = LS_MASTER_DATA_DEFECTIVE
ES_MESSAGE_DEFECTIVE = LS_MESSAGE_DEFECTIVE.
IF LS_MESSAGE_DEFECTIVE IS INITIAL.
BREAK-POINT.
COMMIT WORK.
ELSE.
BREAK-POINT.
ENDIF.
VMD_EI_API=>UNLOCK( IV_LIFNR = LS_VENDOR-HEADER-OBJECT_INSTANCE-LIFNR ).
BP Ceate Customer
REPORT ZBPADD2.
DATA:L_PARTN_CAT TYPE BAPIBUS1006_HEAD-PARTN_CAT,
LS_CENTRAL TYPE BAPIBUS1006_CENTRAL,
LS_PARTN_GROUP TYPE BAPIBUS1006_HEAD,
LS_CENTRAL_PERSON TYPE BAPIBUS1006_CENTRAL_PERSON,
LS_CENTRAL_ORGAN TYPE BAPIBUS1006_CENTRAL_ORGAN,
L_PARTN_GRP TYPE BAPIBUS1006_HEAD-PARTN_GRP,
LS_CENTRAL_GROUP TYPE BAPIBUS1006_CENTRAL_GROUP,
LS_ADDRESS TYPE BAPIBUS1006_ADDRESS,
L_BPARTNER TYPE BAPIBUS1006_HEAD-BPARTNER,
LT_BAPIADTEL LIKE TABLE OF BAPIADTEL WITH HEADER LINE,
LT_BAPIRET2 LIKE TABLE OF BAPIRET2 WITH HEADER LINE,
LT_GUID LIKE TABLE OF BUS000___I WITH HEADER LINE,
LT_CUSTO TYPE TABLE OF BUS000_EEW WITH HEADER LINE.
DATA:LS_BUT0BK TYPE BUT0BK,
LV_BKVID TYPE BUT0BK-BKVID,
LV_TYPE TYPE CHAR1,
L_STR TYPE STRING,
L_ROLE TYPE BAPIBUS1006_HEAD-PARTNERROLE VALUE 'FLCU00'.
DATA:LS_BANKDETAIL TYPE BAPIBUS1006_BANKDETAIL.
DATA:LS_BANKDETAIL_X TYPE BAPIBUS1006_BANKDETAIL_X.
DATA:LT_RETURN TYPE TABLE OF BAPIRET2.
DATA:LS_RETURN TYPE BAPIRET2.
L_PARTN_CAT = '2'.
LS_CENTRAL_ORGAN-NAME1 = 'aaa'.
LS_CENTRAL-SEARCHTERM1 = 'aaa'.
LS_CENTRAL_ORGAN-FOUNDATIONDATE = '20190220'.
LS_ADDRESS-COUNTRY = 'JP'.
LS_ADDRESS-CITY = 'TOKYO'.
LS_ADDRESS-POSTL_COD1 = '270-2261'.
LS_ADDRESS-STREET = 'aaa'.
L_PARTN_GRP = 'Z001'.
CLEAR LT_BAPIADTEL.
LT_BAPIADTEL-COUNTRY = 'JP'.
LT_BAPIADTEL-STD_NO = 'X'.
LT_BAPIADTEL-TELEPHONE = '010-84522355'.
APPEND LT_BAPIADTEL.
LS_ADDRESS-LANGU = '1'.
LS_ADDRESS-STREET = 'BACK STRET'.
CALL FUNCTION 'BAPI_BUPA_CREATE_FROM_DATA'
EXPORTING
* USINESSPARTNEREXTERN =
BUSINESSPARTNEREXTERN = '0000999966'
PARTNERCATEGORY = L_PARTN_CAT
PARTNERGROUP = L_PARTN_GRP
CENTRALDATA = LS_CENTRAL
CENTRALDATAPERSON = LS_CENTRAL_PERSON
CENTRALDATAORGANIZATION = LS_CENTRAL_ORGAN
CENTRALDATAGROUP = LS_CENTRAL_GROUP
ADDRESSDATA = LS_ADDRESS
* UPLICATE_MESSAGE_TYPE =
* CCEPT_ERROR = ' '
IMPORTING
BUSINESSPARTNER = L_BPARTNER
TABLES
TELEFONDATA = LT_BAPIADTEL
* AXDATA =
* ELETEXDATA =
* ELEXDATA =
* _MAILDATA =
* MLADDRESSDATA =
* 400ADDRESSDATA =
* FCADDRESSDATA =
* RTADDRESSDATA =
* SFADDRESSDATA =
* RIADDRESSDATA =
* AGADDRESSDATA =
* DDRESSNOTES =
* OMMUNICATIONNOTES =
* OMMUNICATIONUSAGE =
* ELEFONDATANONADDRESS =
* AXDATANONADDRESS =
* ELETEXDATANONADDRESS =
* ELEXDATANONADDRESS =
* _MAILDATANONADDRESS =
* MLADDRESSDATANONADDRESS =
* 400ADDRESSDATANONADDRESS =
* FCADDRESSDATANONADDRESS =
* RTADDRESSDATANONADDRESS =
* SFADDRESSDATANONADDRESS =
* RIADDRESSDATANONADDRESS =
* AGADDRESSDATANONADDRESS =
* OMMUNICATIONNOTESNONADDRESS =
* OMMUNICATIONUSAGENONADDRESS =
RETURN = LT_BAPIRET2
* DDRESSDUPLICATES =
.
IF LT_BAPIRET2[] IS INITIAL.
CALL FUNCTION 'BUP_MEMORY_BUT000_GET'
EXPORTING
IV_PARTNER = L_BPARTNER
IMPORTING
ES_BUT000 = LT_GUID
EXCEPTIONS
NOT_FOUND = 1
PARAMETER_ERROR = 2
BPEXT_NOT_UNIQUE = 3
OTHERS = 4.
READ TABLE LT_GUID INDEX 1.
LT_CUSTO-PARTNR_GUID = LT_GUID-PARTNER_GUID.
APPEND LT_CUSTO.
CALL FUNCTION 'BUPA_CENTRAL_CI_CHANGE'
EXPORTING
IS_BUS000_EEW = LT_CUSTO.
IF SY-SUBRC EQ 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDIF.
ELSE.
CLEAR L_STR.
LOOP AT LT_BAPIRET2 WHERE TYPE = 'E'.
IF L_STR IS INITIAL.
L_STR = LT_BAPIRET2-MESSAGE.
ELSE.
CONCATENATE L_STR LT_BAPIRET2-MESSAGE INTO L_STR.
ENDIF.
ENDLOOP.
ENDIF.
IF L_BPARTNER IS NOT INITIAL.
*->ADD ROLE
CALL FUNCTION 'BAPI_BUPA_ROLE_ADD'
EXPORTING
BUSINESSPARTNER = L_BPARTNER
BUSINESSPARTNERROLE = L_ROLE
TABLES
RETURN = LT_RETURN.
CALL FUNCTION 'BAPI_BUPA_ROLE_ADD'
EXPORTING
BUSINESSPARTNER = L_BPARTNER
BUSINESSPARTNERROLE = 'FLCU01'
TABLES
RETURN = LT_RETURN.
LS_BANKDETAIL-BANK_CTRY = 'JP'.
LS_BANKDETAIL-BANK_KEY = '0001027'.
LS_BANKDETAIL-BANK_ACCT = '100122'.
LS_BANKDETAIL-BANKACCOUNTNAME = 'aaaa'.
LS_BANKDETAIL-CTRL_KEY = '01'.
LS_BANKDETAIL-ACCOUNTHOLDER = 'aa'.
CALL FUNCTION 'BAPI_BUPA_BANKDETAIL_ADD'
EXPORTING
BUSINESSPARTNER = L_BPARTNER
BANKDETAILDATA = LS_BANKDETAIL
TABLES
RETURN = LT_RETURN.
READ TABLE LT_RETURN INTO LS_RETURN WITH KEY TYPE = 'E'.
IF SY-SUBRC NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDIF.
ENDIF.
CLEAR LT_RETURN[].
* CALL FUNCTION 'BAPI_BUPA_TAX_ADD'
* EXPORTING
* businesspartner = l_bpartner
* taxtype = 'CN0'
* taxnumber = ps_in-stceg
* TABLES
* return = lt_return.
* READ TABLE lt_return INTO ls_return WITH KEY type = 'E'.
* IF sy-subrc NE 0.
* CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* wait = 'X'.
* ENDIF.
*
DATA: LS_MASTER_DATA TYPE CMDS_EI_MAIN,
LS_MASTER_DATA_CORRECT TYPE CMDS_EI_MAIN,
LS_MESSAGE_CORRECT TYPE CVIS_MESSAGE,
LS_MASTER_DATA_DEFECTIVE TYPE CMDS_EI_MAIN,
LS_MESSAGE_DEFECTIVE TYPE CVIS_MESSAGE.
DATA: LT_CUSTOMERS TYPE CMDS_EI_EXTERN_T,
LS_CUSTOMER TYPE CMDS_EI_EXTERN,
LS_SALES_DATA TYPE CMDS_EI_CMD_SALES,
LT_SALES TYPE CMDS_EI_SALES_T,
LS_SALES TYPE CMDS_EI_SALES,
LS_COMPANY TYPE CMDS_EI_COMPANY,
LT_FUNCTIONS TYPE CMDS_EI_FUNCTIONS_T,
LS_FUNCTION TYPE CMDS_EI_FUNCTIONS.
REFRESH : LT_FUNCTIONS, LT_SALES.
CLEAR: LS_CUSTOMER, LS_SALES_DATA.
LS_CUSTOMER-HEADER-OBJECT_INSTANCE-KUNNR = L_BPARTNER.
LS_CUSTOMER-HEADER-OBJECT_TASK = 'U'. " I/U/D
LS_SALES_DATA-CURRENT_STATE = SPACE.
LS_COMPANY-TASK = 'I'.
LS_COMPANY-DATA_KEY-BUKRS = '1000'.
LS_COMPANY-DATA-AKONT = '0001141000'.
LS_COMPANY-DATAX-AKONT = 'X'.
APPEND LS_COMPANY TO LS_CUSTOMER-COMPANY_DATA-COMPANY.
LS_SALES-TASK = 'I' .
LS_SALES-DATA_KEY-VKORG = '1000'.
LS_SALES-DATA_KEY-VTWEG = '10'.
LS_SALES-DATA_KEY-SPART = '10'.
LS_SALES-FUNCTIONS-CURRENT_STATE = SPACE.
LS_SALES-DATA-WAERS = 'JPY'.
LS_SALES-DATAX-WAERS = 'X'.
CLEAR LS_FUNCTION.
LS_FUNCTION-TASK = 'I'.
LS_FUNCTION-DATA_KEY-PARVW = 'AG'.
LS_FUNCTION-DATA-PARTNER = L_BPARTNER.
*ls_function-datax-partner = 'X'.
APPEND LS_FUNCTION TO LT_FUNCTIONS.
LS_FUNCTION-TASK = 'I'.
LS_FUNCTION-DATA_KEY-PARVW = 'RE'.
LS_FUNCTION-DATA-PARTNER = L_BPARTNER.
*ls_function-datax-partner = 'X'.
APPEND LS_FUNCTION TO LT_FUNCTIONS.
LS_FUNCTION-TASK = 'I'.
LS_FUNCTION-DATA_KEY-PARVW = 'RG'.
LS_FUNCTION-DATA-PARTNER = L_BPARTNER.
*ls_function-datax-partner = 'X'.
APPEND LS_FUNCTION TO LT_FUNCTIONS.
LS_FUNCTION-TASK = 'I'.
LS_FUNCTION-DATA_KEY-PARVW = 'WE'.
LS_FUNCTION-DATA-PARTNER = L_BPARTNER.
*ls_function-datax-partner = 'X'.
APPEND LS_FUNCTION TO LT_FUNCTIONS.
LS_SALES-FUNCTIONS-FUNCTIONS = LT_FUNCTIONS[].
APPEND LS_SALES TO LT_SALES.
LS_SALES_DATA-SALES[] = LT_SALES[].
LS_CUSTOMER-SALES_DATA = LS_SALES_DATA.
APPEND LS_CUSTOMER TO LT_CUSTOMERS.
LS_MASTER_DATA-CUSTOMERS = LT_CUSTOMERS[].
CMD_EI_API=>INITIALIZE( ).
CMD_EI_API=>LOCK( IV_KUNNR = LS_CUSTOMER-HEADER-OBJECT_INSTANCE-KUNNR ).
CALL METHOD CMD_EI_API=>MAINTAIN_BAPI
EXPORTING
IV_TEST_RUN = SPACE
IV_COLLECT_MESSAGES = 'X'
IS_MASTER_DATA = LS_MASTER_DATA
IMPORTING
ES_MASTER_DATA_CORRECT = LS_MASTER_DATA_CORRECT
ES_MESSAGE_CORRECT = LS_MESSAGE_CORRECT
ES_MASTER_DATA_DEFECTIVE = LS_MASTER_DATA_DEFECTIVE
ES_MESSAGE_DEFECTIVE = LS_MESSAGE_DEFECTIVE.
IF LS_MESSAGE_DEFECTIVE IS INITIAL.
BREAK-POINT.
COMMIT WORK.
ELSE.
BREAK-POINT.
ENDIF.
CMD_EI_API=>UNLOCK( IV_KUNNR = LS_CUSTOMER-HEADER-OBJECT_INSTANCE-KUNNR ).
DATA:L_PARTN_CAT TYPE BAPIBUS1006_HEAD-PARTN_CAT,
LS_CENTRAL TYPE BAPIBUS1006_CENTRAL,
LS_PARTN_GROUP TYPE BAPIBUS1006_HEAD,
LS_CENTRAL_PERSON TYPE BAPIBUS1006_CENTRAL_PERSON,
LS_CENTRAL_ORGAN TYPE BAPIBUS1006_CENTRAL_ORGAN,
L_PARTN_GRP TYPE BAPIBUS1006_HEAD-PARTN_GRP,
LS_CENTRAL_GROUP TYPE BAPIBUS1006_CENTRAL_GROUP,
LS_ADDRESS TYPE BAPIBUS1006_ADDRESS,
L_BPARTNER TYPE BAPIBUS1006_HEAD-BPARTNER,
LT_BAPIADTEL LIKE TABLE OF BAPIADTEL WITH HEADER LINE,
LT_BAPIRET2 LIKE TABLE OF BAPIRET2 WITH HEADER LINE,
LT_GUID LIKE TABLE OF BUS000___I WITH HEADER LINE,
LT_CUSTO TYPE TABLE OF BUS000_EEW WITH HEADER LINE.
DATA:LS_BUT0BK TYPE BUT0BK,
LV_BKVID TYPE BUT0BK-BKVID,
LV_TYPE TYPE CHAR1,
L_STR TYPE STRING,
L_ROLE TYPE BAPIBUS1006_HEAD-PARTNERROLE VALUE 'FLCU00'.
DATA:LS_BANKDETAIL TYPE BAPIBUS1006_BANKDETAIL.
DATA:LS_BANKDETAIL_X TYPE BAPIBUS1006_BANKDETAIL_X.
DATA:LT_RETURN TYPE TABLE OF BAPIRET2.
DATA:LS_RETURN TYPE BAPIRET2.
L_PARTN_CAT = '2'.
LS_CENTRAL_ORGAN-NAME1 = 'aaa'.
LS_CENTRAL-SEARCHTERM1 = 'aaa'.
LS_CENTRAL_ORGAN-FOUNDATIONDATE = '20190220'.
LS_ADDRESS-COUNTRY = 'JP'.
LS_ADDRESS-CITY = 'TOKYO'.
LS_ADDRESS-POSTL_COD1 = '270-2261'.
LS_ADDRESS-STREET = 'aaa'.
L_PARTN_GRP = 'Z001'.
CLEAR LT_BAPIADTEL.
LT_BAPIADTEL-COUNTRY = 'JP'.
LT_BAPIADTEL-STD_NO = 'X'.
LT_BAPIADTEL-TELEPHONE = '010-84522355'.
APPEND LT_BAPIADTEL.
LS_ADDRESS-LANGU = '1'.
LS_ADDRESS-STREET = 'BACK STRET'.
CALL FUNCTION 'BAPI_BUPA_CREATE_FROM_DATA'
EXPORTING
* USINESSPARTNEREXTERN =
BUSINESSPARTNEREXTERN = '0000999966'
PARTNERCATEGORY = L_PARTN_CAT
PARTNERGROUP = L_PARTN_GRP
CENTRALDATA = LS_CENTRAL
CENTRALDATAPERSON = LS_CENTRAL_PERSON
CENTRALDATAORGANIZATION = LS_CENTRAL_ORGAN
CENTRALDATAGROUP = LS_CENTRAL_GROUP
ADDRESSDATA = LS_ADDRESS
* UPLICATE_MESSAGE_TYPE =
* CCEPT_ERROR = ' '
IMPORTING
BUSINESSPARTNER = L_BPARTNER
TABLES
TELEFONDATA = LT_BAPIADTEL
* AXDATA =
* ELETEXDATA =
* ELEXDATA =
* _MAILDATA =
* MLADDRESSDATA =
* 400ADDRESSDATA =
* FCADDRESSDATA =
* RTADDRESSDATA =
* SFADDRESSDATA =
* RIADDRESSDATA =
* AGADDRESSDATA =
* DDRESSNOTES =
* OMMUNICATIONNOTES =
* OMMUNICATIONUSAGE =
* ELEFONDATANONADDRESS =
* AXDATANONADDRESS =
* ELETEXDATANONADDRESS =
* ELEXDATANONADDRESS =
* _MAILDATANONADDRESS =
* MLADDRESSDATANONADDRESS =
* 400ADDRESSDATANONADDRESS =
* FCADDRESSDATANONADDRESS =
* RTADDRESSDATANONADDRESS =
* SFADDRESSDATANONADDRESS =
* RIADDRESSDATANONADDRESS =
* AGADDRESSDATANONADDRESS =
* OMMUNICATIONNOTESNONADDRESS =
* OMMUNICATIONUSAGENONADDRESS =
RETURN = LT_BAPIRET2
* DDRESSDUPLICATES =
.
IF LT_BAPIRET2[] IS INITIAL.
CALL FUNCTION 'BUP_MEMORY_BUT000_GET'
EXPORTING
IV_PARTNER = L_BPARTNER
IMPORTING
ES_BUT000 = LT_GUID
EXCEPTIONS
NOT_FOUND = 1
PARAMETER_ERROR = 2
BPEXT_NOT_UNIQUE = 3
OTHERS = 4.
READ TABLE LT_GUID INDEX 1.
LT_CUSTO-PARTNR_GUID = LT_GUID-PARTNER_GUID.
APPEND LT_CUSTO.
CALL FUNCTION 'BUPA_CENTRAL_CI_CHANGE'
EXPORTING
IS_BUS000_EEW = LT_CUSTO.
IF SY-SUBRC EQ 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDIF.
ELSE.
CLEAR L_STR.
LOOP AT LT_BAPIRET2 WHERE TYPE = 'E'.
IF L_STR IS INITIAL.
L_STR = LT_BAPIRET2-MESSAGE.
ELSE.
CONCATENATE L_STR LT_BAPIRET2-MESSAGE INTO L_STR.
ENDIF.
ENDLOOP.
ENDIF.
IF L_BPARTNER IS NOT INITIAL.
*->ADD ROLE
CALL FUNCTION 'BAPI_BUPA_ROLE_ADD'
EXPORTING
BUSINESSPARTNER = L_BPARTNER
BUSINESSPARTNERROLE = L_ROLE
TABLES
RETURN = LT_RETURN.
CALL FUNCTION 'BAPI_BUPA_ROLE_ADD'
EXPORTING
BUSINESSPARTNER = L_BPARTNER
BUSINESSPARTNERROLE = 'FLCU01'
TABLES
RETURN = LT_RETURN.
LS_BANKDETAIL-BANK_CTRY = 'JP'.
LS_BANKDETAIL-BANK_KEY = '0001027'.
LS_BANKDETAIL-BANK_ACCT = '100122'.
LS_BANKDETAIL-BANKACCOUNTNAME = 'aaaa'.
LS_BANKDETAIL-CTRL_KEY = '01'.
LS_BANKDETAIL-ACCOUNTHOLDER = 'aa'.
CALL FUNCTION 'BAPI_BUPA_BANKDETAIL_ADD'
EXPORTING
BUSINESSPARTNER = L_BPARTNER
BANKDETAILDATA = LS_BANKDETAIL
TABLES
RETURN = LT_RETURN.
READ TABLE LT_RETURN INTO LS_RETURN WITH KEY TYPE = 'E'.
IF SY-SUBRC NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDIF.
ENDIF.
CLEAR LT_RETURN[].
* CALL FUNCTION 'BAPI_BUPA_TAX_ADD'
* EXPORTING
* businesspartner = l_bpartner
* taxtype = 'CN0'
* taxnumber = ps_in-stceg
* TABLES
* return = lt_return.
* READ TABLE lt_return INTO ls_return WITH KEY type = 'E'.
* IF sy-subrc NE 0.
* CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* wait = 'X'.
* ENDIF.
*
DATA: LS_MASTER_DATA TYPE CMDS_EI_MAIN,
LS_MASTER_DATA_CORRECT TYPE CMDS_EI_MAIN,
LS_MESSAGE_CORRECT TYPE CVIS_MESSAGE,
LS_MASTER_DATA_DEFECTIVE TYPE CMDS_EI_MAIN,
LS_MESSAGE_DEFECTIVE TYPE CVIS_MESSAGE.
DATA: LT_CUSTOMERS TYPE CMDS_EI_EXTERN_T,
LS_CUSTOMER TYPE CMDS_EI_EXTERN,
LS_SALES_DATA TYPE CMDS_EI_CMD_SALES,
LT_SALES TYPE CMDS_EI_SALES_T,
LS_SALES TYPE CMDS_EI_SALES,
LS_COMPANY TYPE CMDS_EI_COMPANY,
LT_FUNCTIONS TYPE CMDS_EI_FUNCTIONS_T,
LS_FUNCTION TYPE CMDS_EI_FUNCTIONS.
REFRESH : LT_FUNCTIONS, LT_SALES.
CLEAR: LS_CUSTOMER, LS_SALES_DATA.
LS_CUSTOMER-HEADER-OBJECT_INSTANCE-KUNNR = L_BPARTNER.
LS_CUSTOMER-HEADER-OBJECT_TASK = 'U'. " I/U/D
LS_SALES_DATA-CURRENT_STATE = SPACE.
LS_COMPANY-TASK = 'I'.
LS_COMPANY-DATA_KEY-BUKRS = '1000'.
LS_COMPANY-DATA-AKONT = '0001141000'.
LS_COMPANY-DATAX-AKONT = 'X'.
APPEND LS_COMPANY TO LS_CUSTOMER-COMPANY_DATA-COMPANY.
LS_SALES-TASK = 'I' .
LS_SALES-DATA_KEY-VKORG = '1000'.
LS_SALES-DATA_KEY-VTWEG = '10'.
LS_SALES-DATA_KEY-SPART = '10'.
LS_SALES-FUNCTIONS-CURRENT_STATE = SPACE.
LS_SALES-DATA-WAERS = 'JPY'.
LS_SALES-DATAX-WAERS = 'X'.
CLEAR LS_FUNCTION.
LS_FUNCTION-TASK = 'I'.
LS_FUNCTION-DATA_KEY-PARVW = 'AG'.
LS_FUNCTION-DATA-PARTNER = L_BPARTNER.
*ls_function-datax-partner = 'X'.
APPEND LS_FUNCTION TO LT_FUNCTIONS.
LS_FUNCTION-TASK = 'I'.
LS_FUNCTION-DATA_KEY-PARVW = 'RE'.
LS_FUNCTION-DATA-PARTNER = L_BPARTNER.
*ls_function-datax-partner = 'X'.
APPEND LS_FUNCTION TO LT_FUNCTIONS.
LS_FUNCTION-TASK = 'I'.
LS_FUNCTION-DATA_KEY-PARVW = 'RG'.
LS_FUNCTION-DATA-PARTNER = L_BPARTNER.
*ls_function-datax-partner = 'X'.
APPEND LS_FUNCTION TO LT_FUNCTIONS.
LS_FUNCTION-TASK = 'I'.
LS_FUNCTION-DATA_KEY-PARVW = 'WE'.
LS_FUNCTION-DATA-PARTNER = L_BPARTNER.
*ls_function-datax-partner = 'X'.
APPEND LS_FUNCTION TO LT_FUNCTIONS.
LS_SALES-FUNCTIONS-FUNCTIONS = LT_FUNCTIONS[].
APPEND LS_SALES TO LT_SALES.
LS_SALES_DATA-SALES[] = LT_SALES[].
LS_CUSTOMER-SALES_DATA = LS_SALES_DATA.
APPEND LS_CUSTOMER TO LT_CUSTOMERS.
LS_MASTER_DATA-CUSTOMERS = LT_CUSTOMERS[].
CMD_EI_API=>INITIALIZE( ).
CMD_EI_API=>LOCK( IV_KUNNR = LS_CUSTOMER-HEADER-OBJECT_INSTANCE-KUNNR ).
CALL METHOD CMD_EI_API=>MAINTAIN_BAPI
EXPORTING
IV_TEST_RUN = SPACE
IV_COLLECT_MESSAGES = 'X'
IS_MASTER_DATA = LS_MASTER_DATA
IMPORTING
ES_MASTER_DATA_CORRECT = LS_MASTER_DATA_CORRECT
ES_MESSAGE_CORRECT = LS_MESSAGE_CORRECT
ES_MASTER_DATA_DEFECTIVE = LS_MASTER_DATA_DEFECTIVE
ES_MESSAGE_DEFECTIVE = LS_MESSAGE_DEFECTIVE.
IF LS_MESSAGE_DEFECTIVE IS INITIAL.
BREAK-POINT.
COMMIT WORK.
ELSE.
BREAK-POINT.
ENDIF.
CMD_EI_API=>UNLOCK( IV_KUNNR = LS_CUSTOMER-HEADER-OBJECT_INSTANCE-KUNNR ).
Dynamic update table
FUNCTION Y_GL_M_RFC_UPDATE_TABLE.
*"----------------------------------------------------------------------
*"*"ローカルインタフェース:
*" IMPORTING
*" VALUE(I_TABNAME) TYPE TABNAME
*" VALUE(I_TBL_KEYFIELDS) TYPE STRINGVAL
*" VALUE(I_TBL_KEYVALUES) TYPE STRINGVAL
*" VALUE(I_UPD_FIELDS) TYPE STRINGVAL
*" VALUE(I_UPD_VALUES) TYPE STRINGVAL
*" EXPORTING
*" VALUE(RETURN) TYPE BAPIRET2
*"----------------------------------------------------------------------
DATA:
L_TBL_KEY_FLD TYPE TYP_I_COL,
L_TBL_KEY_VAL TYPE TYP_I_COL,
L_TBL_UPD_FLD TYPE TYP_I_COL,
L_TBL_UPD_VAL TYPE TYP_I_COL.
PERFORM CHECK_INPUT
USING
I_TABNAME
I_TBL_KEYFIELDS
I_TBL_KEYVALUES
I_UPD_FIELDS
I_UPD_VALUES
CHANGING
L_TBL_KEY_FLD
L_TBL_KEY_VAL
L_TBL_UPD_FLD
L_TBL_UPD_VAL
RETURN.
IF RETURN IS NOT INITIAL.
RETURN.
ENDIF.
PERFORM F_UPD_TBL_DATA
USING
I_TABNAME
L_TBL_KEY_FLD
L_TBL_KEY_VAL
L_TBL_UPD_FLD
L_TBL_UPD_VAL
CHANGING
RETURN.
ENDFUNCTION.
*&---------------------------------------------------------------------*
*& Form RETUCHECK_INPUTRN_MSG.
*&---------------------------------------------------------------------*
* 入力パラメータチェックメッセージ編集
*----------------------------------------------------------------------*
FORM CHECK_INPUT USING VALUE(FU_TABLE_NAME) TYPE TABNAME
VALUE(FU_TBL_KEYFIELDS) TYPE STRINGVAL
VALUE(FU_TBL_KEYVALUES) TYPE STRINGVAL
VALUE(FU_UPD_FIELDS) TYPE STRINGVAL
VALUE(FU_UPD_VALUES) TYPE STRINGVAL
CHANGING VALUE(FC_TBL_KEY_FLD) TYPE TYP_I_COL
VALUE(FC_TBL_KEY_VAL) TYPE TYP_I_COL
VALUE(FC_TBL_UPD_FLD) TYPE TYP_I_COL
VALUE(FC_TBL_UPD_VAL) TYPE TYP_I_COL
VALUE(FC_RETURN) TYPE BAPIRET2.
DATA:
TBL_YSXF0001 TYPE STANDARD TABLE OF TYP_YSXF0001,
H_TBL_YSXF0001 TYPE TYP_YSXF0001,
RNG_DELETE TYPE RANGE OF DD03L-FIELDNAME,
H_RNG_DELETE LIKE LINE OF RNG_DELETE,
LV_INDEX_CNT TYPE I, "キー項目数
LV_FLD TYPE STRING, "更新列名
H_G_TBL_DD03L TYPE TYP_DD03L.
IF FU_TABLE_NAME IS INITIAL. "テーブル名未設定
PERFORM RETURN_MSG USING 'E' 'FPP' '002' 'I_TABNAME' '' '' '' FC_RETURN.
RETURN.
ENDIF.
IF FU_TABLE_NAME+0(1) <> CNS_Y AND " 1桁目'Z''Y'以外
FU_TABLE_NAME+0(1) <> CNS_Z.
PERFORM RETURN_MSG USING 'E' '54' '239' '' '' '' '' FC_RETURN.
RETURN.
ENDIF.
IF FU_TBL_KEYFIELDS IS INITIAL. "キー項目名ブランク
PERFORM RETURN_MSG USING 'E' 'FPP' '002' 'I_TBL_KEYFIELDS' '' '' '' FC_RETURN.
RETURN.
ENDIF.
IF FU_TBL_KEYVALUES IS INITIAL. "キー項目値ブランク
PERFORM RETURN_MSG USING 'E' 'FPP' '002' 'I_TBL_KEYVALUES' '' '' '' FC_RETURN.
RETURN.
ENDIF.
IF FU_UPD_FIELDS IS INITIAL. "更新項目名ブランク
PERFORM RETURN_MSG USING 'E' 'FPP' '002' 'I_UPD_FIELDS' '' '' '' FC_RETURN.
RETURN.
ENDIF.
IF FU_UPD_VALUES IS INITIAL. "更新項目値ブランク
PERFORM RETURN_MSG USING 'E' 'FPP' '002' 'I_UPD_VALUES' '' '' '' FC_RETURN.
RETURN.
ENDIF.
*->項目情報取得
SELECT
DD03L~POSITION "テーブル位置
DD03L~KEYFLAG "キー項目
DD03L~REFFIELD "参照項目
DD03L~DATATYPE "データ型
DD03L~LENG "文字数
DD03L~DECIMALS "小数点以下桁数
DD03L~FIELDNAME "項目名
DD03L~PRECFIELD "インクルード名
DD03L~REFTABLE "参照項目に対するテーブル
DD03L~MANDATORY "フラグ: 必須項目 (空白不可)
DD03L~CHECKTABLE "外部キーのチェックテーブル名
DD03L~NOTNULL "NOT NULL 必須
FROM
DD03L INNER JOIN DD02L
ON DD03L~TABNAME = DD02L~TABNAME
INTO TABLE G_TBL_DD03L
WHERE
DD03L~TABNAME = FU_TABLE_NAME AND
DD03L~AS4LOCAL = CNS_A AND
DD02L~AS4LOCAL = CNS_A AND
DD02L~TABCLASS = 'TRANSP'
ORDER BY
DD03L~POSITION ASCENDING.
IF SY-SUBRC <> 0.
PERFORM RETURN_MSG USING 'E' '38' '909' FU_TABLE_NAME '' '' '' FC_RETURN.
RETURN.
ENDIF.
SELECT FIELDNAME INTO TABLE TBL_YSXF0001
FROM DD03L
WHERE
TABNAME = CNS_YSXF0001 AND
AS4LOCAL = CNS_A.
* アドオンテーブル末尾項目取得
CLEAR RNG_DELETE.
LOOP AT TBL_YSXF0001 INTO H_TBL_YSXF0001.
IF H_TBL_YSXF0001-FIELDNAME = 'LOESCH'.
CONTINUE.
ENDIF.
MOVE 'I' TO H_RNG_DELETE-SIGN.
MOVE 'EQ' TO H_RNG_DELETE-OPTION.
MOVE H_TBL_YSXF0001-FIELDNAME TO H_RNG_DELETE-LOW.
APPEND H_RNG_DELETE TO RNG_DELETE.
ENDLOOP.
MOVE 'I' TO H_RNG_DELETE-SIGN.
MOVE 'EQ' TO H_RNG_DELETE-OPTION.
MOVE CNS_MANDT TO H_RNG_DELETE-LOW.
APPEND H_RNG_DELETE TO RNG_DELETE.
*->対象外データ削除
DELETE G_TBL_DD03L WHERE FIELDNAME IN RNG_DELETE.
DELETE G_TBL_DD03L WHERE FIELDNAME = CNS_INCLUDE.
*->パラメータ分割(キー項目名)
PERFORM F_SPLIT_TAB_TXT
USING
FU_TBL_KEYFIELDS
CHANGING
FC_TBL_KEY_FLD.
*->パラメータ分割(キー項目値)
PERFORM F_SPLIT_TAB_TXT
USING
FU_TBL_KEYVALUES
CHANGING
FC_TBL_KEY_VAL.
*->パラメータ分割(更新項目名)
PERFORM F_SPLIT_TAB_TXT
USING
FU_UPD_FIELDS
CHANGING
FC_TBL_UPD_FLD.
*->パラメータ分割(更新項目値)
PERFORM F_SPLIT_TAB_TXT
USING
FU_UPD_VALUES
CHANGING
FC_TBL_UPD_VAL.
LOOP AT FC_TBL_KEY_FLD INTO LV_FLD.
* キー項目値ブランク
IF LV_FLD IS INITIAL.
PERFORM RETURN_MSG USING 'E' 'OPS_SE_BPS_COMMON' '005' '' '' '' '' FC_RETURN.
CONCATENATE 'I_TBL_KEYFIELDS' FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
ENDLOOP.
LOOP AT FC_TBL_UPD_FLD INTO LV_FLD.
* 更新項目値ブランク
IF LV_FLD IS INITIAL.
PERFORM RETURN_MSG USING 'E' 'OPS_SE_BPS_COMMON' '005' '' '' '' '' FC_RETURN.
CONCATENATE 'I_UPD_FIELDS' FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
ENDLOOP.
IF LINES( FC_TBL_KEY_FLD ) <> LINES( FC_TBL_KEY_VAL ).
* キー項目名、キー項目値数一致しない
PERFORM RETURN_MSG USING 'E' 'VK' '410' 'I_TBL_KEYFIELDS' 'I_TBL_KEYVALUES' '' '' FC_RETURN.
RETURN.
ENDIF.
IF LINES( FC_TBL_UPD_FLD ) <> LINES( FC_TBL_UPD_VAL ).
* 更新項目名、更新項目値数一致しない
PERFORM RETURN_MSG USING 'E' 'VK' '410' 'I_UPD_FIELDS' 'I_UPD_VALUES' '' '' FC_RETURN.
RETURN.
ENDIF.
* 項目名不一致
CLEAR LV_INDEX_CNT.
LOOP AT G_TBL_DD03L INTO H_G_TBL_DD03L.
IF H_G_TBL_DD03L-KEYFLAG = ABAP_ON .
LV_INDEX_CNT = LV_INDEX_CNT + 1.
READ TABLE FC_TBL_KEY_FLD WITH KEY TABLE_LINE = H_G_TBL_DD03L-FIELDNAME TRANSPORTING NO FIELDS.
IF SY-SUBRC <> 0.
PERFORM RETURN_MSG USING 'E' '/BCV/FND' '006' FU_TABLE_NAME 'I_TBL_KEYFIELDS' '' '' FC_RETURN.
RETURN.
ENDIF.
ENDIF.
ENDLOOP.
* キー項目数不一致
IF LV_INDEX_CNT <> LINES( FC_TBL_KEY_FLD ).
PERFORM RETURN_MSG USING 'E' '/BCV/FND' '006' FU_TABLE_NAME 'I_TBL_KEYFIELDS' '' '' FC_RETURN.
RETURN.
ENDIF.
ENDFORM. "CHECK_INPUT
*&---------------------------------------------------------------------*
*& Form CREAT_UPD_DATA.
*&---------------------------------------------------------------------*
* 登録用データ作成
*----------------------------------------------------------------------*
FORM CREAT_UPD_DATA USING VALUE(FU_TABNAME) TYPE TABNAME
VALUE(FU_UPD_FLD) TYPE TYP_I_COL
VALUE(FU_UPD_VAL) TYPE TYP_I_COL
CHANGING VALUE(FU_ROW) TYPE ANY
VALUE(FC_RETURN) TYPE BAPIRET2.
DATA: H_G_TBL_DD03L TYPE TYP_DD03L,
LV_UPD_FLD TYPE STRING,
LV_UPD_VAL TYPE STRING,
LV_DATE TYPE SY-DATUM,
LV_TIMES TYPE SY-UZEIT,
LV_INDEX TYPE SY-TABIX,
LV_ERR_CHAR(1024) TYPE C,
LV_HTYPE TYPE DD01V-DATATYPE,
LV_WAERS_INDEX TYPE SY-TABIX,
LV_UPD_WAERS TYPE TCURC-WAERS,
LV_UPD_VAL_CHK TYPE CHAR80,
LV_UPD_EXTERNAL TYPE BAPICURR-BAPICURR,
LV_UPD_VAL_OK TYPE STRING,
LV_DECIMALPART TYPE CHAR20,
LV_DEC_LENI TYPE I,
LV_DEC_LEN TYPE CHAR02,
L_RETURN2 TYPE BAPIRETURN.
FIELD-SYMBOLS:
<FS_FIELD> TYPE ANY.
LOOP AT FU_UPD_FLD INTO LV_UPD_FLD.
MOVE SY-TABIX TO LV_INDEX.
READ TABLE FU_UPD_VAL INTO LV_UPD_VAL INDEX LV_INDEX.
MOVE LV_UPD_VAL TO LV_ERR_CHAR. "エラーメッセージ表示用
READ TABLE G_TBL_DD03L INTO H_G_TBL_DD03L
WITH KEY FIELDNAME = LV_UPD_FLD
KEYFLAG = SPACE.
CASE H_G_TBL_DD03L-DATATYPE.
WHEN CNS_NUMC.
CALL FUNCTION 'NUMERIC_CHECK'
EXPORTING
STRING_IN = LV_UPD_VAL
IMPORTING
HTYPE = LV_HTYPE.
IF LV_HTYPE <> CNS_NUMC.
PERFORM RETURN_MSG USING 'E' '56' '083' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
* 桁数チェックを行う
IF STRLEN( LV_UPD_VAL ) > H_G_TBL_DD03L-LENG.
PERFORM RETURN_MSG USING 'E' 'KG' '618' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
MOVE LV_UPD_VAL TO LV_UPD_VAL_OK.
WHEN: CNS_CURR OR CNS_QUAN OR CNS_DEC.
CALL FUNCTION 'CATS_NUMERIC_INPUT_CHECK'
EXPORTING
INPUT = LV_UPD_VAL
IMPORTING
OUTPUT = LV_UPD_VAL_CHK
EXCEPTIONS
NO_NUMERIC = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
PERFORM RETURN_MSG USING 'E' '56' '083' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
IF H_G_TBL_DD03L-DATATYPE = CNS_CURR.
"金額内部値変換
IF H_G_TBL_DD03L-REFTABLE <> FU_TABNAME.
* 項目情報のREFTABLEの値が、パラメータ「テーブル名」と等しくない場合エラーとする
PERFORM RETURN_MSG USING 'E' 'FDT_CORE' '409' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
* 更新項目に通貨指定あるか
READ TABLE FU_UPD_FLD TRANSPORTING NO FIELDS
WITH KEY TABLE_LINE = H_G_TBL_DD03L-REFFIELD.
IF SY-SUBRC = 0.
MOVE SY-TABIX TO LV_WAERS_INDEX.
READ TABLE FU_UPD_VAL INTO LV_UPD_WAERS INDEX LV_WAERS_INDEX.
ELSE.
ASSIGN COMPONENT H_G_TBL_DD03L-REFFIELD
OF STRUCTURE FU_ROW TO <FS_FIELD>.
MOVE <FS_FIELD> TO LV_UPD_WAERS.
ENDIF.
TRY.
MOVE LV_UPD_VAL_CHK TO LV_UPD_EXTERNAL.
CATCH CX_SY_CONVERSION_NO_NUMBER CX_SY_CONVERSION_OVERFLOW.
PERFORM RETURN_MSG USING 'E' 'KG' '618' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDTRY.
* 金額を内部値変換
CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_INTERNAL'
EXPORTING
CURRENCY = LV_UPD_WAERS
AMOUNT_EXTERNAL = LV_UPD_EXTERNAL
MAX_NUMBER_OF_DIGITS = 18
IMPORTING
AMOUNT_INTERNAL = LV_UPD_EXTERNAL
RETURN = L_RETURN2.
IF L_RETURN2 IS NOT INITIAL.
CONCATENATE LV_UPD_VAL_CHK LV_UPD_WAERS INTO LV_ERR_CHAR.
PERFORM RETURN_MSG USING 'E' 'YXF01' '246' LV_ERR_CHAR '' '' '' FC_RETURN.
RETURN.
ENDIF.
MOVE LV_UPD_EXTERNAL TO LV_UPD_VAL_OK.
ELSE.
MOVE LV_UPD_VAL TO LV_UPD_VAL_OK.
ENDIF.
IF ABS( LV_UPD_VAL_OK ) >= 10 ** ( H_G_TBL_DD03L-LENG - H_G_TBL_DD03L-DECIMALS ).
"桁溢れ 例:QUAN 長さ 10 小数点 3 格納できる数字 9999999.999
PERFORM RETURN_MSG USING 'E' 'KG' '618' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
* 小数部分求める(例:15.437 小数部分0.437 小数部分桁数 = 5-2 )
LV_DECIMALPART = ABS( FRAC( LV_UPD_VAL_OK ) ).
CONDENSE LV_DECIMALPART.
LV_DEC_LENI = STRLEN( LV_DECIMALPART ) - 2.
IF LV_DEC_LENI > H_G_TBL_DD03L-DECIMALS.
MOVE H_G_TBL_DD03L-DECIMALS TO LV_DEC_LENI.
MOVE LV_DEC_LENI TO LV_DEC_LEN.
PERFORM RETURN_MSG USING 'E' 'DB' '739' LV_DEC_LEN '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
WHEN CNS_DATE.
* 日付項目チェック
MOVE LV_UPD_VAL TO LV_DATE.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
DATE = LV_DATE
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0 OR STRLEN( LV_UPD_VAL ) > H_G_TBL_DD03L-LENG .
PERFORM RETURN_MSG USING 'E' 'S5' '006' LV_ERR_CHAR '' '' '' FC_RETURN.
RETURN.
ENDIF.
MOVE LV_DATE TO LV_UPD_VAL_OK.
WHEN CNS_TIMS.
* 時間項目チェック
MOVE LV_UPD_VAL TO LV_TIMES.
CALL FUNCTION 'TIME_CHECK_PLAUSIBILITY'
EXPORTING
TIME = LV_TIMES
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0 OR STRLEN( LV_UPD_VAL ) > H_G_TBL_DD03L-LENG.
PERFORM RETURN_MSG USING 'E' 'S5' '007' LV_ERR_CHAR '' '' '' FC_RETURN.
RETURN.
ENDIF.
MOVE LV_TIMES TO LV_UPD_VAL_OK.
WHEN OTHERS.
MOVE LV_UPD_VAL TO LV_UPD_VAL_OK.
ENDCASE.
ASSIGN COMPONENT LV_UPD_FLD OF STRUCTURE FU_ROW TO <FS_FIELD>.
TRY.
MOVE LV_UPD_VAL_OK TO <FS_FIELD>.
CATCH CX_SY_CONVERSION_NO_NUMBER.
PERFORM RETURN_MSG USING 'E' '56' '083' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
CATCH CX_SY_CONVERSION_OVERFLOW.
PERFORM RETURN_MSG USING 'E' 'KG' '618' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
CATCH CX_SY_CONVERSION_ERROR.
* CX_SY_CONVERSION_NO_NUMBER CX_SY_CONVERSION_OVERFLOWは実際CX_SY_CONVERSION_ERRORに従属する
PERFORM RETURN_MSG USING 'E' 'FKKBI_INTERNAL' '056' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDTRY.
ENDLOOP.
ENDFORM. "CREAT_TABLE
*&---------------------------------------------------------------------*
*& Form F_UPD_TBL_DATA
*&---------------------------------------------------------------------*
* テーブル更新処理
*----------------------------------------------------------------------*
FORM F_UPD_TBL_DATA USING VALUE(FU_TABNAME) TYPE TABNAME
VALUE(FU_TBL_KEY_FLD) TYPE TYP_I_COL
VALUE(FU_TBL_KEY_VAL) TYPE TYP_I_COL
VALUE(FU_UPD_FLD) TYPE TYP_I_COL
VALUE(FU_UPD_VAL) TYPE TYP_I_COL
CHANGING VALUE(FC_RETURN) TYPE BAPIRET2.
DATA:
LV_INDEX TYPE SY-TABIX,
LV_KEY_VAL TYPE STRING,
L_KEY TYPE RSTABLE-VARKEY,
H_G_TBL_DD03L TYPE TYP_DD03L,
L_H_TBL TYPE REF TO DATA,
LV_UPD_FLD TYPE STRING,
LV_UPD_VAL TYPE STRING,
LV_FLD_NM TYPE DD03L-FIELDNAME, "列名
L_TBL_EXT_ID TYPE OLR3_R3_TT_ID_SPLIT, "存在チェック用テーブル
L_H_TBL_EXT_ID TYPE OLR3_R3_TS_ID_SPLIT, "存在チェック用テーブルの行
L_RETURN TYPE BAPIRETURN1,
L_TBL_WHERE TYPE TABLE OF EDPLINE, "WHERE条件
L_H_TBL_WHERE TYPE EDPLINE, "WHERE条件の行
LV_AND_FLG TYPE CHAR01, "AND
LV_UPD_FLG TYPE CHAR01. "更新成功フラグ
FIELD-SYMBOLS:
<FS_ROW> TYPE ANY,
<FS_FIELD> TYPE ANY.
CLEAR:
L_KEY,
L_TBL_WHERE,
LV_AND_FLG.
* ロックキーと検索用WHERE条件作成
LOOP AT G_TBL_DD03L INTO H_G_TBL_DD03L
WHERE KEYFLAG IS NOT INITIAL.
* インポートパラメータキーの順番と定義必ず一致ではないため
READ TABLE FU_TBL_KEY_FLD
WITH KEY TABLE_LINE = H_G_TBL_DD03L-FIELDNAME
TRANSPORTING NO FIELDS.
*
MOVE SY-TABIX TO LV_INDEX.
READ TABLE FU_TBL_KEY_VAL INTO LV_KEY_VAL INDEX LV_INDEX.
* テーブルロックキー作成する
CONCATENATE L_KEY LV_KEY_VAL INTO L_KEY.
* 1行目 AND必要ない、2行目から AND付ける必要
IF LV_AND_FLG IS NOT INITIAL.
APPEND 'AND' TO L_TBL_WHERE.
ENDIF.
CONCATENATE H_G_TBL_DD03L-FIELDNAME ' = ''' LV_KEY_VAL '''' INTO L_H_TBL_WHERE.
APPEND L_H_TBL_WHERE TO L_TBL_WHERE.
LV_AND_FLG = ABAP_ON.
ENDLOOP.
LOOP AT FU_UPD_FLD INTO LV_UPD_FLD.
MOVE SY-TABIX TO LV_INDEX.
READ TABLE FU_UPD_VAL INTO LV_UPD_VAL INDEX LV_INDEX.
MOVE LV_UPD_FLD TO LV_FLD_NM.
READ TABLE G_TBL_DD03L INTO H_G_TBL_DD03L
WITH KEY FIELDNAME = LV_UPD_FLD
KEYFLAG = SPACE.
IF SY-SUBRC <> 0.
* 項目 & は (有効バージョンの) テーブル &2 に存在しません
PERFORM RETURN_MSG USING 'E' '37' '526' LV_FLD_NM FU_TABNAME '' '' FC_RETURN.
RETURN.
ENDIF.
* 必須チェック
IF H_G_TBL_DD03L-MANDATORY = ABAP_ON AND
LV_UPD_VAL IS INITIAL.
* 必須項目 '&1' に入力してください
PERFORM RETURN_MSG USING 'E' '/BCV/CFG' '028' LV_FLD_NM '' '' '' FC_RETURN.
RETURN.
ENDIF.
IF H_G_TBL_DD03L-NOTNULL = ABAP_ON AND
LV_UPD_VAL IS INITIAL.
* 入力項目には Null 値が含まれています 入力項目に値を入力してください
PERFORM RETURN_MSG USING 'E' 'OPS_SE_BPS_COMMON' '005' '' '' '' '' FC_RETURN.
CONCATENATE LV_FLD_NM FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
IF H_G_TBL_DD03L-CHECKTABLE IS NOT INITIAL AND
H_G_TBL_DD03L-CHECKTABLE <> CNS_ASTERISK.
* 存在チェック
CLEAR:
L_TBL_EXT_ID,
L_H_TBL_EXT_ID.
MOVE LV_FLD_NM TO L_H_TBL_EXT_ID-OLR3_TAB_FIELD.
MOVE LV_UPD_VAL TO L_H_TBL_EXT_ID-OLR3_TAB_VALUE.
APPEND L_H_TBL_EXT_ID TO L_TBL_EXT_ID.
CALL METHOD CL_R3_OLR3_METHODS=>CHECK_EXISTENCE
EXPORTING
IT_EXT_ID = L_TBL_EXT_ID
IV_TABNAME = H_G_TBL_DD03L-CHECKTABLE
IMPORTING
EV_RETURN = L_RETURN.
IF L_RETURN-TYPE = CNS_TYP_E.
PERFORM RETURN_MSG USING 'E' '/SAPNEA/J_SC' '084' H_G_TBL_DD03L-CHECKTABLE L_H_TBL_EXT_ID-OLR3_TAB_VALUE '' '' FC_RETURN.
RETURN.
ENDIF.
ENDIF.
ENDLOOP.
CALL FUNCTION 'ENQUEUE_E_TABLEE'
EXPORTING
TABNAME = FU_TABNAME
VARKEY = L_KEY
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* テーブル &1 をロックできませんでした
PERFORM RETURN_MSG USING 'E' 'BV' '019' FU_TABNAME '' '' '' FC_RETURN.
RETURN.
ENDIF.
CREATE DATA L_H_TBL TYPE (FU_TABNAME).
ASSIGN L_H_TBL->* TO <FS_ROW>.
SELECT SINGLE FOR UPDATE *
FROM (FU_TABNAME)
INTO <FS_ROW>
WHERE (L_TBL_WHERE).
CLEAR LV_UPD_FLG.
IF SY-SUBRC <> 0.
* 指定キーの更新データがありません。
PERFORM RETURN_MSG
USING 'E' 'PPETICMP' '009' TEXT-T02 '' '' '' FC_RETURN.
ELSE.
* 更新項目の値を設定
PERFORM CREAT_UPD_DATA
USING
FU_TABNAME
FU_UPD_FLD
FU_UPD_VAL
CHANGING
<FS_ROW>
FC_RETURN.
IF FC_RETURN IS INITIAL.
* 更新日付、時間、更新者、更新プログラム設定
ASSIGN COMPONENT 'YEUPDAT' OF STRUCTURE <FS_ROW> TO <FS_FIELD>.
IF SY-SUBRC = 0.
MOVE SY-DATUM TO <FS_FIELD>.
ENDIF.
ASSIGN COMPONENT 'YEUPTIM' OF STRUCTURE <FS_ROW> TO <FS_FIELD>.
IF SY-SUBRC = 0.
MOVE SY-UZEIT TO <FS_FIELD>.
ENDIF.
ASSIGN COMPONENT 'YEUPUNM' OF STRUCTURE <FS_ROW> TO <FS_FIELD>.
IF SY-SUBRC = 0.
MOVE SY-UNAME TO <FS_FIELD>.
ENDIF.
ASSIGN COMPONENT 'YEUPTCD' OF STRUCTURE <FS_ROW> TO <FS_FIELD>.
IF SY-SUBRC = 0.
MOVE 'Y_GL_M_RFC_UPDATE_TABLE' TO <FS_FIELD>.
ENDIF.
TRY.
UPDATE (FU_TABNAME) FROM <FS_ROW>.
* 更新成功フラグを設定.
MOVE ABAP_ON TO LV_UPD_FLG.
CATCH CX_SY_OPEN_SQL_DB.
CLEAR LV_UPD_FLG.
ENDTRY.
IF LV_UPD_FLG IS NOT INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = ABAP_ON.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
PERFORM RETURN_MSG
USING 'E' '1I' '888' FU_TABNAME '' '' '' FC_RETURN.
ENDIF.
ENDIF.
ENDIF.
CALL FUNCTION 'DEQUEUE_ALL'
EXPORTING
_SYNCHRON = ABAP_ON.
IF LV_UPD_FLG IS NOT INITIAL.
PERFORM RETURN_MSG
USING 'S' '1M' '804' FU_TABNAME TEXT-T01 '' '' FC_RETURN.
ENDIF.
ENDFORM. "F_UPD_TBL_DATA
*&---------------------------------------------------------------------*
*& Form F_SPLIT_TAB_TXT
*&---------------------------------------------------------------------*
* TABテキスト分割して値を内部テーブルに格納する
*----------------------------------------------------------------------*
FORM F_SPLIT_TAB_TXT USING VALUE(FU_TXT) TYPE STRINGVAL
CHANGING VALUE(FC_COLS) TYPE TYP_I_COL.
* TAB分割後の値を内部テーブルに格納する
SPLIT FU_TXT AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
INTO TABLE FC_COLS.
ENDFORM. "F_SPLIT_TAB_TXT
*&---------------------------------------------------------------------*
*& Form RETURN_MSG.
*&---------------------------------------------------------------------*
* メッセージ編集
*----------------------------------------------------------------------*
FORM RETURN_MSG USING
FU_TYPE TYPE BAPIRETURN-TYPE "メッセージタイプ.
FU_CL TYPE SY-MSGID "メッセージID
FU_NUMBER TYPE SY-MSGNO "メッセージ番号
FU_PAR1 TYPE C "TEXT.
FU_PAR2 TYPE C "TEXT.
FU_PAR3 TYPE C "TEXT.
FU_PAR4 TYPE C "TEXT.
FU_RESULT TYPE BAPIRET2. "処理結果テーブル
*----------------------------------------------------------------------*
DATA:L_MSGV1 TYPE SY-MSGV1,
L_MSGV2 TYPE SY-MSGV2,
L_MSGV3 TYPE SY-MSGV3,
L_MSGV4 TYPE SY-MSGV4.
*----------------------------------------------------------------------*
MOVE:FU_PAR1 TO L_MSGV1,
FU_PAR2 TO L_MSGV2,
FU_PAR3 TO L_MSGV3,
FU_PAR4 TO L_MSGV4.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
TYPE = FU_TYPE
CL = FU_CL
NUMBER = FU_NUMBER
PAR1 = L_MSGV1
PAR2 = L_MSGV2
PAR3 = L_MSGV3
PAR4 = L_MSGV4
IMPORTING
RETURN = FU_RESULT.
ENDFORM. "RETURN_MSG
*"----------------------------------------------------------------------
*"*"ローカルインタフェース:
*" IMPORTING
*" VALUE(I_TABNAME) TYPE TABNAME
*" VALUE(I_TBL_KEYFIELDS) TYPE STRINGVAL
*" VALUE(I_TBL_KEYVALUES) TYPE STRINGVAL
*" VALUE(I_UPD_FIELDS) TYPE STRINGVAL
*" VALUE(I_UPD_VALUES) TYPE STRINGVAL
*" EXPORTING
*" VALUE(RETURN) TYPE BAPIRET2
*"----------------------------------------------------------------------
DATA:
L_TBL_KEY_FLD TYPE TYP_I_COL,
L_TBL_KEY_VAL TYPE TYP_I_COL,
L_TBL_UPD_FLD TYPE TYP_I_COL,
L_TBL_UPD_VAL TYPE TYP_I_COL.
PERFORM CHECK_INPUT
USING
I_TABNAME
I_TBL_KEYFIELDS
I_TBL_KEYVALUES
I_UPD_FIELDS
I_UPD_VALUES
CHANGING
L_TBL_KEY_FLD
L_TBL_KEY_VAL
L_TBL_UPD_FLD
L_TBL_UPD_VAL
RETURN.
IF RETURN IS NOT INITIAL.
RETURN.
ENDIF.
PERFORM F_UPD_TBL_DATA
USING
I_TABNAME
L_TBL_KEY_FLD
L_TBL_KEY_VAL
L_TBL_UPD_FLD
L_TBL_UPD_VAL
CHANGING
RETURN.
ENDFUNCTION.
*&---------------------------------------------------------------------*
*& Form RETUCHECK_INPUTRN_MSG.
*&---------------------------------------------------------------------*
* 入力パラメータチェックメッセージ編集
*----------------------------------------------------------------------*
FORM CHECK_INPUT USING VALUE(FU_TABLE_NAME) TYPE TABNAME
VALUE(FU_TBL_KEYFIELDS) TYPE STRINGVAL
VALUE(FU_TBL_KEYVALUES) TYPE STRINGVAL
VALUE(FU_UPD_FIELDS) TYPE STRINGVAL
VALUE(FU_UPD_VALUES) TYPE STRINGVAL
CHANGING VALUE(FC_TBL_KEY_FLD) TYPE TYP_I_COL
VALUE(FC_TBL_KEY_VAL) TYPE TYP_I_COL
VALUE(FC_TBL_UPD_FLD) TYPE TYP_I_COL
VALUE(FC_TBL_UPD_VAL) TYPE TYP_I_COL
VALUE(FC_RETURN) TYPE BAPIRET2.
DATA:
TBL_YSXF0001 TYPE STANDARD TABLE OF TYP_YSXF0001,
H_TBL_YSXF0001 TYPE TYP_YSXF0001,
RNG_DELETE TYPE RANGE OF DD03L-FIELDNAME,
H_RNG_DELETE LIKE LINE OF RNG_DELETE,
LV_INDEX_CNT TYPE I, "キー項目数
LV_FLD TYPE STRING, "更新列名
H_G_TBL_DD03L TYPE TYP_DD03L.
IF FU_TABLE_NAME IS INITIAL. "テーブル名未設定
PERFORM RETURN_MSG USING 'E' 'FPP' '002' 'I_TABNAME' '' '' '' FC_RETURN.
RETURN.
ENDIF.
IF FU_TABLE_NAME+0(1) <> CNS_Y AND " 1桁目'Z''Y'以外
FU_TABLE_NAME+0(1) <> CNS_Z.
PERFORM RETURN_MSG USING 'E' '54' '239' '' '' '' '' FC_RETURN.
RETURN.
ENDIF.
IF FU_TBL_KEYFIELDS IS INITIAL. "キー項目名ブランク
PERFORM RETURN_MSG USING 'E' 'FPP' '002' 'I_TBL_KEYFIELDS' '' '' '' FC_RETURN.
RETURN.
ENDIF.
IF FU_TBL_KEYVALUES IS INITIAL. "キー項目値ブランク
PERFORM RETURN_MSG USING 'E' 'FPP' '002' 'I_TBL_KEYVALUES' '' '' '' FC_RETURN.
RETURN.
ENDIF.
IF FU_UPD_FIELDS IS INITIAL. "更新項目名ブランク
PERFORM RETURN_MSG USING 'E' 'FPP' '002' 'I_UPD_FIELDS' '' '' '' FC_RETURN.
RETURN.
ENDIF.
IF FU_UPD_VALUES IS INITIAL. "更新項目値ブランク
PERFORM RETURN_MSG USING 'E' 'FPP' '002' 'I_UPD_VALUES' '' '' '' FC_RETURN.
RETURN.
ENDIF.
*->項目情報取得
SELECT
DD03L~POSITION "テーブル位置
DD03L~KEYFLAG "キー項目
DD03L~REFFIELD "参照項目
DD03L~DATATYPE "データ型
DD03L~LENG "文字数
DD03L~DECIMALS "小数点以下桁数
DD03L~FIELDNAME "項目名
DD03L~PRECFIELD "インクルード名
DD03L~REFTABLE "参照項目に対するテーブル
DD03L~MANDATORY "フラグ: 必須項目 (空白不可)
DD03L~CHECKTABLE "外部キーのチェックテーブル名
DD03L~NOTNULL "NOT NULL 必須
FROM
DD03L INNER JOIN DD02L
ON DD03L~TABNAME = DD02L~TABNAME
INTO TABLE G_TBL_DD03L
WHERE
DD03L~TABNAME = FU_TABLE_NAME AND
DD03L~AS4LOCAL = CNS_A AND
DD02L~AS4LOCAL = CNS_A AND
DD02L~TABCLASS = 'TRANSP'
ORDER BY
DD03L~POSITION ASCENDING.
IF SY-SUBRC <> 0.
PERFORM RETURN_MSG USING 'E' '38' '909' FU_TABLE_NAME '' '' '' FC_RETURN.
RETURN.
ENDIF.
SELECT FIELDNAME INTO TABLE TBL_YSXF0001
FROM DD03L
WHERE
TABNAME = CNS_YSXF0001 AND
AS4LOCAL = CNS_A.
* アドオンテーブル末尾項目取得
CLEAR RNG_DELETE.
LOOP AT TBL_YSXF0001 INTO H_TBL_YSXF0001.
IF H_TBL_YSXF0001-FIELDNAME = 'LOESCH'.
CONTINUE.
ENDIF.
MOVE 'I' TO H_RNG_DELETE-SIGN.
MOVE 'EQ' TO H_RNG_DELETE-OPTION.
MOVE H_TBL_YSXF0001-FIELDNAME TO H_RNG_DELETE-LOW.
APPEND H_RNG_DELETE TO RNG_DELETE.
ENDLOOP.
MOVE 'I' TO H_RNG_DELETE-SIGN.
MOVE 'EQ' TO H_RNG_DELETE-OPTION.
MOVE CNS_MANDT TO H_RNG_DELETE-LOW.
APPEND H_RNG_DELETE TO RNG_DELETE.
*->対象外データ削除
DELETE G_TBL_DD03L WHERE FIELDNAME IN RNG_DELETE.
DELETE G_TBL_DD03L WHERE FIELDNAME = CNS_INCLUDE.
*->パラメータ分割(キー項目名)
PERFORM F_SPLIT_TAB_TXT
USING
FU_TBL_KEYFIELDS
CHANGING
FC_TBL_KEY_FLD.
*->パラメータ分割(キー項目値)
PERFORM F_SPLIT_TAB_TXT
USING
FU_TBL_KEYVALUES
CHANGING
FC_TBL_KEY_VAL.
*->パラメータ分割(更新項目名)
PERFORM F_SPLIT_TAB_TXT
USING
FU_UPD_FIELDS
CHANGING
FC_TBL_UPD_FLD.
*->パラメータ分割(更新項目値)
PERFORM F_SPLIT_TAB_TXT
USING
FU_UPD_VALUES
CHANGING
FC_TBL_UPD_VAL.
LOOP AT FC_TBL_KEY_FLD INTO LV_FLD.
* キー項目値ブランク
IF LV_FLD IS INITIAL.
PERFORM RETURN_MSG USING 'E' 'OPS_SE_BPS_COMMON' '005' '' '' '' '' FC_RETURN.
CONCATENATE 'I_TBL_KEYFIELDS' FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
ENDLOOP.
LOOP AT FC_TBL_UPD_FLD INTO LV_FLD.
* 更新項目値ブランク
IF LV_FLD IS INITIAL.
PERFORM RETURN_MSG USING 'E' 'OPS_SE_BPS_COMMON' '005' '' '' '' '' FC_RETURN.
CONCATENATE 'I_UPD_FIELDS' FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
ENDLOOP.
IF LINES( FC_TBL_KEY_FLD ) <> LINES( FC_TBL_KEY_VAL ).
* キー項目名、キー項目値数一致しない
PERFORM RETURN_MSG USING 'E' 'VK' '410' 'I_TBL_KEYFIELDS' 'I_TBL_KEYVALUES' '' '' FC_RETURN.
RETURN.
ENDIF.
IF LINES( FC_TBL_UPD_FLD ) <> LINES( FC_TBL_UPD_VAL ).
* 更新項目名、更新項目値数一致しない
PERFORM RETURN_MSG USING 'E' 'VK' '410' 'I_UPD_FIELDS' 'I_UPD_VALUES' '' '' FC_RETURN.
RETURN.
ENDIF.
* 項目名不一致
CLEAR LV_INDEX_CNT.
LOOP AT G_TBL_DD03L INTO H_G_TBL_DD03L.
IF H_G_TBL_DD03L-KEYFLAG = ABAP_ON .
LV_INDEX_CNT = LV_INDEX_CNT + 1.
READ TABLE FC_TBL_KEY_FLD WITH KEY TABLE_LINE = H_G_TBL_DD03L-FIELDNAME TRANSPORTING NO FIELDS.
IF SY-SUBRC <> 0.
PERFORM RETURN_MSG USING 'E' '/BCV/FND' '006' FU_TABLE_NAME 'I_TBL_KEYFIELDS' '' '' FC_RETURN.
RETURN.
ENDIF.
ENDIF.
ENDLOOP.
* キー項目数不一致
IF LV_INDEX_CNT <> LINES( FC_TBL_KEY_FLD ).
PERFORM RETURN_MSG USING 'E' '/BCV/FND' '006' FU_TABLE_NAME 'I_TBL_KEYFIELDS' '' '' FC_RETURN.
RETURN.
ENDIF.
ENDFORM. "CHECK_INPUT
*&---------------------------------------------------------------------*
*& Form CREAT_UPD_DATA.
*&---------------------------------------------------------------------*
* 登録用データ作成
*----------------------------------------------------------------------*
FORM CREAT_UPD_DATA USING VALUE(FU_TABNAME) TYPE TABNAME
VALUE(FU_UPD_FLD) TYPE TYP_I_COL
VALUE(FU_UPD_VAL) TYPE TYP_I_COL
CHANGING VALUE(FU_ROW) TYPE ANY
VALUE(FC_RETURN) TYPE BAPIRET2.
DATA: H_G_TBL_DD03L TYPE TYP_DD03L,
LV_UPD_FLD TYPE STRING,
LV_UPD_VAL TYPE STRING,
LV_DATE TYPE SY-DATUM,
LV_TIMES TYPE SY-UZEIT,
LV_INDEX TYPE SY-TABIX,
LV_ERR_CHAR(1024) TYPE C,
LV_HTYPE TYPE DD01V-DATATYPE,
LV_WAERS_INDEX TYPE SY-TABIX,
LV_UPD_WAERS TYPE TCURC-WAERS,
LV_UPD_VAL_CHK TYPE CHAR80,
LV_UPD_EXTERNAL TYPE BAPICURR-BAPICURR,
LV_UPD_VAL_OK TYPE STRING,
LV_DECIMALPART TYPE CHAR20,
LV_DEC_LENI TYPE I,
LV_DEC_LEN TYPE CHAR02,
L_RETURN2 TYPE BAPIRETURN.
FIELD-SYMBOLS:
<FS_FIELD> TYPE ANY.
LOOP AT FU_UPD_FLD INTO LV_UPD_FLD.
MOVE SY-TABIX TO LV_INDEX.
READ TABLE FU_UPD_VAL INTO LV_UPD_VAL INDEX LV_INDEX.
MOVE LV_UPD_VAL TO LV_ERR_CHAR. "エラーメッセージ表示用
READ TABLE G_TBL_DD03L INTO H_G_TBL_DD03L
WITH KEY FIELDNAME = LV_UPD_FLD
KEYFLAG = SPACE.
CASE H_G_TBL_DD03L-DATATYPE.
WHEN CNS_NUMC.
CALL FUNCTION 'NUMERIC_CHECK'
EXPORTING
STRING_IN = LV_UPD_VAL
IMPORTING
HTYPE = LV_HTYPE.
IF LV_HTYPE <> CNS_NUMC.
PERFORM RETURN_MSG USING 'E' '56' '083' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
* 桁数チェックを行う
IF STRLEN( LV_UPD_VAL ) > H_G_TBL_DD03L-LENG.
PERFORM RETURN_MSG USING 'E' 'KG' '618' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
MOVE LV_UPD_VAL TO LV_UPD_VAL_OK.
WHEN: CNS_CURR OR CNS_QUAN OR CNS_DEC.
CALL FUNCTION 'CATS_NUMERIC_INPUT_CHECK'
EXPORTING
INPUT = LV_UPD_VAL
IMPORTING
OUTPUT = LV_UPD_VAL_CHK
EXCEPTIONS
NO_NUMERIC = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
PERFORM RETURN_MSG USING 'E' '56' '083' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
IF H_G_TBL_DD03L-DATATYPE = CNS_CURR.
"金額内部値変換
IF H_G_TBL_DD03L-REFTABLE <> FU_TABNAME.
* 項目情報のREFTABLEの値が、パラメータ「テーブル名」と等しくない場合エラーとする
PERFORM RETURN_MSG USING 'E' 'FDT_CORE' '409' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
* 更新項目に通貨指定あるか
READ TABLE FU_UPD_FLD TRANSPORTING NO FIELDS
WITH KEY TABLE_LINE = H_G_TBL_DD03L-REFFIELD.
IF SY-SUBRC = 0.
MOVE SY-TABIX TO LV_WAERS_INDEX.
READ TABLE FU_UPD_VAL INTO LV_UPD_WAERS INDEX LV_WAERS_INDEX.
ELSE.
ASSIGN COMPONENT H_G_TBL_DD03L-REFFIELD
OF STRUCTURE FU_ROW TO <FS_FIELD>.
MOVE <FS_FIELD> TO LV_UPD_WAERS.
ENDIF.
TRY.
MOVE LV_UPD_VAL_CHK TO LV_UPD_EXTERNAL.
CATCH CX_SY_CONVERSION_NO_NUMBER CX_SY_CONVERSION_OVERFLOW.
PERFORM RETURN_MSG USING 'E' 'KG' '618' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDTRY.
* 金額を内部値変換
CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_INTERNAL'
EXPORTING
CURRENCY = LV_UPD_WAERS
AMOUNT_EXTERNAL = LV_UPD_EXTERNAL
MAX_NUMBER_OF_DIGITS = 18
IMPORTING
AMOUNT_INTERNAL = LV_UPD_EXTERNAL
RETURN = L_RETURN2.
IF L_RETURN2 IS NOT INITIAL.
CONCATENATE LV_UPD_VAL_CHK LV_UPD_WAERS INTO LV_ERR_CHAR.
PERFORM RETURN_MSG USING 'E' 'YXF01' '246' LV_ERR_CHAR '' '' '' FC_RETURN.
RETURN.
ENDIF.
MOVE LV_UPD_EXTERNAL TO LV_UPD_VAL_OK.
ELSE.
MOVE LV_UPD_VAL TO LV_UPD_VAL_OK.
ENDIF.
IF ABS( LV_UPD_VAL_OK ) >= 10 ** ( H_G_TBL_DD03L-LENG - H_G_TBL_DD03L-DECIMALS ).
"桁溢れ 例:QUAN 長さ 10 小数点 3 格納できる数字 9999999.999
PERFORM RETURN_MSG USING 'E' 'KG' '618' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
* 小数部分求める(例:15.437 小数部分0.437 小数部分桁数 = 5-2 )
LV_DECIMALPART = ABS( FRAC( LV_UPD_VAL_OK ) ).
CONDENSE LV_DECIMALPART.
LV_DEC_LENI = STRLEN( LV_DECIMALPART ) - 2.
IF LV_DEC_LENI > H_G_TBL_DD03L-DECIMALS.
MOVE H_G_TBL_DD03L-DECIMALS TO LV_DEC_LENI.
MOVE LV_DEC_LENI TO LV_DEC_LEN.
PERFORM RETURN_MSG USING 'E' 'DB' '739' LV_DEC_LEN '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
WHEN CNS_DATE.
* 日付項目チェック
MOVE LV_UPD_VAL TO LV_DATE.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
EXPORTING
DATE = LV_DATE
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0 OR STRLEN( LV_UPD_VAL ) > H_G_TBL_DD03L-LENG .
PERFORM RETURN_MSG USING 'E' 'S5' '006' LV_ERR_CHAR '' '' '' FC_RETURN.
RETURN.
ENDIF.
MOVE LV_DATE TO LV_UPD_VAL_OK.
WHEN CNS_TIMS.
* 時間項目チェック
MOVE LV_UPD_VAL TO LV_TIMES.
CALL FUNCTION 'TIME_CHECK_PLAUSIBILITY'
EXPORTING
TIME = LV_TIMES
EXCEPTIONS
PLAUSIBILITY_CHECK_FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0 OR STRLEN( LV_UPD_VAL ) > H_G_TBL_DD03L-LENG.
PERFORM RETURN_MSG USING 'E' 'S5' '007' LV_ERR_CHAR '' '' '' FC_RETURN.
RETURN.
ENDIF.
MOVE LV_TIMES TO LV_UPD_VAL_OK.
WHEN OTHERS.
MOVE LV_UPD_VAL TO LV_UPD_VAL_OK.
ENDCASE.
ASSIGN COMPONENT LV_UPD_FLD OF STRUCTURE FU_ROW TO <FS_FIELD>.
TRY.
MOVE LV_UPD_VAL_OK TO <FS_FIELD>.
CATCH CX_SY_CONVERSION_NO_NUMBER.
PERFORM RETURN_MSG USING 'E' '56' '083' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
CATCH CX_SY_CONVERSION_OVERFLOW.
PERFORM RETURN_MSG USING 'E' 'KG' '618' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
CATCH CX_SY_CONVERSION_ERROR.
* CX_SY_CONVERSION_NO_NUMBER CX_SY_CONVERSION_OVERFLOWは実際CX_SY_CONVERSION_ERRORに従属する
PERFORM RETURN_MSG USING 'E' 'FKKBI_INTERNAL' '056' '' '' '' '' FC_RETURN.
CONCATENATE LV_UPD_FLD FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDTRY.
ENDLOOP.
ENDFORM. "CREAT_TABLE
*&---------------------------------------------------------------------*
*& Form F_UPD_TBL_DATA
*&---------------------------------------------------------------------*
* テーブル更新処理
*----------------------------------------------------------------------*
FORM F_UPD_TBL_DATA USING VALUE(FU_TABNAME) TYPE TABNAME
VALUE(FU_TBL_KEY_FLD) TYPE TYP_I_COL
VALUE(FU_TBL_KEY_VAL) TYPE TYP_I_COL
VALUE(FU_UPD_FLD) TYPE TYP_I_COL
VALUE(FU_UPD_VAL) TYPE TYP_I_COL
CHANGING VALUE(FC_RETURN) TYPE BAPIRET2.
DATA:
LV_INDEX TYPE SY-TABIX,
LV_KEY_VAL TYPE STRING,
L_KEY TYPE RSTABLE-VARKEY,
H_G_TBL_DD03L TYPE TYP_DD03L,
L_H_TBL TYPE REF TO DATA,
LV_UPD_FLD TYPE STRING,
LV_UPD_VAL TYPE STRING,
LV_FLD_NM TYPE DD03L-FIELDNAME, "列名
L_TBL_EXT_ID TYPE OLR3_R3_TT_ID_SPLIT, "存在チェック用テーブル
L_H_TBL_EXT_ID TYPE OLR3_R3_TS_ID_SPLIT, "存在チェック用テーブルの行
L_RETURN TYPE BAPIRETURN1,
L_TBL_WHERE TYPE TABLE OF EDPLINE, "WHERE条件
L_H_TBL_WHERE TYPE EDPLINE, "WHERE条件の行
LV_AND_FLG TYPE CHAR01, "AND
LV_UPD_FLG TYPE CHAR01. "更新成功フラグ
FIELD-SYMBOLS:
<FS_ROW> TYPE ANY,
<FS_FIELD> TYPE ANY.
CLEAR:
L_KEY,
L_TBL_WHERE,
LV_AND_FLG.
* ロックキーと検索用WHERE条件作成
LOOP AT G_TBL_DD03L INTO H_G_TBL_DD03L
WHERE KEYFLAG IS NOT INITIAL.
* インポートパラメータキーの順番と定義必ず一致ではないため
READ TABLE FU_TBL_KEY_FLD
WITH KEY TABLE_LINE = H_G_TBL_DD03L-FIELDNAME
TRANSPORTING NO FIELDS.
*
MOVE SY-TABIX TO LV_INDEX.
READ TABLE FU_TBL_KEY_VAL INTO LV_KEY_VAL INDEX LV_INDEX.
* テーブルロックキー作成する
CONCATENATE L_KEY LV_KEY_VAL INTO L_KEY.
* 1行目 AND必要ない、2行目から AND付ける必要
IF LV_AND_FLG IS NOT INITIAL.
APPEND 'AND' TO L_TBL_WHERE.
ENDIF.
CONCATENATE H_G_TBL_DD03L-FIELDNAME ' = ''' LV_KEY_VAL '''' INTO L_H_TBL_WHERE.
APPEND L_H_TBL_WHERE TO L_TBL_WHERE.
LV_AND_FLG = ABAP_ON.
ENDLOOP.
LOOP AT FU_UPD_FLD INTO LV_UPD_FLD.
MOVE SY-TABIX TO LV_INDEX.
READ TABLE FU_UPD_VAL INTO LV_UPD_VAL INDEX LV_INDEX.
MOVE LV_UPD_FLD TO LV_FLD_NM.
READ TABLE G_TBL_DD03L INTO H_G_TBL_DD03L
WITH KEY FIELDNAME = LV_UPD_FLD
KEYFLAG = SPACE.
IF SY-SUBRC <> 0.
* 項目 & は (有効バージョンの) テーブル &2 に存在しません
PERFORM RETURN_MSG USING 'E' '37' '526' LV_FLD_NM FU_TABNAME '' '' FC_RETURN.
RETURN.
ENDIF.
* 必須チェック
IF H_G_TBL_DD03L-MANDATORY = ABAP_ON AND
LV_UPD_VAL IS INITIAL.
* 必須項目 '&1' に入力してください
PERFORM RETURN_MSG USING 'E' '/BCV/CFG' '028' LV_FLD_NM '' '' '' FC_RETURN.
RETURN.
ENDIF.
IF H_G_TBL_DD03L-NOTNULL = ABAP_ON AND
LV_UPD_VAL IS INITIAL.
* 入力項目には Null 値が含まれています 入力項目に値を入力してください
PERFORM RETURN_MSG USING 'E' 'OPS_SE_BPS_COMMON' '005' '' '' '' '' FC_RETURN.
CONCATENATE LV_FLD_NM FC_RETURN-MESSAGE INTO FC_RETURN-MESSAGE.
RETURN.
ENDIF.
IF H_G_TBL_DD03L-CHECKTABLE IS NOT INITIAL AND
H_G_TBL_DD03L-CHECKTABLE <> CNS_ASTERISK.
* 存在チェック
CLEAR:
L_TBL_EXT_ID,
L_H_TBL_EXT_ID.
MOVE LV_FLD_NM TO L_H_TBL_EXT_ID-OLR3_TAB_FIELD.
MOVE LV_UPD_VAL TO L_H_TBL_EXT_ID-OLR3_TAB_VALUE.
APPEND L_H_TBL_EXT_ID TO L_TBL_EXT_ID.
CALL METHOD CL_R3_OLR3_METHODS=>CHECK_EXISTENCE
EXPORTING
IT_EXT_ID = L_TBL_EXT_ID
IV_TABNAME = H_G_TBL_DD03L-CHECKTABLE
IMPORTING
EV_RETURN = L_RETURN.
IF L_RETURN-TYPE = CNS_TYP_E.
PERFORM RETURN_MSG USING 'E' '/SAPNEA/J_SC' '084' H_G_TBL_DD03L-CHECKTABLE L_H_TBL_EXT_ID-OLR3_TAB_VALUE '' '' FC_RETURN.
RETURN.
ENDIF.
ENDIF.
ENDLOOP.
CALL FUNCTION 'ENQUEUE_E_TABLEE'
EXPORTING
TABNAME = FU_TABNAME
VARKEY = L_KEY
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* テーブル &1 をロックできませんでした
PERFORM RETURN_MSG USING 'E' 'BV' '019' FU_TABNAME '' '' '' FC_RETURN.
RETURN.
ENDIF.
CREATE DATA L_H_TBL TYPE (FU_TABNAME).
ASSIGN L_H_TBL->* TO <FS_ROW>.
SELECT SINGLE FOR UPDATE *
FROM (FU_TABNAME)
INTO <FS_ROW>
WHERE (L_TBL_WHERE).
CLEAR LV_UPD_FLG.
IF SY-SUBRC <> 0.
* 指定キーの更新データがありません。
PERFORM RETURN_MSG
USING 'E' 'PPETICMP' '009' TEXT-T02 '' '' '' FC_RETURN.
ELSE.
* 更新項目の値を設定
PERFORM CREAT_UPD_DATA
USING
FU_TABNAME
FU_UPD_FLD
FU_UPD_VAL
CHANGING
<FS_ROW>
FC_RETURN.
IF FC_RETURN IS INITIAL.
* 更新日付、時間、更新者、更新プログラム設定
ASSIGN COMPONENT 'YEUPDAT' OF STRUCTURE <FS_ROW> TO <FS_FIELD>.
IF SY-SUBRC = 0.
MOVE SY-DATUM TO <FS_FIELD>.
ENDIF.
ASSIGN COMPONENT 'YEUPTIM' OF STRUCTURE <FS_ROW> TO <FS_FIELD>.
IF SY-SUBRC = 0.
MOVE SY-UZEIT TO <FS_FIELD>.
ENDIF.
ASSIGN COMPONENT 'YEUPUNM' OF STRUCTURE <FS_ROW> TO <FS_FIELD>.
IF SY-SUBRC = 0.
MOVE SY-UNAME TO <FS_FIELD>.
ENDIF.
ASSIGN COMPONENT 'YEUPTCD' OF STRUCTURE <FS_ROW> TO <FS_FIELD>.
IF SY-SUBRC = 0.
MOVE 'Y_GL_M_RFC_UPDATE_TABLE' TO <FS_FIELD>.
ENDIF.
TRY.
UPDATE (FU_TABNAME) FROM <FS_ROW>.
* 更新成功フラグを設定.
MOVE ABAP_ON TO LV_UPD_FLG.
CATCH CX_SY_OPEN_SQL_DB.
CLEAR LV_UPD_FLG.
ENDTRY.
IF LV_UPD_FLG IS NOT INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = ABAP_ON.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
PERFORM RETURN_MSG
USING 'E' '1I' '888' FU_TABNAME '' '' '' FC_RETURN.
ENDIF.
ENDIF.
ENDIF.
CALL FUNCTION 'DEQUEUE_ALL'
EXPORTING
_SYNCHRON = ABAP_ON.
IF LV_UPD_FLG IS NOT INITIAL.
PERFORM RETURN_MSG
USING 'S' '1M' '804' FU_TABNAME TEXT-T01 '' '' FC_RETURN.
ENDIF.
ENDFORM. "F_UPD_TBL_DATA
*&---------------------------------------------------------------------*
*& Form F_SPLIT_TAB_TXT
*&---------------------------------------------------------------------*
* TABテキスト分割して値を内部テーブルに格納する
*----------------------------------------------------------------------*
FORM F_SPLIT_TAB_TXT USING VALUE(FU_TXT) TYPE STRINGVAL
CHANGING VALUE(FC_COLS) TYPE TYP_I_COL.
* TAB分割後の値を内部テーブルに格納する
SPLIT FU_TXT AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
INTO TABLE FC_COLS.
ENDFORM. "F_SPLIT_TAB_TXT
*&---------------------------------------------------------------------*
*& Form RETURN_MSG.
*&---------------------------------------------------------------------*
* メッセージ編集
*----------------------------------------------------------------------*
FORM RETURN_MSG USING
FU_TYPE TYPE BAPIRETURN-TYPE "メッセージタイプ.
FU_CL TYPE SY-MSGID "メッセージID
FU_NUMBER TYPE SY-MSGNO "メッセージ番号
FU_PAR1 TYPE C "TEXT.
FU_PAR2 TYPE C "TEXT.
FU_PAR3 TYPE C "TEXT.
FU_PAR4 TYPE C "TEXT.
FU_RESULT TYPE BAPIRET2. "処理結果テーブル
*----------------------------------------------------------------------*
DATA:L_MSGV1 TYPE SY-MSGV1,
L_MSGV2 TYPE SY-MSGV2,
L_MSGV3 TYPE SY-MSGV3,
L_MSGV4 TYPE SY-MSGV4.
*----------------------------------------------------------------------*
MOVE:FU_PAR1 TO L_MSGV1,
FU_PAR2 TO L_MSGV2,
FU_PAR3 TO L_MSGV3,
FU_PAR4 TO L_MSGV4.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
TYPE = FU_TYPE
CL = FU_CL
NUMBER = FU_NUMBER
PAR1 = L_MSGV1
PAR2 = L_MSGV2
PAR3 = L_MSGV3
PAR4 = L_MSGV4
IMPORTING
RETURN = FU_RESULT.
ENDFORM. "RETURN_MSG
订阅:
博文 (Atom)
Customer Characteristic
Characteristic Descriptions are stored in the table - CABNT - Language - SPRAS - Characteristic description - ATBEZ Characteristic Values ...
-
REPORT ZBPADD2 . DATA : L_PARTN_CAT TYPE BAPIBUS1006_HEAD - PARTN_CAT , LS_CENTRAL TYPE BAPIBUS1006_CENTRAL , ...
-
HEADER: ADD Customer Fields to structure of IMKPF and BAPI_TE_XMKPF. Items: ADD Customer Fields to structure of IMSEG and BAPI_TE_XMSEG....
-
FUNCTION:SD_SALESDOCUMENT_CREATE Append fiels to Structure below. BAPE_VBAP BAPE_VBAPX VBAPKOZ VBAPKOZX No need to append fields to Struc...