2007 Jul 20 11:36 AM
i m running a bdc in front end that is working fine.
when i do the same in back ground its not working..
wat could be the problem
plz help its urgent
2007 Jul 20 11:59 AM
hi,
don't use gui_upload in case of background use open data set
2007 Jul 20 11:59 AM
hi,
don't use gui_upload in case of background use open data set
2007 Jul 20 12:04 PM
Hi
Have you used the fun modules like GUI_UPLOAD or GUI_DOWNLOAD
these fun modules won't work in Background
If you wants to run BDC program in background better keep the file in Application server and use the OPEN DATASET ..commands and move the data
<b>Reward points for useful Answers</b>
Regards
Anji
2007 Jul 20 12:16 PM
hi,
while working with BDC to run in background mode, you can upload the data from APPLICATION server insted of PRESENTATION server...
if you use these upload, ws_upload and gui_upload function modules to upload data from presentation server then it will go to dump..... you must upload or download data from application server only....for that one you work with OPEN DATASET .......CLOSE DATASET
regards,
Ashok Reddy
2007 Jul 20 12:19 PM
Hi,
Actually the Gui_....WS_.... Function modules will not work in the background. So use DATASET functionality .
Or use WS__...GUI_... Functions before scheduling the background and generate the session then take the session and schedule it in background.
Regards,
Nandha
Reward if it helps
2007 Jul 20 12:53 PM
PARAMETERS : P_DATE like EKKO-AEDAT OBLIGATORY.
DATA : BEGIN OF I_EKKO OCCURS 0,
EBELN LIKE EKKO-EBELN,
END OF I_EKKO.
DATA : BEGIN OF I_EKPO OCCURS 0,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
END OF I_EKPO.
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.
SELECT EBELN FROM EKKO INTO TABLE I_EKKO WHERE AEDAT < P_DATE .
SELECT EBELN EBELP FROM EKPO INTO TABLE I_EKPO FOR ALL ENTRIES IN I_EKKO
WHERE EBELN = I_EKKO-EBELN
AND PSTYP NE '9'.
SORT I_EKKO BY EBELN.
SORT I_EKPO BY EBELN.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
DEST = FILLER8
GROUP = 'FILLER12'
HOLDDATE = FILLER8
KEEP = 'X'
USER = SY-UNAME
RECORD = FILLER1
PROG = SY-CPROG
DCPFM = '%'
DATFM = '%'
IMPORTING
QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT I_EKKO.
if cnt4 < 5.
cnt4 = cnt4 + 1.
read table i_ekpo with key ebeln = i_ekko-ebeln.
if sy-subrc = 0.
CLEAR BDCDATA.
REFRESH BDCDATA.
cnt = 0.
*cnt1 = 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.
if cnt ne 0.
CNT2 = CNT2 + 1.
DO CNT2 TIMES.
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'
'=FORWARD3200'.
ENDDO.
endif.
cnt = cnt + 1.
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'.
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 FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'ME22N'
POST_LOCAL = NOVBLOCAL
PRINTING = NOPRINT
SIMUBATCH = ' '
CTUPARAMS = ' '
TABLES
DYNPROTAB = bdcdata
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CNT1 = CNT1 + 1.
endif.
endif.
ENDLOOP.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> ' '.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.