05-18-2009 2:48 PM
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.
05-18-2009 2:59 PM
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.
05-18-2009 3:02 PM
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...
05-18-2009 3:04 PM
Oh sorry, yes, open group I have before a loop, so I can try it open in loop when first error occur?
05-18-2009 3:08 PM
05-18-2009 3:39 PM
You will be better off [handling exceptions|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/content.htm]!
~Suresh
05-18-2009 3:47 PM
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.