on 02-26-2012 6:49 AM
I am working on srm and my requirement is as below ,
i need to populate an error message if the shopping cart has line items of different types
i am doing coding as below ,
CALL FUNCTION BBP_PROCDOC_GETDETAIL
EXPORTING
i_guid = iv_doc_guid
IMPORTING
e_header = ls_header
TABLES
e_item = lt_item
e_account = lt_account
e_limit = lt_limit
e_partner = lt_partner
e_orgdata = lt_orgdata
e_messages = lt_in_messages.
LOOP AT lt_item INTO ls_item WHERE del_ind EQ space.
Select * from ZSRM_WGR_SORTEN where
WGRID_ADD = ls_item-( which field I has to take ) and
PROCID_ADD = ls_item-( which field I has to take .
If sy-subrc ne 0.
Throw an error message.
endif.
ENDLOOP.
Please check is it correct coding according to below 2 statements within loop and endloop
And suggest if changes required thanks ,
1
Determine and note the product categories-ID and process-ID (using item data, process-ID is a customer field, see CD 2553_E_1_procurement_010 for process-ID) of an item in an internal table.
2
If 1st item: continue, otherwise: check, whether same product category and process-ID are noted already. If no: is the combination of WGR_ID_ADD and PROCID_ADD as per table ZSRM_WGR_SORTEN is allowed:
If no: Display an error message.
Also Please check code between loop and endloop and check whether select statement is correct ,My question is in select statement in where condition which fields I has to take .
Hi,
Try this in BADI IF_EX_BBP_DOC_CHECK_BADI~BBP_DOC_CHECK:
DATA: ls_type type ZSRM_WGR_SORTEN,
ls_type_temp like ls_type,
lt_type like table of ZSRM_WGR_SORTEN with header-line.
CALL FUNCTION BBP_PROCDOC_GETDETAIL
EXPORTING
i_guid = iv_doc_guid
IMPORTING
e_header = ls_header
TABLES
e_item = lt_item
e_account = lt_account
e_limit = lt_limit
e_partner = lt_partner
e_orgdata = lt_orgdata
e_messages = lt_in_messages.
clear: ls_type, ls-type_temp, lt_type[].
LOOP AT lt_item INTO ls_item WHERE del_ind EQ space.
MOVE: ls_item-CATEGORY_ID to ls_type-WGRID_ADD,
ls_item-Zxxxx to ls_type-PROCID_ADD.
if lt_type[] is initial
*First Item Check, combination is allowed ? Only append table lt_type otherwise
SELECT SINGLE * from ZSRM_WGR_SORTEN where
WGRID_ADD = ls_type-WGRID_ADD and
PROCID_ADD = ls_type-PROCID_ADD .
If sy-subrc ne 0.
*Fill ET_MESSAGES table with your message
else.
append ls_type to lt_type.
endif.
else.
*Check the combination correspond to a previous item: why not check directly ZSRM_WGR_SORTEN ?
read table lt_type with key WGRID_ADD=ls_type-WGRID_ADD PROCID_ADD= ls_type-PROCID_ADD into .
if sy-subrc EQ 0. " Entry is valid, continue
continue
else.
SELECT SINGLE * from ZSRM_WGR_SORTEN where
WGRID_ADD = ls_type-WGRID_ADD and
PROCID_ADD = ls_type-PROCID_ADD .
If sy-subrc ne 0.
*Fill ET_MESSAGES table with your message
else.
append ls_type to lt_type.
endif.
endif.
endif.
ENDLOOP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
dear veeru
it can be done by the help of badi BBP_DOC_CHECK_BADI.
will you pls specify what is WGRID_ADD and PROCID_ADD ????
Is this a combination of material group with the materials ??
regards
sahil p
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.