‎2008 Mar 18 11:23 AM
How to validate IDOC data using user exit? What are the parameters have to be considered?
‎2008 Mar 18 12:26 PM
create and fill include in the corresponding function exit in tcode cmod
A.
‎2008 Mar 19 5:42 AM
Hi Vinay,
Consider the import and Table paramters for the UserExit .
To validate Please find the Procedure
1)READ TABLE t_idoc_data INTO is_edidd WITH KEY segnam = c_segnam_e1edp02.
t_idoc_data is the internal table of Idoc data .
is_edidd decalre it as type of edidd .
MOVE: is_edidd-sdata TO is_e1edp02,(Move the sdata to is_e1edp02 , whcih is type decalred as is_e1edp02 type e1edp02) .Then simply move to varaibles as per ur functionality .
move :is_e1edp02-belnr TO l_ebeln,
is_e1edp02-zeile TO l_ebelp.
if possible give ur function module name so that i can give better input to you.
Please find the Sample code .
********Start of validation for the Vendor and Company Code *********
***Variable Declaration
DATA : l_ebeln TYPE ebeln, "Purchasing Document Number
l_ebelp TYPE ebelp, "Purchasing Document item
***Structure Declaration
is_edidd TYPE edidd, "Segment e1edidd
is_e1edp01 TYPE e1edp01, "Segment e1edp01
is_e1edK01 TYPE e1edK01, "Segment e1edp01
is_e1edp02 TYPE e1edp02, "Segment e1edp02
is_e1edp26 TYPE e1edp26, "Segment e1edp26
is_e1edk04 TYPE e1edk04. "Segment e1edk04
***Types Declaration
TYPES : BEGIN OF ty_ekko,
lifnr TYPE ekko-lifnr,
bukrs TYPE ekko-bukrs,
waers TYPE ekko-waers,
END OF ty_ekko.
DATA : it_ekko TYPE TABLE OF ty_ekko,
wa_ekko LIKE LINE OF it_ekko,
L_FLAG(1) TYPE C .
***Constant Declaration
CONSTANTS : c_segnam_e1edp02 TYPE edi_segnam VALUE 'E1EDP02',
c_segnam_e1edk01 TYPE edi_segnam VALUE 'E1EDK01',
c_x TYPE char1 VALUE 'X',
C_USD(3) TYPE C VALUE 'USD'.
READ TABLE t_idoc_data INTO is_edidd
WITH KEY segnam = c_segnam_e1edp02. "#EC *
IF sy-subrc EQ 0.
MOVE:is_edidd-sdata TO is_e1edp02,
is_e1edp02-belnr TO l_ebeln,
is_e1edp02-zeile TO l_ebelp.
ENDIF.
SELECT SINGLE lifnr bukrs waers FROM ekko INTO wa_ekko WHERE
ebeln = l_ebeln.
IF wa_ekko-lifnr IS NOT INITIAL.
e_bukrs = wa_ekko-bukrs.
e_change = c_x.
ELSE.
message e899(f4) with text-006.
ENDIF.
if NOT wa_ekko-waers = c_USD.
is_e1edk01-CURCY = WA_EKKO-WAERS.
LOOP AT t_idoc_data transporting no fields
WHERE docnum = i_idoc_contrl-docnum.
CASE t_idoc_data-segnam .
WHEN c_segnam_e1edk01.
MOVE is_e1edk01 TO is_edidd-sdata.
MODIFY t_idoc_data FROM is_edidd.
L_FLAG = c_x.
ENDCASE.
IF L_FLAG = C_x.
CLEAR L_FLAG.
EXIT.
ENDIF.
ENDLOOP.
CLEAR L_EBELP.
ENDIF.
**************End of validation***********************************
********Start of validation for Invoice Receipt Flag*************
***Types Declaration
TYPES : BEGIN OF ty_temp_valid,
wepos TYPE wepos ,
weunb TYPE weunb,
webre TYPE webre,
xersy TYPE xersy,
repos TYPE repos,
END OF ty_temp_valid .
***Variable Declaration
DATA : l_sales_item TYPE posnr_va, "#EC NEEDED
it_tmp_idoc_data TYPE STANDARD TABLE OF edidd, "#EC NEEDED
it_temp_valid TYPE STANDARD TABLE OF ty_temp_valid,
wa_temp_valid LIKE LINE OF it_temp_valid, "#EC NEEDED
it_ekpo TYPE TABLE OF ekpo,
wa_ekpo LIKE LINE OF it_ekpo.
***Constant Declaration
CONSTANTS : c_msgid_zaf TYPE symsgid VALUE 'ZAF', "#EC NEEDED
c_msgtyp_e TYPE symsgty VALUE 'E', "#EC NEEDED
c_msgno_999 TYPE symsgno VALUE '999'. "#EC NEEDED
Loop at t_idoc_data INTO is_edidd
where segnam = c_segnam_e1edp02. "#EC *
MOVE: is_edidd-sdata TO is_e1edp02,
is_e1edp02-belnr TO l_ebeln,
is_e1edp02-zeile TO l_ebelp.
SELECT SINGLE * FROM ekpo INTO wa_ekpo WHERE ebeln = l_ebeln
AND ebelp = l_ebelp
AND wepos c_x
AND weunb c_x
AND webre c_x
AND xersy c_x
AND repos = c_x.
IF sy-subrc NE 0.
message e899(F4) with text-002.
ENDIF .
clear: wa_ekpo.
endloop.
**************End of validation for Invoice Receipt Flag**************
*********************Vendor Delivery or Third Party Frieght************
***Constant Declaration
CONSTANTS : c_betrg(4) TYPE c VALUE '340',
c_qualf(3) TYPE c VALUE 'Z01', "#EC NEEDED
c_betrg1(4) TYPE c VALUE '400',
c_qualf1(3) TYPE c VALUE '003', "#EC NEEDED
c_tax20(3) TYPE c VALUE '20',
c_tax21(3) TYPE c VALUE '21',
c_segnam_e1edk04 TYPE edi_segnam VALUE 'E1EDK04', "Segment E1EDk04
c_segnam_e1edp26 TYPE edi_segnam VALUE 'E1EDP26', "Segment E1EDP26
c_txjcd(10) TYPE c VALUE 'CA950500'.
***Types Declaration
TYPES : BEGIN OF ty_ekkn ,
sakto TYPE sakto ,
txjcd TYPE txjcd ,
mwskz TYPE mwskz ,
END OF ty_ekkn .
***Varaible and Workarea Declaration
DATA : it_ekkn TYPE STANDARD TABLE OF ty_ekkn ,
wa_ekkn LIKE LINE OF it_ekkn , "#EC NEEDED
it_frseg TYPE TABLE OF mmcr_tfrseg,
wa_fresg LIKE LINE OF it_frseg, "#EC NEEDED
it_co TYPE mmcr_tcobl_mrm,
wa_co LIKE LINE OF it_co, "#EC NEEDED
l_qualf TYPE qualibetrg, "#EC NEEDED
l_betrg TYPE edi_summe.
READ TABLE t_idoc_data INTO is_edidd
WITH KEY segnam = c_segnam_e1edp26. "#EC *
IF sy-subrc EQ 0.
MOVE: is_edidd-sdata TO is_e1edp26,
is_e1edp26-qualf TO l_qualf,
is_e1edp26-betrg TO l_betrg.
ENDIF.
READ TABLE t_idoc_data INTO is_edidd
WITH KEY segnam = c_segnam_e1edk04. "#EC *
IF sy-subrc EQ 0.
MOVE: is_edidd-sdata TO is_e1edk04.
ENDIF.
IF l_betrg = c_betrg.
is_e1edk04-mwskz = C_TAX20.
is_e1edk04-txjcd = c_txjcd.
ELSEIF l_betrg = c_betrg1.
is_e1edk04-mwskz = C_TAX21.
is_e1edk04-txjcd = wa_ekpo-txjcd.
ENDIF.
LOOP AT t_idoc_data
WHERE docnum = i_idoc_contrl-docnum.
CASE t_idoc_data-segnam .
WHEN c_segnam_e1edk04.
MOVE is_e1edk04 TO is_edidd-sdata.
MODIFY t_idoc_data FROM is_edidd.
ENDCASE.
ENDLOOP.
***************End of validation ***************************************
************************Geting the Invoicing party ******************************
***Structure Declaration
DATA : is_e1edka1 TYPE e1edka1, "Segment e1edka1
***Variable Declaration
l_parvw TYPE e1edka1-parvw, "#EC NEEDED
l_partn TYPE e1edka1-partn.
***Constant Declaration
CONSTANTS : c_segnam_e1edka1 TYPE edi_segnam VALUE 'E1EDKA1',
c_parvw TYPE wyt3-parvw VALUE 'RS'.
READ TABLE t_idoc_data INTO is_edidd
WITH KEY segnam = c_segnam_e1edka1 . "#EC *
IF sy-subrc EQ 0.
MOVE: is_edidd-sdata TO is_e1edka1,
is_e1edka1-parvw TO l_parvw.
ENDIF.
SELECT lifn2 FROM wyt3 INTO l_partn UP TO 1 ROWS
WHERE lifnr = wa_ekko-lifnr AND parvw = c_parvw.
ENDSELECT .
e_lifnr = l_partn.
if sy-subrc = 0.
is_e1edka1-partn = l_partn.
is_e1edka1-parvw = c_parvw.
LOOP AT t_idoc_data WHERE docnum = i_idoc_contrl-docnum.
CASE t_idoc_data-segnam .
WHEN c_segnam_e1edka1.
MOVE is_e1edk04 TO is_edidd-sdata.
MODIFY t_idoc_data FROM is_edidd.
EXIT.
ENDCASE.
ENDLOOP.
Endif.
*****************End of Validation************************************
Please let me know if u have any Query.I hope this will solve ur problem
Rgds
Sree M
Edited by: sree m on Mar 19, 2008 2:03 PM
‎2008 Jun 09 1:11 PM
dear sir ,
this is varun from nahar group , head office .
i want to know the user exit in bd20 where the duplicates bills in idocs not to be processed ....
only those bills which are not uploaded in sap of secondary sale of outlets that should be proceesed .
pls tell me the user exit for this for the WPUBON message type .
i m also sending u the report program where i can check the idocs duplicates bills in idoc .
if it is possible , pls send me urgent bcoz here we are realy getiing this type of problems . so due to this the idocs not be processed bcos of duplicates bills.
pls send me the reply as soon as possible .
thnxs,
varunwalia
ERP , NAHAR GROUP .
&----
*& Report ZPOS_IDOCS_CHECK_BILSS
*&
&----
*&
*&
&----
REPORT ZPOS_IDOCS_CHECK_BILSS no standard page heading .
TABLES : EDIDC,EDID4,EDIDS,vbrk.
data: begin of itab occurs 0 ,
DOCNUM like edid4-DOCNUM,
SEGNAM like edid4-SEGNAM,
SDATA like edid4-SDATA,
rnum like edid4-SDATA,
end of itab.
DATA : CNT1 TYPE I.
DATA : CNT2 TYPE I.
DATA : CNT3 TYPE I.
data : rnum(13).
SELECTION-SCREEN : BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : DOCNUM FOR EDIDC-DOCNUM .
SELECT-OPTIONS : CREDAT FOR EDIDC-CREDAT.
SELECT-OPTIONS : RCVPRN FOR EDIDC-RCVPRN.
SELECTION-SCREEN : END OF BLOCK BLK1.
top-of-page.
write : /1(7) 'IDOC NO',
22(4) 'SITE',
35(11) 'NO OF BILLS',
50(15) 'DUPLICATE BILLS'.
START-OF-SELECTION.
refresh : itab.
clear : itab.
SELECT * FROM EDIDC WHERE
DOCNUM IN DOCNUM
AND CREDAT IN CREDAT
AND RCVPRN IN RCVPRN
AND STATUS = '64'
AND SNDPOR = 'ZIBS'
AND MESTYP = 'WPUBON'.
IF EDIDC-DOCNUM IS NOT INITIAL.
SELECT COUNT(*) INTO CNT1 FROM EDID4
WHERE DOCNUM = EDIDC-DOCNUM AND SEGNAM = 'E1WPB01'.
SELECT docnum SDATA INTO CORRESPONDING FIELDS OF TABLE ITAB FROM EDID4
WHERE DOCNUM = EDIDC-DOCNUM AND SEGNAM = 'E1WPB06'.
LOOP AT ITAB.
itab-rnum = ITAB-SDATA+238(13).
modify itab.
SELECT * FROM VBRK WHERE ZUONR = itab-sdata+238(13) and fksto ne 'X'.
if sy-subrc = 0.
select count(*) into cnt2 from vbrk where zuonr = itab-sdata+238(13) and fksto ne 'X'.
add cnt2 to cnt3.
endif.
endselect.
ENDLOOP.
WRITE : /1(20) EDIDC-DOCNUM,
(10) EDIDC-SNDPRN,
(10) CNT1,
(10) CNT3.
cnt1 = 0.
cnt3 = 0.
ENDIF.
ENDSELECT.
‎2008 Jun 10 6:27 PM
Hey Varun ,
Welcome to SDN !
I checked for exits Could not found .If u are working on ECC6.0 .
Go for Enhancement spot creation.
and Place ur validations at appropriate place .
Please use new posting for the query.
I hope it resolve ur problem
Please let me know if u have query
Rgdds
Sree m
‎2008 Jun 11 10:05 AM
dear sree m ,
feel glad to send me reply .
sir now i have search the user exit for the idoc duplicates check which is for inbound idocs - IDoc service master: Inbound proce
enhancement : BASI0001
EXIT_SAPLBASI_001
EXIT_SAPLBASI_002
pls checked it out whether i have to make the check in this module/user exit .
pls do inform as soon as possible .
thnxs,
varunwalia,
nahar , erp .
‎2008 Jun 23 10:14 AM
dear sir ,
this is varun which as talk u earlier abt the problem having in pos duplicates bils in idocs. sir is there is any program by which i can
validate the duplicates bills which should not be posted which are already uploaded , means the idoc having duplicate has to be remain unchanged while processing out in bd20 or posing document via bd20.
and the rest of the bills which are not uploaded that they will easily updated via bd20 in particular idoc case .
i want to make the check in bd20 if any idoc cosistes of duplicates bills as well as original bills , only the original bills should be posted and the duplicates bills has to me set without unchanged during bd20 .
pls help me to resolve this error .
thnxs,
varun walia ,
nahar , erp .
‎2008 Jun 23 10:18 AM
hi,
check these exits for bd20.
read the documentation.
Transaction Code - BD20 IDoc passed to application
Enhancement/ Business Add-in Description
Enhancement
ALE00001 ALE user exit
Business Add-in
IDOC_CREATION_CHECK ALE Outbounf Processing: Check Whether IDoc is Created