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

Processing session

Former Member
0 Likes
768

Hi,

whether is is possible to process a session created with function module bdc_open_group without closing it using function module bdc_close_group, in BDC.

Regards,

Mani

1 ACCEPTED SOLUTION
Read only

abdul_hakim
Active Contributor
0 Likes
710

Hi

The session will be created without bdc_close_group but it will be in status "Creating". You select the session and press the Release button. Later you can process the session.

best practice is to use bdc_close_group.

Regards,

Hakim

Edited by: Abdul Hakim on Apr 15, 2009 7:36 AM

5 REPLIES 5
Read only

abdul_hakim
Active Contributor
0 Likes
711

Hi

The session will be created without bdc_close_group but it will be in status "Creating". You select the session and press the Release button. Later you can process the session.

best practice is to use bdc_close_group.

Regards,

Hakim

Edited by: Abdul Hakim on Apr 15, 2009 7:36 AM

Read only

Former Member
0 Likes
710

hi John,



you can process a session in function module ..

wait 5 min i had coded for one program i will send the sample code.. how to create a session in Function module..

Regards,

Prabhudas

Read only

Former Member
0 Likes
710

hi JOhn.

See the sample code how to create BDC session in FUnction Module..



* Do the Call transaction recording..

CALL TRANSACTION 'ME22'
             USING bdc_tab
              MODE w_lmode
              UPDATE 'S'
          MESSAGES INTO message_tab.

* Error handling
  READ TABLE message_tab WITH KEY msgtyp = 'E'.
  IF sy-subrc EQ 0.

    CONCATENATE 'GM' sy-datum sy-uzeit INTO group.
    MOVE 'ME22' TO tcode.

* Opening BDC session and creating session..
    CALL FUNCTION 'BDC_OPEN_GROUP'
      EXPORTING
        client   = sy-mandt
        group    = group
        user     = sy-uname
        keep     = keep
        holddate = holddate.
 
    CALL FUNCTION 'BDC_INSERT'
      EXPORTING
        tcode     = tcode
      TABLES
        dynprotab = bdc_tab.
 
    CALL FUNCTION 'BDC_CLOSE_GROUP'.
ENDIF.

Reagrds,

Prabhudas

Read only

Former Member
0 Likes
710

hi,

it is required to close the session once u upend...

so u need use close_group.

~linganna

Read only

Former Member
0 Likes
710

Hi,

In BDC session method when you are open the session using BDC_OPEN_GROUP compulsary to close the group using BDC_CLOSE_GROUP ,if it is not closed in SM35 session in not created,we cannot process the session.

please check below code

FORM BDC_BATCH_INPUT_SESSION.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = I_SESSIONNAME

USER = SY-UNAME

KEEP = 'X'

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.

  • BDC Insert

LOOP AT it_employee INTO wa_employee.

PERFORM bdc_dynpro USING 'SAPMP50A' '1000'.

PERFORM bdc_field USING 'RP50G-PERNR'

wa_employee-pernr.

PERFORM bdc_field USING 'RP50G-TIMR6'

'X'.

PERFORM bdc_field USING 'BDC_CURSOR'

'RP50G-CHOIC'.

PERFORM bdc_field USING 'RP50G-CHOIC'

'0002'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=MOD'.

PERFORM bdc_dynpro USING 'MP000200' '2044'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=UPD'.

PERFORM bdc_field USING 'BDC_CURSOR'

'P0002-RUFNM'.

PERFORM bdc_field USING 'P0002-BEGDA'

wa_employee-begda.

PERFORM bdc_field USING 'P0002-ENDDA'

wa_employee-endda.

PERFORM bdc_field USING 'P0002-MIDNM'

wa_employee-midnm.

PERFORM bdc_field USING 'P0002-RUFNM'

wa_employee-rufnm.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'PA30'

TABLES

DYNPROTAB = it_bdcdata

EXCEPTIONS

INTERNAL_ERROR = 1

NOT_OPEN = 2

QUEUE_ERROR = 3

TCODE_INVALID = 4

PRINTING_INVALID = 5

POSTING_INVALID = 6

OTHERS = 7.

clear it_bdcdata.

ENDLOOP.

  • Closing Batch Input

CALL FUNCTION 'BDC_CLOSE_GROUP'.

ENDFORM.

Regards,

Madhu