2008 Mar 06 12:01 PM
The BDC for transaction WPMA is simple but at the end of the transaction, my call transaction is not showing any messege. Pls can any one tell me ,what is that I am missing in my code. Pls note, , unlike other normal BDC's , no data is updated in data base table , rather an IDOC is generated, with some segments.
Pls see the code...and tell me if thee is anything wrong inh my code.
report ZMM_BDC_WPMA
no standard page heading line-size 255.
Data: wa_bonusbuy type zbonusbuy,
it_bonusbuy type standard table of zbonusbuy with header line,
it_t001w type standard table of t001w with header line.
DATA : IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
data: bdcdata like table of bdcdata with header line.
DATA: lv_mode(1) VALUE 'A'.
DATA : mtext(100) TYPE c,
mvar1 LIKE balm-msgv1,
w_msg(200) TYPE c.
*include bdcrecx1.
start-of-selection.
start-of-selection.
Select werks from t001w into corresponding fields of table it_t001w.
Delete adjacent duplicates from it_t001w comparing werks.
If not it_t001w[] is initial.
select store bbynr from zbonusbuy into corresponding fields of table it_bonusbuy for all
entries in it_t001w where store = it_t001w-werks.
If sy-subrc = 0.
Sort it_bonusbuy by store.
Endif.
Endif.
Break retaildev.
Break-point.
Refresh it_t001w.
Loop at it_bonusbuy.
Break retaildev.
*perform open_group.
perform bdc_dynpro using 'RWDPOSAN' '1000'.
perform bdc_field using 'BDC_CURSOR'
'SO_BBUY-LOW'.
perform bdc_field using 'BDC_OKCODE'
'=ONLI'.
perform bdc_field using 'PA_VKORG'
'hb00'.
perform bdc_field using 'PA_VTWEG'
'h2'.
perform bdc_field using 'SO_FISEL-LOW'
's001'.
it_bonusbuy-store.
perform bdc_field using 'PA_BBUY'
'X'.
perform bdc_field using 'SO_BBUY-LOW'
'TEST_00032'.
it_bonusbuy-bbynr.
perform bdc_transaction using 'WPMA'.
*perform close_group.
*clear ibdc.
*refresh ibdc.
Endloop.
CALL TRANSACTION 'WPMA' USING bdcdata
MODE lv_mode
UPDATE 'A'
MESSAGES INTO IT_BDCMSGCOLL.
Loop at IT_BDCMSGCOLL.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = IT_BDCMSGCOLL-msgid
LANG = sy-langu
NO = IT_BDCMSGCOLL-msgnr
V1 = IT_BDCMSGCOLL-msgv1
V2 = IT_BDCMSGCOLL-msgv2
V3 = IT_BDCMSGCOLL-msgv3
V4 = IT_BDCMSGCOLL-msgv4
IMPORTING
MSG = w_msg
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE :/10 'Message: ', w_msg.
Endloop.
.
----
Start new screen *
----
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
----
Insert field *
----
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "BDC_FIELD
The BDC for transaction WPMA is simple but at the end of the transaction, my call transaction is not showing any messege. Pls can any one tell me ,what is that I am missing in my code. Pls note, , unlike other normal BDC's , no data is updated in data base table , rather an IDOC is generated, with some segments.
Pls see the code...and tell me if thee is anything wrong inh my code.
report ZMM_BDC_WPMA
no standard page heading line-size 255.
Data: wa_bonusbuy type zbonusbuy,
it_bonusbuy type standard table of zbonusbuy with header line,
it_t001w type standard table of t001w with header line.
DATA : IT_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
data: bdcdata like table of bdcdata with header line.
DATA: lv_mode(1) VALUE 'A'.
DATA : mtext(100) TYPE c,
mvar1 LIKE balm-msgv1,
w_msg(200) TYPE c.
*include bdcrecx1.
start-of-selection.
start-of-selection.
Select werks from t001w into corresponding fields of table it_t001w.
Delete adjacent duplicates from it_t001w comparing werks.
If not it_t001w[] is initial.
select store bbynr from zbonusbuy into corresponding fields of table it_bonusbuy for all
entries in it_t001w where store = it_t001w-werks.
If sy-subrc = 0.
Sort it_bonusbuy by store.
Endif.
Endif.
Break retaildev.
Break-point.
Refresh it_t001w.
Loop at it_bonusbuy.
Break retaildev.
*perform open_group.
perform bdc_dynpro using 'RWDPOSAN' '1000'.
perform bdc_field using 'BDC_CURSOR'
'SO_BBUY-LOW'.
perform bdc_field using 'BDC_OKCODE'
'=ONLI'.
perform bdc_field using 'PA_VKORG'
'hb00'.
perform bdc_field using 'PA_VTWEG'
'h2'.
perform bdc_field using 'SO_FISEL-LOW'
's001'.
it_bonusbuy-store.
perform bdc_field using 'PA_BBUY'
'X'.
perform bdc_field using 'SO_BBUY-LOW'
'TEST_00032'.
it_bonusbuy-bbynr.
perform bdc_transaction using 'WPMA'.
*perform close_group.
*clear ibdc.
*refresh ibdc.
Endloop.
CALL TRANSACTION 'WPMA' USING bdcdata
MODE lv_mode
UPDATE 'A'
MESSAGES INTO IT_BDCMSGCOLL.
Loop at IT_BDCMSGCOLL.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = IT_BDCMSGCOLL-msgid
LANG = sy-langu
NO = IT_BDCMSGCOLL-msgnr
V1 = IT_BDCMSGCOLL-msgv1
V2 = IT_BDCMSGCOLL-msgv2
V3 = IT_BDCMSGCOLL-msgv3
V4 = IT_BDCMSGCOLL-msgv4
IMPORTING
MSG = w_msg
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE :/10 'Message: ', w_msg.
Endloop.
.
----
Start new screen *
----
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
----
Insert field *
----
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "BDC_FIELD
2008 Mar 06 1:45 PM
Hi,
What u can do is Read your Messages table with message types E(Error) and A(Abort). IF NOT sy-subrc IS INITIAlL means your transaction is successfull. So u can give your custom message saying IDOC sent successfully.
READ TABLE IT_BDCMSGCOLL WITh KEY TYPE = 'E'.
IF NOT sy-subrc IS INITIAL.
READ TABLE IT_BDCMSGCOLL WITH KEY TYPE = 'A'
IF NOT sy-subrc IS INITIAL.
MESSAGE i000 WITH 'IDOC sent successfully'.
ELSE.
MESSAGE i000 WITH 'Problem in sending IDOC'.
ENDIF.
ELSE.
MESSAGE i000 WITH 'Problem in sending IDOC'.
ENDIF.
Thanks,
Vinod.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |