‎2007 Aug 02 11:55 AM
i m running a bdc for me22n its working well in all screen mode but not in no screen mode wat could be the problem how to overcome it plz help
‎2007 Aug 02 11:58 AM
hi,
when you are running in the A mode you will intactively enter the command.. for example if you get some warning message during the execution of the transaction you press enter when you are running in A mode but when you run in N mode the program should have that logic to add extra enter okcode at that point of the message.. i had a similar problem earlier and written code for the enter command and run in n mode it will work.
remember when you record these kind of enter's command for warning messages are not recorded
Regards,
Sankar
‎2007 Aug 02 12:04 PM
plz check the code once and suggets me wer to change thanks for u r reply
TABLES : EKKO.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN : BEGIN OF LINE.
PARAMETERS : P_DATE1 RADIOBUTTON GROUP GRP1. "DEFAULT ' '.
SELECTION-SCREEN COMMENT 3(26) TEXT-003.
PARAMETERS : P_DATE LIKE EKKO-AEDAT.
SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN : BEGIN OF LINE.
PARAMETERS : P_EBELN1 RADIOBUTTON GROUP GRP1." DEFAULT ' '.
SELECTION-SCREEN COMMENT 3(26) TEXT-004.
SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN.
SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN END OF BLOCK B1.
DATA : BEGIN OF I_EKKO OCCURS 0,
EBELN LIKE EKKO-EBELN,
KNUMV LIKE EKKO-KNUMV,
END OF I_EKKO.
DATA : BEGIN OF I_EKPO OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
ELIKZ LIKE EKPO-ELIKZ,
EREKZ LIKE EKPO-EREKZ,
LOEKZ LIKE EKPO-LOEKZ,
END OF I_EKPO.
DATA : BEGIN OF I_POITEM OCCURS 0.
INCLUDE STRUCTURE BAPIMEPOITEM.
DATA : END OF I_POITEM.
DATA : BEGIN OF I_POCOND OCCURS 0.
INCLUDE STRUCTURE BAPIMEPOCOND.
DATA : END OF I_POCOND.
DATA : BEGIN OF I_BAPIRET2 OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA : END OF I_BAPIRET2.
DATA : V_LOEKZ LIKE EKPO-LOEKZ,
V_CNT LIKE SY-TABIX.
DATA : BEGIN OF I_MESS.
INCLUDE STRUCTURE T100.
DATA : END OF I_MESS.
DATA CNT TYPE SY-TABIX VALUE 0.
DATA CNT1 TYPE SY-TABIX VALUE 0.
DATA CNT2 TYPE SY-TABIX VALUE 0.
DATA CNT4 TYPE SY-TABIX VALUE 0.
DATA L_SUBRC LIKE SY-SUBRC.
DATA: L_MSTRING(480).
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA: MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
IF P_DATE1 = 'X'.
SELECT EBELN FROM EKKO INTO TABLE I_EKKO WHERE AEDAT < P_DATE .
ENDIF.
IF P_EBELN1 = 'X'.
SELECT EBELN KNUMV FROM EKKO INTO TABLE I_EKKO WHERE EBELN IN S_EBELN.
ENDIF.
SELECT EBELN EBELP ELIKZ EREKZ LOEKZ FROM EKPO INTO TABLE I_EKPO FOR ALL ENTRIES IN I_EKKO WHERE EBELN = I_EKKO-EBELN
AND PSTYP NE '9'.
AND LOEKZ NE 'S' AND LOEKZ NE 'L'.
*loop at i_ekpo.
*if i_ekpo-LOEKZ eq 'S' or i_ekpo-LOEKZ eq 'L'.
*READ TABLE I_EKKO WITH KEY EBELN = I_EKPO-EBELN.
*delete table i_ekko WITH TABLE KEY ebeln = i_ekpo-ebeln
KNUMV = I_EKKO-KNUMV.
*endif.
*endloop.
SORT I_EKKO BY EBELN.
SORT I_EKPO BY EBELN.
LOOP AT I_EKKO.
CNT4 = CNT4 + 1.
READ TABLE I_EKPO WITH KEY EBELN = I_EKKO-EBELN.
IF SY-SUBRC = 0.
CLEAR BDCDATA.
REFRESH BDCDATA.
CNT = 0.
CNT2 = 0.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=MECHOB'.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0002'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=MEOK'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MEPO_SELECT-EBELN'.
PERFORM BDC_FIELD USING 'MEPO_SELECT-EBELN'
I_EKPO-EBELN.
PERFORM BDC_FIELD USING 'MEPO_SELECT-BSTYP_F'
'X'.
*IF CNT1 > 0.
*perform bdc_dynpro using 'SAPLMEGUI' '0014'.
*perform bdc_field using 'BDC_OKCODE'
'=METOGG'.
*ENDIF.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=TABIDT6'.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=MEV4001BUTTON'.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=MEPO1211MALL'.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=MEPO1211UNLOCK'.
LOOP AT I_EKPO WHERE EBELN = I_EKKO-EBELN.
DO 2 TIMES.
IF CNT NE 0.
CNT2 = CNT2 + 1.
DO 1 TIMES.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=FORWARD3200'.
ENDDO.
ENDIF.
CNT = CNT + 1.
IF CNT NE 0.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=TABIDT6'.
ENDIF.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=TABIDT7'.
PERFORM BDC_FIELD USING 'MEPO1313-ELIKZ'
'X'.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=TABIDT8'.
PERFORM BDC_FIELD USING 'MEPO1317-EREKZ'
'X'.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=V69A_KOAN'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(01)'.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(02)'.
PERFORM BDC_FIELD USING 'KOMV-KSCHL(02)'
'zpaf'.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=V69A_KOAN'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(03)'.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'KOMV-KSCHL(02)'.
PERFORM BDC_FIELD USING 'KOMV-KSCHL(02)'
'zecs'.
ENDDO.
ENDLOOP.
PERFORM BDC_DYNPRO USING 'SAPLMEGUI' '0014'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=MESAVE'.
PERFORM BDC_DYNPRO USING 'SAPLSPO2' '0101'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=OPT1'.
CALL TRANSACTION 'ME22N' USING BDCDATA MODE 'N'
UPDATE 'A'
MESSAGES INTO MESSTAB.
L_SUBRC = SY-SUBRC.
WRITE: / 'CALL_TRANSACTION',
'ME22N',
'returncode:'(I05),
L_SUBRC,
I_EKPO-EBELN.
CNT1 = CNT1 + 1.
ENDIF.
ENDLOOP.
LOOP AT MESSTAB.
SELECT SINGLE * FROM T100 INTO I_MESS WHERE SPRSL = MESSTAB-MSGSPRA
AND ARBGB = MESSTAB-MSGID
AND MSGNR = MESSTAB-MSGNR.
IF SY-SUBRC = 0.
L_MSTRING = I_MESS-TEXT.
IF L_MSTRING CS '&1'.
REPLACE '&1' WITH MESSTAB-MSGV1 INTO L_MSTRING.
REPLACE '&2' WITH MESSTAB-MSGV2 INTO L_MSTRING.
REPLACE '&3' WITH MESSTAB-MSGV3 INTO L_MSTRING.
REPLACE '&4' WITH MESSTAB-MSGV4 INTO L_MSTRING.
ELSE.
REPLACE '&' WITH MESSTAB-MSGV1 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB-MSGV2 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB-MSGV3 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB-MSGV4 INTO L_MSTRING.
ENDIF.
CONDENSE L_MSTRING.
WRITE: / MESSTAB-MSGTYP, L_MSTRING(250).
ELSE.
WRITE: / MESSTAB.
ENDIF.
ENDLOOP.
&----
*& Form BDC_DYNPRO
&----
text
----
-->PROGRAM text
-->DYNPRO text
----
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM. "BDC_DYNPRO
&----
*& Form BDC_FIELD
&----
text
----
-->FNAM text
-->FVAL text
----
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> ' '.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM. "BDC_FIELD
‎2008 Jan 08 3:37 PM
Hi,
I had a problem in handling the warning messages in BDC using the call transaction method.
I added one more okcode but still not getting resolved while calling the tcode in N mode.
Can any one help me in providing the sample code.
I am using ME11 tcode for Creating info records ...
for some materials getting an warning message as 'Material can be used interanlly' ...
Thanks for your help in advance!!
‎2008 Jan 08 3:40 PM
hi,
when you are running in the A mode you will intactively enter the command.. for example if you get some warning message during the execution of the transaction you press enter when you are running in A mode but when you run in N mode the program should have that logic to add extra enter okcode at that point of the message.. i had a similar problem earlier and written code for the enter command and run in n mode it will work.
remember when you record these kind of enter's command for warning messages are not recorded
Regards,
Sankar
Hi Sankar,
Based on the above information ... can you please pass me the piece of code how to handel the wraning message by inlcuding extra enter command in the recording.
Thanks for your help!
‎2007 Aug 02 4:00 PM
You might want to try t-code ME22 in place of ME22N. ME22N uses a lot of SAP controls, which does not play nice with BDC.
If you can complete the tasks you need to do in ME22 it might be the best option.
Of course the code modifications suggested previously would also work quite well.
‎2007 Aug 02 7:07 PM
Hi,
Actually you cannot use bdc fot TCODES with ends with 'N'.
Because these TCODES are made by Control frameworks.
Reward If u find useful.
‎2007 Aug 02 7:52 PM
Hi,
Never use Njoy Tranactions, i.e. transaction with N, for BDC. In your case, use ME22 instead of ME22N for recording & BDC.
Reward points if the answer is helpful.
Regards,
Mukul
‎2008 Jul 10 4:19 PM
Thanks, Christopher and others for the helpful hint about using BDC with ME22N. I switched to calling transaction ME22 instead and it worked. That brings me to a new question, however: from what I hear, SAP transaction ME22 will be retired at some future date. This could affect this work around. Does anyone know when this will be? My objective here was to print a P.O. (needed to be done in change mode). Is there a BAPI to do that or will the BAPI mentioned in this thread (BAPI_PO_CHANGE) also print P.O.'s? I checked it out, and it did not seem to have that capability. Thanks for any information.