cancel
Showing results for 
Search instead for 
Did you mean: 

Call transaction in background

Former Member
0 Kudos

Could you pls see below code.(junk char are japanese char so pls dont mind it.)

when i execute this program, i get 5times the same output in spool output sp01.i dont know why..its looping like this.i guess Call transaction execution at background is still executing..its in background mode eventhough i execute this program in foreground.(now i commented this Call transaction modue, u can see below)

Whenever i refresh spool or sm37 i get always jobs generated in the list.couldyou pls tell me how to delete such background job executing.

i saw in sm50, i found 4BTC in Ready state.should i have to delete these sessions.

REPORT ZGLT0_REPORT_V1 no standard page heading message-id zx.

include zbdcrecxx_v2.

Tables: GLT0,

sscrfields,

SKB1.

FIELD-SYMBOLS: .

DATA: SUM(16) type C,

SUMVAL LIKE GLT0-HSL01,

CNT TYPE I,

FZ(10) TYPE C,

W_NEWBS1(2) TYPE C,

W_NEWBS2(2) TYPE C.

DATA:

BEGIN OF gltz occurs 0,

RACCT LIKE GLT0-RACCT, "Š¨’èƒR[ƒh

hslvt LIKE glt0-hslvt, " ’ʉ݌J‰zŽc‚

hsl01 LIKE glt0-hsl01, " ’ʉ݊úŠÔ‡Œv

hsl02 LIKE glt0-hsl02, " ’ʉ݊úŠÔ‡Œv

hsl03 LIKE glt0-hsl03, " ’ʉ݊úŠÔ‡Œv

hsl04 LIKE glt0-hsl04, " ’ʉ݊úŠÔ‡Œv

hsl05 LIKE glt0-hsl05, " ’ʉ݊úŠÔ‡Œv

hsl06 LIKE glt0-hsl06, " ’ʉ݊úŠÔ‡Œv

hsl07 LIKE glt0-hsl07, " ’ʉ݊úŠÔ‡Œv

hsl08 LIKE glt0-hsl08, " ’ʉ݊úŠÔ‡Œv

hsl09 LIKE glt0-hsl09, " ’ʉ݊úŠÔ‡Œv

hsl10 LIKE glt0-hsl10, " ’ʉ݊úŠÔ‡Œv

hsl11 LIKE glt0-hsl11, " ’ʉ݊úŠÔ‡Œv

hsl12 LIKE glt0-hsl12, " ’ʉ݊úŠÔ‡Œv

hsl13 LIKE glt0-hsl13, " ’ʉ݊úŠÔ‡Œv

hsl14 LIKE glt0-hsl14, " ’ʉ݊úŠÔ‡Œv

hsl15 LIKE glt0-hsl15, " ’ʉ݊úŠÔ‡Œv

hsl16 LIKE glt0-hsl16, " ’ʉ݊úŠÔ‡Œv

END OF gltz.

  • ¡ ‘I‘ð‰æ–Ê

PARAMETERS:

P_RYEAR LIKE GLT0-RYEAR. "U‘֑Ώۂ̉ïŒv”N“x

SELECTION-SCREEN SKIP 1.

PARAMETERS:

P_BUKRS1 LIKE BKPF-BUKRS default '200', "U‘ÖŒ³‰ïŽÐƒR[ƒh

P_GSBER1 LIKE BSEG-GSBER default '011A',

P_RACCT LIKE GLT0-RACCT.

SELECTION-SCREEN SKIP 1.

PARAMETERS:

P_BUKRS2 LIKE GLT0-BUKRS default '790', "U‘֐æ‰ïŽÐƒR[ƒh

P_GSBER2 LIKE BSEG-GSBER default '130B'.

PARAMETERS:

W_BLART LIKE BKPF-BLART DEFAULT 'SA'. "“`•[ƒ^ƒCƒv

SELECTION-SCREEN SKIP 1.

PARAMETERS:

P_BUDAT LIKE BKPF-BUDAT. "U‘Ö“`•[“]‹L“ú

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(33) TEXT-002 FOR FIELD XCALL.

PARAMETERS: XCALL LIKE RFPDO-RFBICALL. "ƒeƒXƒgŽÀsƒtƒ‰ƒO

SELECTION-SCREEN END OF LINE.

*¡ CHECKBOXÝ’è

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(33) TEXT-001 FOR FIELD P_TEST.

PARAMETERS: P_TEST AS CHECKBOX. "ƒeƒXƒgŽÀsƒtƒ‰ƒO

SELECTION-SCREEN END OF LINE.

AT SELECTION-SCREEN.

  • ¡ ƒe[ƒuƒ‹GLT0‚©‚çƒf[ƒ^‚ðŽæ“¾

CLEAR GLTZ.

REFRESH GLTZ.

*¡ –¢ŒˆÏ–¾×ŠÇ—ƒtƒ‰ƒOƒ`ƒFƒbƒN

SELECT SINGLE XOPVW INTO SKB1-XOPVW FROM SKB1

WHERE BUKRS = P_BUKRS1

AND SAKNR = P_RACCT.

*¡ ƒGƒ‰[ƒƒbƒZ[ƒW

IF SKB1-XOPVW = 'X'.

MESSAGE E002.

ENDIF.

SELECT * FROM GLT0

WHERE rldnr = '00' " Œ³’ iŒÅ’èj

AND rrcty = '0' " ƒŒƒR[ƒhƒ^ƒCƒviŒÅ’èj

AND rvers = '001' " ƒo[ƒWƒ‡ƒ“iŒÅ’èj

AND racct = P_RACCT " Š¨’èƒR[ƒh

AND bukrs = P_BUKRS1 " ‰ïŽÐƒR[ƒh

AND ryear = P_RYEAR. " ‰ïŒv”N“x

MOVE-CORRESPONDING GLT0 TO GLTZ.

COLLECT GLTZ.

ENDSELECT.

  • ¡ Žc‚‚ðWŒv

LOOP AT GLTZ.

CNT = '0'.

SUM = GLTZ-HSLVT.

DO '16' TIMES.

CNT = CNT + 1.

FZ = 'GLTZ-HSL0'.

IF CNT > 9. "‚à‚µ‚b‚m‚s‚Ì’l‚ª‚X‚æ‚è‘å‚«‚¢i‚QŒ…j‚È‚ç

FZ+8 = CNT. "‚b‚m‚s‚Ì’l‚ª‚e‚y‚Ì‚WŒ…–ڈȍ~i‚k‚ÌŒãj‚É“ü‚è‚Ü‚·B

ELSE. "‚à‚µ‚b‚m‚s‚Ì’l‚ª‚XˆÈ‰ºi‚PŒ…j‚È‚ç

FZ+9 = CNT. "‚b‚m‚s‚Ì’l‚ª‚e‚y‚Ì‚XŒ…–ڈȍ~i‚O‚ÌŒãj‚É“ü‚è‚Ü‚·B

ENDIF.

ASSIGN (FZ) to .

ENDDO.

ENDLOOP.

*¡ Žc‚’l‚ªƒ[ƒ‚̏ꍇAƒGƒ‰[ƒƒbƒZ[ƒW‚ðo—Í

IF SUM = 0.

MESSAGE E001 WITH 'Žc‚’l‚̓[ƒ('0')‚Å‚·'.

ENDIF.

START-OF-SELECTION.

write 😕 'batch mode', sscrfields-ucomm.

  • ¡ “ü—͉æ–ʂ̃eƒXƒgƒtƒ‰ƒO‚ªOFF‚̏ꍇAŽc‚’l‚ðo—Í

IF P_TEST <> 'X'.

SUM = SUM * 100.

SUMVAL = SUM.

  • ¡ Žc‚ƒf[ƒ^‚̏o—Í

WRITE: AT / '‰ïŒv”N“x F', P_RYEAR(4).

WRITE: AT / 'U‘ÖŒ³‰ïŽÐƒR[ƒhF', P_BUKRS1(4).

WRITE: AT / 'U‘ÖŒ³Š¨’èƒR[ƒhF', P_RACCT+2(8).

WRITE: AT / '‘“à‹àŠzŽc‚ F', SUMVAL DECIMALS 0, 'JPY'.

ELSE.

*¡Žc‚‚Ì’l‚ªƒ[ƒˆÈ~‚̏ꍇ

IF SUM < 0.

SUM = SUM * 100.

W_NEWBS1 = '40'.

W_NEWBS2 = '50'.

COMPUTE SUM = ABS( SUM ).

*¡ Žc‚‚Ì’l‚ªPOSITIVE‚̏ꍇ

ELSE.

SUM = SUM * 100.

W_NEWBS1 = '50'.

W_NEWBS2 = '40'.

ENDIF.

IF XCALL = SPACE.

Write 'Its in batch input mode'.

PERFORM BATCHINPUTMODE. "ƒoƒbƒ`ƒCƒ“ƒvƒg•”•ª

else.

  • write 'Its in Call transaction mode'.

  • Perform CTMODE.

endif.

ENDIF.

  • FORM BATCHINPUTMODE **************************************************

  • FB01 TRANSACTION‚̃oƒbƒ`ƒCƒ“ƒvƒgSESSION‚ðì¬‚·‚éB

************************************************************************

FORM BATCHINPUTMODE.

Perform open_group.

perform bdc_group.

perform bdc_transaction using 'FB01'.

perform close_group.

EndForm.

form BDC_GROUP.

*¡ ƒoƒbƒ`ƒCƒ“ƒvƒgƒ‚ƒWƒ…[ƒ‹ŠJŽn

perform bdc_dynpro using 'SAPMF05A' '0100'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RF05A-NEWKO'.

perform bdc_field using 'BKPF-BLDAT'

P_BUDAT.

perform bdc_field using 'BKPF-BLART'

W_BLART.

perform bdc_field using 'BKPF-BUKRS'

P_BUKRS1.

perform bdc_field using 'BKPF-BUDAT'

P_BUDAT.

perform bdc_field using 'BKPF-WAERS'

'JPY'.

perform bdc_field using 'BKPF-XBLNR'

'ŽQÆ“`•[”ԍ†'.

perform bdc_field using 'BKPF-BKTXT'

'“`•[ƒwƒbƒ_ Text'.

perform bdc_field using 'RF05A-NEWBS'

W_NEWBS1.

perform bdc_field using 'RF05A-NEWKO'

P_RACCT.

perform bdc_dynpro using 'SAPMF05A' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=ZK'.

perform bdc_field using 'BDC_CURSOR'

'BSEG-SGTXT'.

perform bdc_field using 'BSEG-WRBTR'

SUM.

perform bdc_field using 'BSEG-ZUONR'

'ƒ[ƒgƒL['.

perform bdc_field using 'BSEG-SGTXT'

'ƒeƒLƒXƒg'.

perform bdc_field using 'BDC_SUBSCR'

'SAPLKACB'

& ' 0001BLOCK'.

perform bdc_dynpro using 'SAPLKACB' '0002'.

perform bdc_field using 'BDC_OKCODE'

'=ENTE'.

perform bdc_field using 'BDC_CURSOR'

'COBL-GSBER'.

perform bdc_field using 'COBL-GSBER'

P_GSBER2.

perform bdc_field using 'BDC_SUBSCR'

'SAPLKACB'

& ' 0003BLOCK1'.

perform bdc_dynpro using 'SAPMF05A' '0330'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RF05A-NEWBK'.

perform bdc_field using 'BSEG-XREF1'

'ŽQÆƒL[ 1'.

perform bdc_field using 'BSEG-XREF2'

'ŽQÆƒL[ 2'.

perform bdc_field using 'BSEG-XREF3'

'ŽQÆƒL[ 3'.

perform bdc_field using 'RF05A-NEWBS'

W_NEWBS2.

perform bdc_field using 'RF05A-NEWKO'

P_RACCT.

perform bdc_field using 'RF05A-NEWBK'

P_BUKRS2.

perform bdc_dynpro using 'SAPMF05A' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=ZK'.

perform bdc_field using 'BDC_CURSOR'

'BSEG-SGTXT'.

perform bdc_field using 'BSEG-WRBTR'

SUM.

perform bdc_field using 'BSEG-ZUONR'

'ƒ[ƒgƒL['.

perform bdc_field using 'BSEG-SGTXT'

'ƒeƒLƒXƒg'.

perform bdc_field using 'BDC_SUBSCR'

'SAPLKACB'

& ' 0001BLOCK'.

perform bdc_dynpro using 'SAPLKACB' '0002'.

perform bdc_field using 'BDC_OKCODE'

'=ENTE'.

perform bdc_field using 'BDC_CURSOR'

'COBL-GSBER'.

perform bdc_field using 'COBL-GSBER'

P_GSBER2.

perform bdc_field using 'BDC_SUBSCR'

'SAPLKACB'

& ' 0003BLOCK1'.

perform bdc_dynpro using 'SAPMF05A' '0330'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'BDC_CURSOR'

'BSEG-XREF3'.

perform bdc_field using 'BSEG-XREF1'

'ŽQÆƒL[ 1'.

perform bdc_field using 'BSEG-XREF2'

'ŽQÆƒL[ 2'.

perform bdc_field using 'BSEG-XREF3'

'ŽQÆƒL[ 3'.

endform.

*&----


*

*& Form CallTransactionmode

*&----


*

  • text

*----


*

Form CTMODE.

perform bdc_group.

Call Transaction 'FB01'

using bdcdata

mode 'N'

update 'S'.

if sy-subrc ne 0.

perform open_group.

perform bdc_transaction using 'FB01'.

perform close_group.

write 😕 'Data Insufficient! Call transaction fails'.

write 😕 'Pls refer Batch Input Session !'.

else.

write 'Successfully Created Call transaction'.

endif.

ENDFORM. " CallTransactionmode

spool output is like this.

0000007530 05/02/22 13:51 - 1 LIST1S WIN1 ZGLT0_SHISAP

0000007529 05/02/22 13:51 - 1 LIST1S WIN1 ZGLT0_SHISAP

0000007528 05/02/22 13:51 - 1 LIST1S WIN1 ZGLT0_SHISAP

0000007527 05/02/22 13:51 - 1 LIST1S WIN1 ZGLT0_SHISAP

0000007526 05/02/22 13:51 - 1 LIST1S WIN1 ZGLT0_SHISAP

0000007525 05/02/22 13:50 - 1 LIST1S WIN1 ZGLT0_SHISAP

0000007524 05/02/22 13:50 - 1 LIST1S WIN1 ZGLT0_SHISAP

0000007523 05/02/22 13:50 - 1 LIST1S WIN1 ZGLT0_SHISAP

0000007522 05/02/22 13:50 - 1 LIST1S WIN1 ZGLT0_SHISAP

0000007521 05/02/22 13:50 - 1 LIST1S WIN1 ZGLT0_SHISAP

0000007520 05/02/22 13:49 - 1 LIST1S WIN1 ZGLT0_SHISAP

0000007519 05/02/22 13:49 - 1 LIST1S WIN1 ZGLT0_SHISAP

0000007518 05/02/22 13:49 - 1 LIST1S WIN1 ZGLT0_SHISAP

0000007517 05/02/22 13:49 - 1 LIST1S WIN1 ZGLT0_SHISAP

0000007516 05/02/22 13:49 - 1 LIST1S WIN1 ZGLT0_SHISAP

Message was edited by: ambi chan

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Ambichan,

Before we try to figure out why the job is getting scheduled <i><u>five</u></i> times, there are a few things that we need to find out.

1. When you call execute the CALL TRANSACTION statement, the sy-subrc statement must probably be non-zero. Please check out what the value of the SY-SUBRC is.

2. For the CALL TRANSACTION statement, please use the messages addition to see what messages you are getting when Call Transaction is failing. It will help you understand the error, which is most probably because of the error in data (in the BDC internal table).

3. Lastly, I see that you have written a lot of code in the AT SELECTION-SCREEN event. If I were in your place, I would not do that. Look at the SELECT and also the COLLECT statement. Can you move it to the start-of-selection block?

Regards,

Anand Mandalika.

Former Member
0 Kudos

Regarding ur question 1 and 2. i will reply later.

but regard qn 3, Why i did such calculation part at

"At selection" is,After the calculation i want to check the sum value and display the error part in INPUTTED screen itself.

Inorder to get the error display in INPUTTED screen itself i wrote in "At selection" part.

or else, if u write the same calcuation and error part at

Start-of -selection and execute, the error displays with blank screen(inputt fields gets disappeared in screen).

This is the reason i wrote there..

can we get the same behaviour at Start-of selection itself.

pls give me reference.

ambichan

Former Member
0 Kudos

Hello Ambichan,

I was just talking from a performance point of view. The SELECT statements are likely to get executed multiple number of times.

After the first SELECT statement, why are you not checking the sy-subrc value?

Regards,

Anand Mandalika.

Former Member
0 Kudos

yes you are correct.

i have to include that sy-subrc condition...thankyou.

From your suggestion, I plan to seperate call transaction

and BI in two seperate program and i will check it.

and get back to you.

ambichan.