on 2007 Jan 18 12:19 PM
Good Morning and sorry for my poor english.
We have created a table in R/3 that contains a number of material and a minimum and Maximum amount for that material; at the same time we have created a function, that checks the material and if the amount of order asked for in the shoping cart of SRM this within the allowed values that we have kept in our table z.
On the other hand in SRM we have copied the Badi BBP_DOC_CHECK_BADI (ZBBP_DOC_CHECK_BADI1), which contains all the controls that we needed, but when we called to the function of R/3 via RFC, the parameters of the function in SRM come stuffed, but when we entered R/3, these parameters they are equal to spaces and the messages that gives back the function to SRM also go they are equal to spaces.
The RFCUSER have SAP_ALL and SAP_NEW
Associate codes of the function and the control of badi:
FUNCTION: Z35_MM_SRM_VAL_MAT_ALM
*"----
-
""Interfase local
*" IMPORTING
*" VALUE(I_MATNR) LIKE Z35_CHEK_MAT_ALM-MATNR
*" VALUE(I_CANTMIN) LIKE Z35_CHEK_MAT_ALM-ZCANTMIN
*" EXPORTING
*" VALUE(E_MATNR) LIKE Z35_CHEK_MAT_ALM-MATNR
*" VALUE(E_CANTMIN) LIKE Z35_CHEK_MAT_ALM-ZCANTMIN
*" VALUE(E_CANTMAX) LIKE Z35_CHEK_MAT_ALM-ZCANTMAX
*" VALUE(E_MEINS) LIKE Z35_CHEK_MAT_ALM-MEINS
*" TABLES
*" Z35_MM_BBP_SMESSAGES_BADI STRUCTURE Z35_MM_BBP_SMESSAGES_BADI
*"----
-
DATA: wa_mat_alm TYPE z35_chek_mat_alm.
DATA: ls_message TYPE z35_mm_bbp_smessages_badi.
DATA: var1 LIKE z35_chek_mat_alm-zcantmin,
cant LIKE z35_chek_mat_alm-zcantmin.
*data: x. do. if x = 'X'. exit. endif. enddo.
IF i_matnr IS INITIAL.
CLEAR: ls_message.
ls_message-msgty = 'E'.
ls_message-msgid = 'Z35MM'.
ls_message-msgno = '003'.
ls_message-message = 'Material en blanco'.
APPEND ls_message TO z35_mm_bbp_smessages_badi.
ELSE.
SELECT SINGLE * FROM z35_chek_mat_alm INTO CORRESPONDING
FIELDS OF wa_mat_alm WHERE matnr = i_matnr
AND zcantmin = i_cantmin.
AND meins = i_meins.
IF sy-subrc <> 0.
SELECT SINGLE * FROM z35_chek_mat_alm INTO CORRESPONDING
FIELDS OF wa_mat_alm WHERE matnr = i_matnr.
MOVE i_matnr TO e_matnr.
MOVE wa_mat_alm-zcantmin TO e_cantmin.
MOVE wa_mat_alm-zcantmax TO e_cantmax.
MOVE wa_mat_alm-meins TO e_meins.
CLEAR: ls_message.
ls_message-msgty = 'E'.
ls_message-msgid = 'Z35MM'.
ls_message-msgno = '003'.
ls_message-message = text-003.
APPEND ls_message TO z35_mm_bbp_smessages_badi.
ELSE.
MOVE i_cantmin TO var1.
cant = i_cantmin + var1.
CONDENSE cant NO-GAPS.
IF NOT cant <= wa_mat_alm-zcantmax.
CLEAR: ls_message.
ls_message-msgty = 'E'.
ls_message-msgid = 'Z35MM'.
ls_message-msgno = '004'.
ls_message-message = text-004.
APPEND ls_message TO z35_mm_bbp_smessages_badi.
ENDIF.
ENDIF.
MOVE i_matnr TO e_matnr.
MOVE wa_mat_alm-zcantmin TO e_cantmin.
MOVE wa_mat_alm-zcantmax TO e_cantmax.
MOVE wa_mat_alm-meins TO e_meins.
ENDIF.
ENDFUNCTION.
Badi ZBBP_DOC_CHECK_BADI1
METHOD if_ex_bbp_doc_check_badi~bbp_doc_check.
DATA: ls_header TYPE bbp_pds_sc_header_d,
lt_item TYPE TABLE OF bbp_pds_sc_item_d,
ls_item TYPE bbp_pds_sc_item_d,
ls_message TYPE bbp_smessages_badi.
08/01/07 Inicio
DATA: cant_posic TYPE N,
const_posic TYPE N value 6.
08/01/07 Fin
11/01/07 Inicio
data: i_matnr(18),
i_cantmin(17),
meins(3),
d_destinorfc(10),
producto(40),
matnr(18),
cantmin(17).
data: LV_PROD_GUID TYPE COMT_PRODUCT_GUID.
data: ls_com_product type COMT_PRODUCT.
11/01//07 Fin
Solicitar la cesta de la compra
IF iv_mode = 'T' OR " check shopping cart
iv_save = 'X'. " order shopping cart
Recogemos los datos de la cesta de la compra
CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
EXPORTING
i_guid = iv_doc_guid
i_with_itemdata = 'X'
IMPORTING
e_header = ls_header
TABLES
e_item = lt_item.
select single desti_logico into d_destinorfc
from z35_srm_conex
where aplicacion = 'R3'.
loop at lt_item into ls_item.
i_cantmin = abs( ls_item-quantity ).
condense i_cantmin no-gaps.
cantmin = i_cantmin.
meins = ls_item-unit.
LV_PROD_GUID = ls_item-product.
CALL FUNCTION 'COM_PRODUCT_READ_SINGLE'
EXPORTING
IV_PRODUCT_GUID = LV_PROD_GUID
IMPORTING
ES_PRODUCT = ls_com_product
EXCEPTIONS
NOT_FOUND = 1
WRONG_CALL = 2
FOREIGN_LOCK = 3
ENQUEUE_FAILED = 4
OTHERS = 5.
if sy-subrc = 0.
producto = ls_com_product-product_id.
move producto+22(18) to matnr.
endif.
call function 'Z35_MM_SRM_VAL_MAT_ALM' destination d_destinorfc
importing
exporting
i_matnr = matnr
i_cantmin = cantmin
i_meins = meins
tables
ls_messages = et_messages.
endloop.
11/01/07 Fin
ENDIF. " iv_mode / iv_save
As we can solve this problem?????
Thanks to all and a greeting.
Guillermo Pérez
Request clarification before answering.
Hi Guillermo,
Check Data Element for following fields:
- i_matnr, matnr
- i_cantmin, cantmin
- i_meins, meins
There must be the same on both side (SRM and backend).
Check also if parameter d_destinorfc is properly filled.
Regards,
Marcin Gajewski
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Couple of things to check out -
1) Check whether the function module RFC-enabled.
2) Is the table Z35_MM_BBP_SMESSAGES_BADI is appended with the messages after the function call both via SRM and R/3
3) Which SRM version and what support pack you are currently on ?
Hope it helps.
Pls reward suitable points.
Regards
- Atul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi.
Except the versions of the SRM and the SRM_SERVER and the packages, the rest of the answers are proved and it has not worked, the problem resides in which the data are lost between SRM and R/3
The version of SRM is 5.0
The version of SRM_SERVER is 5.50
The Support Packages are:
- SAP_BASIS
Release - 700
Level- 0010
Support Packages - SAPKB70010
- SRM_PLUS
Release - 550
Level - 0007
Support Packages - SAPKIBK007
-SRM_SERVER
Release - 550
Level - 0007
Support Packages - SAPKIBKT07
Greetings
Guillermo Pérez
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.