on 08-03-2007 4:44 AM
Modify Wrapper :ZGET_AM_P2P
I have read the requirement :
-replace entire item data with entries of table parameters
pls tell me the code will work or not if i put in syncBo
FUNCTION ZGET_AM_P2P.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(V_ANLN) LIKE ANLA-ANLN1 OPTIONAL
*" VALUE(V_STORT) LIKE ANLZ-STORT OPTIONAL
*" EXPORTING
*" VALUE(V_MSG) TYPE STRING
*"----------------------------------------------------------------------
TABLES : anla, anlz, anlh.
DATA : v_date LIKE sy-datum,
var1 like BALM-MSGV1,
var2 like BALM-MSGV2.
refresh : bdcdata, messtab.
clear : bdcdata, messtab, v_msg, v_date.
SELECT SINGLE * FROM anla WHERE anln1 = v_anln
AND bukrs = '1000'.
SELECT SINGLE * FROM anlz WHERE anln1 = v_anln
AND bukrs = '1000'.
SELECT SINGLE * FROM anlh WHERE anln1 = v_anln
AND bukrs = '1000'.
CONCATENATE anla-aktiv+6(02) anla-aktiv+4(02) anla-aktiv(04) INTO v_date.
CALL FUNCTION 'ZBAPI_AM_P2P'
EXPORTING
V_ANLN = ANLA-ANLN1
V_STORT = v_STORT
V_TXT50 = ANLA-TXT50
V_ANLHTXT = ANLH-ANLHTXT
V_KOSTL = ANLZ-KOSTL
V_WERKS = ANLZ-WERKS
V_DATE = v_date
IMPORTING
V_MSG = v_msg
.
ENDFUNCTION.
FUNCTION zbapi_am_p2p.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(V_ANLN) LIKE ANLA-ANLN1 OPTIONAL
*" VALUE(V_STORT) LIKE ANLZ-STORT OPTIONAL
*" VALUE(V_TXT50) LIKE ANLA-TXT50 OPTIONAL
*" VALUE(V_ANLHTXT) LIKE ANLH-ANLHTXT OPTIONAL
*" VALUE(V_KOSTL) LIKE ANLZ-KOSTL OPTIONAL
*" VALUE(V_WERKS) LIKE ANLZ-WERKS OPTIONAL
*" VALUE(V_DATE) LIKE SY-DATUM OPTIONAL
*" EXPORTING
*" VALUE(V_MSG) TYPE STRING
*"----------------------------------------------------------------------
DATA : var1 LIKE balm-msgv1,
var2 LIKE balm-msgv2.
PERFORM open_group.
PERFORM bdc_dynpro USING 'SAPLAIST' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE' '=MAST'.
PERFORM bdc_field USING 'ANLA-ANLN1' v_anln.
PERFORM bdc_field USING 'ANLA-ANLN2' '0'.
PERFORM bdc_field USING 'ANLA-BUKRS' '1000'.
PERFORM bdc_dynpro USING 'SAPLAIST' '1000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=TAB02'.
PERFORM bdc_field USING 'ANLA-TXT50' v_txt50.
PERFORM bdc_field USING 'ANLH-ANLHTXT' v_anlhtxt.
PERFORM bdc_field USING 'ANLA-AKTIV' v_date.
PERFORM bdc_dynpro USING 'SAPLAIST' '1000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BUCH'.
PERFORM bdc_field USING 'ANLZ-KOSTL' v_kostl.
PERFORM bdc_field USING 'ANLZ-WERKS' v_werks.
PERFORM bdc_field USING 'ANLZ-STORT' v_stort.
PERFORM bdc_dynpro USING 'SAPLAIST' '3020'.
PERFORM bdc_field USING 'BDC_OKCODE' '=YES'.
CALL TRANSACTION 'AS02' USING bdcdata MODE 'N'
UPDATE 'S'
MESSAGES INTO messtab.
PERFORM close_group.
READ TABLE messtab INDEX 1.
MOVE messtab-msgv1 TO var1.
MOVE messtab-msgv2 TO var2.
CLEAR v_msg.
CALL FUNCTION 'MESSAGE_PREPARE'
EXPORTING
language = 'E'
msg_id = messtab-msgid
msg_no = messtab-msgnr
msg_var1 = var1
msg_var2 = var2
* MSG_VAR3 = ' '
* MSG_VAR4 = ' '
IMPORTING
msg_text = v_msg
EXCEPTIONS
function_not_completed = 1
message_not_found = 2
OTHERS = 3.
ENDFUNCTION.
pls advice
Hi,
The code will work in a normal scenario. I want to know if the ZGET_AM_P2P will be the modify BAPI wrapper for your syncBO.
Thanks...
Preetham S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> Modify Wrapper :ZGET_AM_P2P
> I have read the requirement :
> -replace entire item data with entries of table
> parameters
>
> pls tell me the code will work or not if i put in
> syncBo
won't work. to make this as a BAPI wrapper for your SyncBo, you need to implement the right interface i.e has the proper import/export parameters.
The function module must have the following parameters defined:
Import Structure to hold the BO header data being modified
Tables Table(s) to hold the list(s) of associated item data, which are used to replace (add/modify/delete) the item data
RETURN as Export or Tables parameter
refer to the link for details:
regards
jo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i have change to this:
before we come to the logic
if the modify wrapper is call, it will insert something into the zztable
with this statement
<b>insert zztable.</b>
but after i modify the value and try to sync, i dont see this modify wrapper is called.
i try using the ZCON like merep_contact_getlist, getdetail, modify and it works successfully.
According to the MDK
<b>Change </b> Modifies the header and/or items of the specified business object.<u> The function needs to replace the entire item data with the entries of Tables parameters. </u>
doest the function below satisfy the rule set by MDK?
I scatch my head to check what is going wrong ?
function ZGET_am_p2p.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(AM_DATA) LIKE ZASTMS STRUCTURE ZASTMS OPTIONAL
*" EXPORTING
*" VALUE(V_MSG) TYPE STRING
*" VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
*" TABLES
*" AM_DETAILS STRUCTURE ZASTMS OPTIONAL
*"----------------------------------------------------------------------
tables : anla, anlz, anlh, zztable.
data : v_date like sy-datum,
var1 like balm-msgv1,
var2 like balm-msgv2.
refresh : bdcdata, messtab.
clear : bdcdata, messtab, v_msg, v_date.
concatenate am_data-anln1 am_data-werks am_data-STORT sy-datum sy-uzeit into zztable-char100
separated by space.
insert zztable.
select single * from anla where anln1 = am_data-anln1
and bukrs = '1000'.
select single * from anlz where anln1 = am_data-anln1
and bukrs = '1000'.
select single * from anlh where anln1 = am_data-anln1
and bukrs = '1000'.
concatenate anla-aktiv+6(02) anla-aktiv+4(02) anla-aktiv(04) into v_date.
call function 'ZBAPI_AM_P2P'
exporting
v_anln = anla-anln1
v_stort = am_data-stort
v_txt50 = anla-txt50
v_anlhtxt = anlh-anlhtxt
v_kostl = anlz-kostl
v_werks = anlz-werks
v_date = v_date
importing
v_msg = v_msg.
append am_data to am_details.
endfunction.
FUNCTION zbapi_am_p2p.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(V_ANLN) LIKE ANLA-ANLN1 OPTIONAL
*" VALUE(V_STORT) LIKE ANLZ-STORT OPTIONAL
*" VALUE(V_TXT50) LIKE ANLA-TXT50 OPTIONAL
*" VALUE(V_ANLHTXT) LIKE ANLH-ANLHTXT OPTIONAL
*" VALUE(V_KOSTL) LIKE ANLZ-KOSTL OPTIONAL
*" VALUE(V_WERKS) LIKE ANLZ-WERKS OPTIONAL
*" VALUE(V_DATE) LIKE SY-DATUM OPTIONAL
*" EXPORTING
*" VALUE(V_MSG) TYPE STRING
*"----------------------------------------------------------------------
DATA : var1 LIKE balm-msgv1,
var2 LIKE balm-msgv2.
PERFORM open_group.
PERFORM bdc_dynpro USING 'SAPLAIST' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE' '=MAST'.
PERFORM bdc_field USING 'ANLA-ANLN1' v_anln.
PERFORM bdc_field USING 'ANLA-ANLN2' '0'.
PERFORM bdc_field USING 'ANLA-BUKRS' '1000'.
PERFORM bdc_dynpro USING 'SAPLAIST' '1000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=TAB02'.
PERFORM bdc_field USING 'ANLA-TXT50' v_txt50.
PERFORM bdc_field USING 'ANLH-ANLHTXT' v_anlhtxt.
PERFORM bdc_field USING 'ANLA-AKTIV' v_date.
PERFORM bdc_dynpro USING 'SAPLAIST' '1000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BUCH'.
PERFORM bdc_field USING 'ANLZ-KOSTL' v_kostl.
PERFORM bdc_field USING 'ANLZ-WERKS' v_werks.
PERFORM bdc_field USING 'ANLZ-STORT' v_stort.
PERFORM bdc_dynpro USING 'SAPLAIST' '3020'.
PERFORM bdc_field USING 'BDC_OKCODE' '=YES'.
CALL TRANSACTION 'AS02' USING bdcdata MODE 'N'
UPDATE 'S'
MESSAGES INTO messtab.
PERFORM close_group.
READ TABLE messtab INDEX 1.
MOVE messtab-msgv1 TO var1.
MOVE messtab-msgv2 TO var2.
CLEAR v_msg.
CALL FUNCTION 'MESSAGE_PREPARE'
EXPORTING
language = 'E'
msg_id = messtab-msgid
msg_no = messtab-msgnr
msg_var1 = var1
msg_var2 = var2
* MSG_VAR3 = ' '
* MSG_VAR4 = ' '
IMPORTING
msg_text = v_msg
EXCEPTIONS
function_not_completed = 1
message_not_found = 2
OTHERS = 3.
ENDFUNCTION.
<b></b>
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.