data: lt_SEARCHRESULT type table of BAPIBUS1006_BP_ADDR,
lt_CENTRALDATA_PERSON type table of BAPIBUS1006_ADDRESS,
lt_RETURN type table of BAPIRET2,
lt_up_return type table of BAPIRET2.
data: ls_centraldata type BAPIBUS1006_CENTRAL_SEARCH,
ls_ET_ADDR_DETAILS type BAPIBUS1006_ADDRESS,
ls_ET_DATA_ORGAN type BAPIBUS1006_CENTRAL_ORGAN,
ls_ET_DATA_PERSON type BAPIBUS1006_CENTRAL_PERSON,
ls_ET_BP_CENTRAL type BAPIBUS1006_CENTRAL,
ls_ET_BP_HEAD type BAPIBUS1006_HEAD,
ls_SEARCHRESULT type BAPIBUS1006_BP_ADDR,
ls_RETURN type BAPIRET2,
ls_up_return type BAPIRET2,
ls_ET_BP_CENTRAL_X type BAPIBUS1006_CENTRAL_X,
ls_ET_DATA_ORGAN_X type BAPIBUS1006_CENTRAL_ORGAN_X,
ls_ET_DATA_PERSON_X type BAPIBUS1006_CENTRAL_PERSON_X.
data: lv_category type BU_TYPE,
lv_partner type BU_PARTNER,
inc type i.
* I_TYPE = GET ( Search All )
* I_TYPE = EDT ( Edit = Add or Update )
case I_TYPE.
when 'GET'.
* Get All partners
* "*" - means search all
ls_centraldata-MC_NAME1 = '*'.
* 1) get person data lv_cat = 1
* 2) get company data lv_cat = 2
APPEND ls_ET_ADDR_DETAILS TO ET_ADDR_DETAILS.
APPEND ls_ET_DATA_PERSON TO ET_DATA_PERSON.
APPEND ls_ET_DATA_ORGAN TO ET_DATA_ORGAN.
endloop.
when 'EDT'.
* PARTN_CAT = 1 - PERSON
* PARTN_CAT = 2 - ORGAN
* ET_BP_HEAD contains all bp and cp, with different partn_cat
* partner number (1...5)
loop at ET_BP_HEAD into ls_ET_BP_HEAD.
* ls_ET_BP_HEAD-BPARTNER = lv_partner.
* Check category of partner
if ls_ET_BP_HEAD-PARTN_CAT = 1.
clear ls_ET_DATA_ORGAN.
read table ET_DATA_PERSON into ls_ET_DATA_PERSON index SY-TABIX.
else.
clear ls_ET_DATA_PERSON.
read table ET_DATA_ORGAN into ls_ET_DATA_ORGAN index SY-TABIX.
endif.
* Read rest of object
read table ET_ADDR_DETAILS into ls_ET_ADDR_DETAILS index SY-TABIX.
read table ET_BP_CENTRAL into ls_ET_BP_CENTRAL index SY-TABIX.
if ls_ET_BP_HEAD-BPARTNER is not initial.
read table ET_BP_CENTRAL_X into ls_ET_BP_CENTRAL_X index SY-TABIX.
read table ET_DATA_ORGAN_X into ls_ET_DATA_ORGAN_X index SY-TABIX.
read table ET_DATA_PERSON_X into ls_ET_DATA_PERSON_X index SY-TABIX.
* add comments or error message
if lt_RETURN is not initial.
loop at lt_RETURN into ls_RETURN.
append ls_RETURN to ET_RETURN.
endloop.
clear lt_RETURN.
else.
ls_RETURN-message = 'Added'.
append ls_RETURN to ET_RETURN.
endif.
* fill new nr_partner
* if lv_partner co '1234567890 '.
* unpack lv_partner to lv_partner.
* endif.
ls_ET_BP_HEAD-BPARTNER = lv_partner.
modify ET_BP_HEAD from ls_ET_BP_HEAD.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.