Error in BDC within user exit
Hi All,
I am trying to generate a BDC recording within a function exit. I have declared the BDCRECX1 include within the TOP include of the function group. But the include BDCRECX1 which actually contains all the FORMs also contains a selection-screen defined in it. I am not able to activate it because it gives me the following error "SELECTION-SCREEN statements can only be used between SELECTION-SCREEN BEGIN and END OF SCREEN (program type is not "1")" Is it because we are not allowed to define a selection screen between Function-Endfunction which defines a function exit?
Please let me know why this error is generated and the step to rectify it.
Hi Nagaraj,
What Smitha is trying to accomplish here is reuse the subroutines that are available within the INCLUDE bdcrecx1.
Smitha - You cannot re-use the INCLUDE bdcrecx1 as it is, you will have to create a copy of it and take out all the code that relates to selection screen and reference to these selection parameters within the subroutines, as selection screen can be in programs type "1" - that is executable/report programs.
I guess you will need only the subroutines FORM BDC_DYNPRO USING PROGRAM DYNPRO. and FORM BDC_FIELD USING FNAM FVAL. just copy these routines into a new include. And you can use declare BDCDATA in the global data of the Function group.
If you ask me, i guess you could just write these 10-15 lines of code within the same include of the function exit and proceed rather than taking all this trouble.
Regards,
Chen
Similar Messages
-
Hi all,
I have used BDC inside user exit.I am getting an error while activating the user exit .
The error is before the statement 'FORM' the structure included by 'FUNCTION' must be ended by 'ENDFUNCTION'.(Not getting what 'FUNCTION' is mentioned in error message)
CALL TRANSACTION 'MM02' USING bdcdata MODE v_mode UPDATE 'S'
MESSAGES INTO it_bdcmsg1.
ENDLOOP.
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.
IF fval <> nodata.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDIF.
ENDFORM. "BDC_FIELDHi,
This is beacuse you are trying to nest the processing block, more strictly procedures. This is not possible in ABAP.
"Your customer exit simply lies between these statements introducing procedure (funtion module)
FUNCTION....
INCLUDE some_customer_exit_here.
ENDFUNCTION
You can't put any new procedure nor processing block inside this FUNCTION....ENDFUNCTION block.
Instead you have two possibilities:
- check function group of that function module, usually starts with X... for customer exists, add and include inside it, following SAP standard naming conventions for subroutines. It must be like inlcude ...F01 . Go inside there and create your subroutine (forms) here. Now in your cutomer exit simply use that form by calling it.
- create another program of type S (subroutine pool) and place your forms here. Now call it from customer include using PERFORM YOUR_NEW_PROGRAM_NAME(subroutine_name).
Regards
Marcin -
Hi,
Is it possible to call BDC in User Exits? Requirement is to update cusotmer master using by CALL TRANSACTION that called from a user exit.
How to know the user exit name, If I already know the function module name and include name?
Ex: Include - ZXVSVU02.
Function Module - EXIT_SAPLVV02_001.
<removed by moderator>
Edited by: Thomas Zloch on Jun 8, 2010 12:44 PMHi,
Have you tried calling BDC through module pool program? if its going to wotk there, sure u will get it done from user exist......
I have worked it through module pool.......all the best for ur try.....
Kalyan -
Update termination error on coding in user exit EXIT_SAPLCOIH_009
HI All,
I am working on approval of a work order in IW32 for which I am coding within a user exit EXIT_SAPLCOIH_009 which gets triggerred at the time of saving the work order. This will update the AUFK table and send a mail to a recipient. But when I save the work order after approving it, it gives me an error saying "Update Termination error". I checked within the SM13 transaction and ST22 for dump analysis, it says "The ABAP/4 Open SQL array insert results in duplicate database records.". Can anyone tell me what could have gone wrong and how I can rectify this. Your help is greatly appreciated.
Thanks in AdvanceHello
This type of error will appear in three cases
1.when there is a record in the database and trying to insert another with the same number
2.If there is any inconsistencies in number ranges (check this only if you have changed the number ranges very recently)
3. If the output type and the output device is wrongly selected ( not the prescribed)
Analyse yourself.
Regards,
Prakash -
BDC in user exit CONFPP05 - Material already used by User
I have requirement to create 551 movement Scrap from CO11N tcode whener user enters value for 'Yield' and 'Reason for variance' and press save button( Post).
I am unable to use BAPI because BAPI_GOODSMVT_CREATE (GMCODE 03= MB1A) since 551 mvmt can be done only through custom Tcode ZMB1A due to customization. Only option left was calling BDC for ZMB1A ( Call trasnaction been used) .
Problem:
BDC works outside as report program , but hen I call FM ( BDC) within userexit , it says Material lock by the user( Which is Me).
Calling from UserEXIT CONFPP05
CALL FUNCTION 'Z_POST_SCRAP_GI' ( Nothing but BDC call tran)
EXPORTING
MODE = 'N'
UPDATE = 'L'
bwart = mseg-bwart
werks = mseg-werks
grund = mseg-grund
lgort = afpo-lgort
matnr = mseg-matnr
erfmg = mseg-erfmg
erfme = mseg-erfme
aufnr = afpo-aufnr
TABLES
MESSTAB = MESSTAB .
This one works as report and not inside Userexit ( Returs errmsg already used by User which is myself).Here is the Dump, I am taking about after calling FM with Update Task
Category ABAP Programming Error
Runtime Errors POSTING_ILLEGAL_STATEMENT
ABAP Program SAPLY_FGRP
Application Component Not Assigned
Date and Time 03/06/2012 11:55:13
Short text
Statement "CALL TRANSACTION" is not allowed in this form.
|What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLY_FGRP" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
What can you do?
Note down which actions and inputs caused the error.
To process the problem further, contact you SAP system
administrator.
Using Transaction ST22 for ABAP Dump Analysis, you can look
at and manage termination messages, and you can also
keep them for a long time.
Error analysis
There is probably an error in the program
"SAPLY_FGRP".
This program is triggered in the update task. There, the
following ABAP/4 statements are not allowed:
- CALL SCREEN
- CALL DIALOG
- CALL TRANSACTION
- SUBMIT
How to correct the error
Probably the only way to eliminate the error is to correct the program.
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"POSTING_ILLEGAL_STATEMENT" " "
"SAPLY_FGRP" or "Y_ZMB1A_BDCREXCY"
"BDC_TRANSACTION"
If you cannot solve the problem yourself and want to send an error
notification to SAP, include the following information:
1. The description of the current problem (short dump)
To save the description, choose "System->List->Save->Local File
(Unconverted)".
2. Corresponding system log
Display the system log by calling transaction SM21.
Restrict the time interval to 10 minutes before and five minutes
after the short dump. Then choose "System->List->Save->Local File
(Unconverted)".
3. If the problem occurs in a problem of your own or a modified SAP
program: The source code of the program
In the editor, choose "Utilities->More
Utilities->Upload/Download->Download".
4. Details about the conditions under which the error occurred or which
actions and input led to the error.
Source Code Extract
Line
SourceCde
27
HOLDDATE = P_HOLDDATE.
28
ENDIF.
29
*ENDFORM.
30
31
32
end batchinput session *
33
34
*FORM CLOSE_GROUP USING P_CTU LIKE APQI-PUTACTIVE.
35
IF P_CTU <> 'X'.
36
close batchinput group
37
CALL FUNCTION 'BDC_CLOSE_GROUP'.
38
ENDIF.
39
*ENDFORM.
40
41
42
Start new transaction according to parameters *
43
44
FORM BDC_TRANSACTION TABLES P_MESSTAB
45
USING P_TCODE
46
P_CTU
47
P_MODE
48
P_UPDATE.
49
DATA: L_SUBRC LIKE SY-SUBRC.
50
51
IF P_CTU <> 'X'.
52
CALL FUNCTION 'BDC_INSERT'
53
EXPORTING TCODE = P_TCODE
54
TABLES DYNPROTAB = BDCDATA
55
EXCEPTIONS OTHERS = 1.
56
ELSE.
>>>>>
CALL TRANSACTION P_TCODE USING BDCDATA
58
MODE P_MODE
59
UPDATE CUPDATE
60
MESSAGES INTO P_MESSTAB.
61
ENDIF.
62
L_SUBRC = SY-SUBRC.
63
REFRESH BDCDATA.
64
SY-SUBRC = L_SUBRC.
65
ENDFORM.
66
67
68
Start new screen *
69
70
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
71
CLEAR BDCDATA.
72
BDCDATA-PROGRAM = PROGRAM.
73
BDCDATA-DYNPRO = DYNPRO.
74
BDCDATA-DYNBEGIN = 'X'.
75
APPEND BDCDATA.
76
ENDFORM.
Active Calls/Events
No. Ty. Program Include Line
Name
7 FORM SAPLY_FGRP Y_ZMB1A_BDCREXCY 57
BDC_TRANSACTION
6 FUNCTION SAPLY_FGRP LY_FGRPU02 81
Y_POST_SCRAP_GI
5 FORM SAPLY_FGRP LY_FGRPU02 1
Y_POST_SCRAP_GI
4 FORM RSM13000 RSM13000 5513
VB_CALL_FUNC
3 FORM RSM13000 RSM13000 5219
VB_V1_EXEC
2 FORM RSM13000 RSM13000 3952
VB_V1_NORMAL
1 MODULE (PBO) RSM13000 RSM13000 3801
VBEXEC
Chosen variables -
Updating custom field in table EKKO within user exit when PO is saved
I am trying to update a custom field in table EKKO when a PO is saved. I am using FM EXIT_SAPMM06E_013, within enhancement MM06E005. Since EKKO is not a table that can be updated with this user exit, I am using a technic that I read about on SDN where I assign a field symbol to the calling program variable and then am able to access data within EKKO table. But when I pass this data back into the field symbol, for some reason this field is not getting saved when the PO is saved. In debug mode, it looks like this field is getting updated, but when I look in the table after the PO is saved, it is not there. My code sample is below. What I am doing wrong?
data:
CHAR(50) VALUE '(SAPLMEPO)EKKO-ZHDRCSTCENTER',
g_zhdrcstcenter like ekko-zhdrcstcenter,
FIELD-SYMBOLS <F1> type any.
if i_ekko-ekorg = '5401'.
ASSIGN (char) to <F1>.
g_zhdrcstcenter = <F1>.
move '0000113322' to g_zhdrcstcenter.
<F1> = g_zhdrcstcenter.
endif.
Thanks!
Sarah Smyth.Firstly, have you investigated using EXIT_SAPMM06E_008 to set any custom fields you have added in the EKKO_CI / CI_EKKODB structure?.. that might work more easily.
In terms of doing an assign back into a calling program's memory, it can work but it's probably worth setting a break point in your code then stepping through watching the values in EKKO - sometimes you can find subsequent code that re-writes an earlier copy of values back into the structure, thereby preventing you doing your change... SAP does warn this method is for "internal use". Also check in your debugger that it's SAPLMEPO and not SAPMM06E you need. -
Error raising exception in user-exit for idoc_output_delvry.
Hi All,
When I try to raise an exception from the user exit (idoc_output_delvry),
I get an error message 'Assign Measurement unit to ISO code'.
Can you help me solve this issue.
Thanks in avance,
Disney.Michael,
Thanks for the quick response,
I did check in IMG, an entry is already there, the 'primary field' is checked,
USD is assigned to the iso code USD.
Regards,
Disney. -
Error in ME21 (by User Exit MM06E005 in ME21N)
Hi All,
I am implimenting '<b>MM06E005</b>' User-Exit in <b>ME21N</b>.
I am using "<b>EXIT_SAPMM06E_006</b>" Function Exit.
I write following code in it:-
*& Include ZXM06U36
IF SY-TCODE = 'ME21N'.
LOOP AT TEKPO.
IF TEKPO-KNTTP = 'A'.
IF TEKPO-MENGE <> '1'.
MESSAGE 'Correct Quantity to 1' TYPE 'E'.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
I do not want to impliment SAPMM06E Screen Exit. This is activated when above Exit is activate.
Now when i use T.Code ME21N , I get correct results.
<b>But when i use T.Code ME21, after entring data in first screen & press enter , i get "<u>Runtime error DYNPRO_NOT_FOUND has occurred</u>" error.</b>
<u>If i deactivate the above user exit, then there is no error in ME21.</u>
<b>Please guide me how i impliment this exit or other exit for ME21N so that i will not get any error in ME21.</b>
Regards
UmeshHi Umesh!
Try to implement BADI ME_PROCESS_PO_CUST instead. This is for enhancements of the enjoy transaction. I fear, the old exits aren't called under every circumstance.
If you need exits in both transactions, then implement SMOD exits, too - but a different one (without dynpro extension).
Regards,
Christian -
BAPI_PR_CHANGE within user-exit
Hi friends am using the BAPI_PR_CHANGE within a user-exit while doing transfer posting in MIGO.
since its within the user-exit i am not able to write commit work or transaction commit . Is ther any other way to commit the BAPI.
Even once the documents are posted the PR changes are not updated.
Please suggest a suitable solution for this issues.Iam using the EXIT_SAPLMBMB_001. As per my requirement in the exit am doing changes to PR's and updating the same in R/3 and also it should be updated in APO server so am using the particular BAPI. But its not updating the PR changes in r/3 or APO.
-
Updating EKKO within user exit ZXM06U22 (EXIT_SAPLEBND_002)
I am trying to update EKKO table (2 new fields that I added to CI_EKKODB) in user exit ZXM06U22 (EXIT_SAPLEBND_002). I am populating E_CEKKO (the 2 new fields) with this information, but for some reason, it is not saving to the database (EKKO table) after I save my ME21N or ME22N transaction. The very first thing i do in this user exit is:
move-corresponding I_CEKKO to e_cekko.
Does anyone have any ideas for other code that I need to add to this user exit to get these new field values in EKKO to save to database table?
Thanks!
Sarah.You should use SMOD enhancement MM06E005 to do this
EXIT_SAPMM06E_006, EXIT_SAPMM06E_007, EXIT_SAPMM06E_008 -
VA01-VA02 : Error message in a user exit / MV45AFZB
I everyone,
i want to add an error message in the exit "USEREXIT_CHECK_VBEP" (MV45AFZB) but when i do so it displays the following abend message :
"Incorrect index structure for table XMVERF_POS
/0000000222 /000030 " (V1322).
just after mine.
do you have any idea ?
Xavier.
PS : I use SAP ECC5Hi Xavier,
Here is the explanation when you get this type of error:
Short Text
Incorrect index structure for table &
Diagnosis
Internal error.
Procedure
Repeat the transaction.
If the error occurs and you have a CRM System connected to your ERP System, the document may have been archived in the CRM System.
If the error occurs again, inform your system administrator. If the error cannot be corrected, call the SAP Hotline directly. Describe which steps preceeded the error.
This is the long text description of that error message, so please let me know what next i mean whether you checked this and took the necessary action as explained above.
let me know if your problem still persists, else kindly close the thread.
Regards,
Yugandhar -
Display error message in SD user exit
Hi,
I want to display an error message in FORM USEREXIT_CHECK_VBAP. (Include MV45AFZB)
Afterwards, the user should be able to correct the wrong values, but the fields are locked because of the error message. How can I keep the relevant fields open?
Thanks in advance
RolandHi,
Instead of giving an error message...Probably give warning message..
If you give error message..It will lock the entries..
Thanks,
Naren -
Whether to go for bdc or user exits???
hi,
I have a reqirement like given below how should i proceed plz help me out.
If pre-tax contribution percentage in field EEPCT from table P0169 is less than 6%, only first sequence of customizing table V_74FF_C should run. It means, for employer contribution rule out of two sequences only one sequence shown should run and stop, the rule variant should not process the next sequence shown.So, readiing between the lines, you've been given some work to do and you have no idea where to start or how to do it and you want someone on here to explain it for you?
Why don't you go and sit down with your functional consultant and go through it with them - they should be able to explain what to do and where to do it. You can then work with this and convert it to ABAP. -
How to write BDC in Function exit (user exit )
Hi champs,
I am trying to write one bdc code in a function exit but it is giving me the error:
" Incorrect nesting: Before the statement "FORM", the structure
introduced by "FUNCTION" must be concluded with "ENDFUNCTION". -
The code which i have written is
**& Include ZXMRCU01
data: begin of it_imptt occurs 0,
POINT like imptt-point,
MRMIN like imptt-MRMIN,
MRMAX like imptt-MRMAX,
end of it_imptt.
Internal table to store BDC screens *
and field values *
DATA: BEGIN OF it_BDCDATA OCCURS 0.
INCLUDE STRUCTURE BDCDATA.
DATA: END OF it_BDCDATA.
select point
MRMIN
MRMAX from imptt into it_imptt
for all entries in imrg_ins
where point = imrg_ins-point.
endselect.
read table imrg_ins with key point = it_imptt-point.
if imrg_ins-readg < it_imptt-mrmin
or imrg_ins-readg > it_imptt-mrmax.
perform bdc_dynpro using 'SAPLIQS0' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RIWO00-QMART'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RIWO00-QMART'
'M1'.
perform bdc_dynpro using 'SAPLIQS0' '7200'.
perform bdc_field using 'BDC_OKCODE'
'=BUCH'.
perform bdc_field using 'VIQMEL-QMTXT'
'test desc1'.
call transaction 'IW21'
using it_BDCDATA
Mode 'A'
update 'S'.
REFRESH it_BDCDATA.
endif.
**& Form bdc_dynpro
text ---- Taking 2 parameters Screen Name & Screen Number.
FORM BDC_DYNPRO USING SCREEN_NAME SCREEN_NUMBER.
CLEAR it_BDCDATA.
it_BDCDATA-PROGRAM = SCREEN_NAME.
it_BDCDATA-DYNPRO = SCREEN_NUMBER.
it_BDCDATA-DYNBEGIN = 'X'.
APPEND it_BDCDATA.
ENDFORM. "bdc_dynpro
**& Form bdc_field
text---- Taking 2 parameters Field Name & Field Number.
FORM BDC_FIELD USING FNAME FVAL.
CLEAR it_BDCDATA.
it_BDCDATA-FNAM = FNAME.
it_BDCDATA-FVAL = FVAL.
APPEND it_BDCDATA.
ENDFORM. "bdc_field
Is there any different way of writing bdc in user exit?<b>FUNCTION.</b>
**& Include ZXMRCU01
data: begin of it_imptt occurs 0,
POINT like imptt-point,
MRMIN like imptt-MRMIN,
MRMAX like imptt-MRMAX,
end of it_imptt.
Internal table to store BDC screens *
and field values *
DATA: BEGIN OF it_BDCDATA OCCURS 0.
INCLUDE STRUCTURE BDCDATA.
DATA: END OF it_BDCDATA.
select point
MRMIN
MRMAX from imptt into it_imptt
for all entries in imrg_ins
where point = imrg_ins-point.
endselect.
read table imrg_ins with key point = it_imptt-point.
if imrg_ins-readg < it_imptt-mrmin
or imrg_ins-readg > it_imptt-mrmax.
perform bdc_dynpro using 'SAPLIQS0' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RIWO00-QMART'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RIWO00-QMART'
'M1'.
perform bdc_dynpro using 'SAPLIQS0' '7200'.
perform bdc_field using 'BDC_OKCODE'
'=BUCH'.
perform bdc_field using 'VIQMEL-QMTXT'
'test desc1'.
call transaction 'IW21'
using it_BDCDATA
Mode 'A'
update 'S'.
REFRESH it_BDCDATA.
endif.
<b>ENDFUNCTION.</b>
**& Form bdc_dynpro
text ---- Taking 2 parameters Screen Name & Screen Number.
FORM BDC_DYNPRO USING SCREEN_NAME SCREEN_NUMBER.
CLEAR it_BDCDATA.
it_BDCDATA-PROGRAM = SCREEN_NAME.
it_BDCDATA-DYNPRO = SCREEN_NUMBER.
it_BDCDATA-DYNBEGIN = 'X'.
APPEND it_BDCDATA.
ENDFORM. "bdc_dynpro
**& Form bdc_field
text---- Taking 2 parameters Field Name & Field Number.
FORM BDC_FIELD USING FNAME FVAL.
CLEAR it_BDCDATA.
it_BDCDATA-FNAM = FNAME.
it_BDCDATA-FVAL = FVAL.
APPEND it_BDCDATA.
ENDFORM. "bdc_field
Regards
Peram -
User exit to change user status in IQ01/02 after full installation EG31
Hi Experts,
In iq01 there are two fields 1 device status 2 user status . device status will be automatically changed (avlb to insl) by system after full installation but i need to change the user status (AVLB, NTAV) in iq01.I have created one bdc for iq02 and that will be properly changing the staus if i run seperately but when i am calling this bdc in user exit(EDMDI001,EDMDI002,EDMDI003) this shows one error '
device is already blocked bu user ---" reason being i have to use that device at the time of full installation and user exit that will change the staus also working on the same device during full installaion .
So Please resolve.
Thanks in advance
Edited by: dilipgupta on Jan 12, 2011 3:02 PMHello
dilipgupta
try this:
Exit Name Description
E07 IS-U: Geräteinstallation und Anlagenstruktur
EDMDI001 Kundeneigene Vorschlagswerte für Einbau, Ausbau, Wechsel
EDMDI002 Kundeneigene Prüfungen für Einbau, Ausbau, Wechsel
EDMDI003 Kundeneigene Daten zur Warenbewegung bei Ein-und Ausbau
regards
Chris
Maybe you are looking for
-
Variable with Replacement Path
Hi, I have two queries. The results of the first one should be the input for the second one. E.g. the first query shows a list of personnel numbers and additional information. These personnel numbers shall be overtaken by the second query. The person
-
Kernel panic when I am on the Intenet
I have got an ibook G4, PowerBook6,7, 1GB memory. I have been receiving Kernel Panic messages, and they are every time more frequent, the first time it happened when I has listening to the radio through Intenet, but now is many more times, 3 or 4 a d
-
Date format while downloading data into open office excel
Hi experts, i am trying to download hr personal data into excel from an internal table using GUI_DOWNLOAD, where date field, in excel, are having 2 different types of date format and the formats are :
-
HI all, I have created a glint effect flash and I was wondering how I can publish it as an html with static jpg file (image map) when I try to do that through the publishing I can't see the text of the glint I only see a rectangle where the text is.
-
Anyone working on a profile for the Canon EF 16-35mm 2.8 Mk11 lens?
Is anyone working on a profile for this very popular Pro Canon lens?