Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Close session problem in batch input map due HR_INFOTYPE_OPERATION process

Former Member
0 Likes
959

Hi all, I have problem with Batch input map creating. I process some data internal table for modification in infotype using FM HR_INFOTYPE_OPERATION and when some error appeared I should this record save in batch input map. This map will be processed manually in SM35 after run this report.

BDC_OPEN_GROUP.

LOOP AT IT_TABLE.

CALL FUNCTION HR_INFOTYPE_OPERATION.(modify)

IF error from FM.

REFRESH it_bim.

PERFORM fill_it_bim.

BDC_INSERT using it_bim.(create map for manually process in SM35)

ENDIF.

ENDLOOP.

BDC_CLOSE_GROUP.

BDC_OPEN_GROUP = sy-subrc EQ 0.

BDC_INSERT = sy-subrc EQ 0.

All is ok but when two records are processed and should be closed those session an error queue error raising and I do not why. 1 record in it_table processed successfully and 2 records not. Please help me anyone. Thnx.

6 REPLIES 6
Read only

Former Member
0 Likes
790

HI,

Try this way..

DATA: g_flag type c.

LOOP AT IT_TABLE.
" Check the data passing to the FM
CALL FUNCTION HR_INFOTYPE_OPERATION.(modify)
IF error from FM.
" Open the BDC Group only if error occurs first time
  IF g_flag EQ space. 
    BDC_OPEN_GROUP.
    g_flag = 'X'.
  ENDIF.

  REFRESH it_bim.
  PERFORM fill_it_bim.
  BDC_INSERT using it_bim.(create map for manually process in SM35)
ENDIF.

ENDLOOP.

" Close if BDC is session is open
IF g_flag EQ 'X'.
BDC_CLOSE_GROUP.
ENDIF.

Read only

Former Member
0 Likes
790

Hellou,

thanks for help, I have all this coded, I do not describe all code at first time, but all I have as you wrote here and it do not worked...

Read only

Former Member
0 Likes
790

Oh sorry, yes, open group I have before a loop, so I can try it open in loop when first error occur?

Read only

Former Member
0 Likes
790

Ok I try it, but it does not work too

Read only

0 Likes
790

You will be better off [handling exceptions|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/content.htm]!

~Suresh

Read only

Former Member
0 Likes
790

But here is problem, that in FM BDC_CLOSE_GROUP is code:

FUNCTION BDC_CLOSE_GROUP.

*"----


""Lokale Schnittstelle:

*" EXCEPTIONS

*" NOT_OPEN

*" QUEUE_ERROR

*"----


BAUSTEIN = 'BDC_CLOSE_GROUP'.

----


*--- CALL Queue Interface

----


*

*

        • C-Prog

*

CALL 'BDC_CLOSE_GROUP'.

IF SY-SUBRC EQ 0 .

CALL FUNCTION 'DEQUEUE_BDC_QID'

EXPORTING DATATYP = 'BDC '

GROUPID = BGROUP

QID = BQID .

  • CALL FUNCTION 'DB_COMMIT'.

ENDIF.

PERFORM FEHLER_BEHANDLUNG USING SY-SUBRC.

ENDFUNCTION.

and here an internal call CALL 'BDC_CLOSE_GROUP'. returning sy-subrc = 4. Check if session is open worked before calling this FM but it does not closing.