Functionality The person address for the specified object type and key is found, andupdated with the specified address and communication data, if required. This module differs from a standard change BAPI in that not only canexisting entries be changed, address attribute telephone numbers, faxnumbers, etc. can also be deleted or inserted. Reference structures (checkboxes) are used to select entries to bechanged. Example * Change a person address: * Change, delete and add a telephone number DATA: objtype LIKE bapi4002_1-objtype, obj_id LIKE bapi4002_1-objkey, obj_id_ext LIKE bapi4002_1-extension, context LIKE bapi4002_1-context, address_number LIKE adrc-addrnumber, person_number LIKE adrp-persnumber, bapiadtel LIKE bapiadtel OCCURS 0 WITH HEADER LINE, bapiadtel_x LIKE bapiadtelx OCCURS 0 WITH HEADER LINE, return LIKE bapiret2 OCCURS 0. * Assign the following object type and object key to the * private address of a customer contact person objtype = 'BUS1006001' obj_id = obj_id_ext = ' ' context = '0004' * Get the existing data by calling e.g. FM 'BAPI_ADDRESSPERS_GETDETAIL' ... * Enter the reference structure data * The telephone number with serial number '002', is to be deleted * the with serial number '003' updated * soll aktualisiert werden. CLEAR: bapiadtel[], bapiadtel_x[]. CLEAR: bapiadtel, bapiadtel_x. bapiadtel_x-updateflag = 'D'. APPEND: bapiadtel, bapiadtel_x. "Delete entry CLEAR: bapiadtel, bapiadtel_x. bapiadtel-extension = '77733'. bapiadtel_x-extension = 'X'. bapiadtel_x-updateflag = 'U'. APPEND: bapiadtel, bapiadtel_x. "Update entry CLEAR: bapiadtel, bapiadtel_x. bapiadtel-telephone = '06227'. bapiadtel-extension = '11111'. bapiadtel_x-updateflag = 'I'. APPEND: bapiadtel, bapiadtel_x. "Insert new entry * call the change module CALL FUNCTION 'BAPI_ADDRESSPERS_CHANGE' EXPORTING obj_type = objtype obj_id = obj_id obj_id_ext = obj_id_ext context = context IMPORTING address_number = address_number person_number = person_number TABLES bapiadtel = bapiadtel bapiadtel_x = bapiadtel_x return = return. * Errors and warnings are in the table RETURN. If successful, the * person address and its communication data are updated. * The address number is in the field ADDRESS_NUMBER, the person number * in the field PERSON_NUMBER.Notes To delete e.g. a telephone number in the table of existing Telephonenumbers of an address, the field 'UPDATEFLAG' in the correspondingreference structure line must contain 'D'. To insert an entry it must be 'I', and be accompanied by the data to beinserted. All lines to be inserted (I), and their reference structures, must beafter all entries to be changed (U) and deleted (D). Change data key fields must always be filled and are used as far aspossible. It is not significant whether e.g. all telephone numbercomments are followed by fax number comments, or vice versa; only thesequence among entries with the same key is important, unless youspecify communication address or comment serial numbers partially ornot at all, when the sequence is significant. The key fields are: Structure | Fields --------------------------------- BAPIAD2VL | ADDR_VERS, FROM_DATE BAPIAD_REM | ADDR_VERS, LANGU BAPIADTEL | CONSNUMBER ... | ... BAPIADPAG | CONSNUMBER BAPICOMREM | COMM_TYPE, CONSNUMBER, LANGU You can pass communication address and comment serial numbers empty.The data sequence is then significant. For example to delete thetelephone number in the second position in the in ascending order ofserial number sorted existing telephone numbers, in the database, youmust pass a dummy telephone number with an update flag (U) in the firstposition, without selecting fields to update, und a telephone numberwith delete flag (D) in the second position. The communication addresses in the database are not usually sorted byserial number, so you must first determine the sequence ofcommunication addresses sorted by serial number. This is not advisable because you can easily make date sequence errors.Specifying serial numbers as keys is safer. You should assign your own serial numbers for communication addressesand their comments to be inserted (I), so that the communicationaddress - comment assignment is clear. Ensure that the serial numbersare not already used in the database, unless you want to assign acomment explicitly to an existing communication address. If you assignno numbers, it is assumed that all comments to be inserted belong tothe communication addresses to be inserted, and they are assigned bythe sequence of the data passed. (This would be appropriate if acomment is to be inserted for another language than the creationlanguage of a communication address). Then the first telephone numbercomment in German flagged for insertion (I) is assigned to the firsttelephone number to be inserted. The third fax number comment inEnglish to be inserted (I) is assigned to the third fax number to beinserted specified. In this case you cannot assign a comment to an existing communicationaddress. You need a serial number to do this. If one type of communication address and its comments has serialnumbers and another does not, this does not affect the overallfunctionality. All communication types are processed separately, i.e.if all addresses of a communication type have serial numbers, they areused, even if there are no serial numbers for all or some addresses ofanother communication type. The addresses of such communication typesare processed in the order of their data. You can specify serial numbers for communication addresses to beinserted (I) and omit them for communication addresses to be updated(U) and deleted (D), and vice versa. They are processed separatelyusing serial numbers or the data sequence as appropriate. Communicationaddresses to be updated (U) or delete (D) must both be passed eithercompletely with or completely without serial numbers. You are on the safe side if you always pass a serial number. You must first read the data to be changed (e.g. using FMBAPI_ADDRESSPERS_GETDETAIL), if communication data is also to bechanged to get the communication data serial numbers. The address number of the person address for the object type and key,is returned in the export parameter ADDRESS_NUMBER, the person numberin the field PERSON_NUMBER. Processing warnings and errors are in the table RETURN. INCLUDE ADDRESS_TSADOBJ_AND_BAPIS OBJECT DOKU ID TX INCLUDE ADDR_NO_COMMIT_IN_BAPI OBJECT DOKU ID TX INCLUDE ADDR_RETURN_CONSNUMBERS OBJECT DOKU ID TX INCLUDE ADDRESS_CONSNUMBERS_IN_BAPIS OBJECT DOKU ID TX Description If the ACCEPT_ERROR parameter is set, all regional structure checkerror messages are treated as warnings. Value range 'X': all errors are treated as warnings ' ': errors are treated as errors Default The flag is not set, i.e. is ' '. |