BDC upload program for inoftypes 14 and 168

Hi All,
I am uploading IT 14 and 168 through a single BDC program. i am opening the bdc session using
BDC_OPEN_GROUP before bdc recording. my requirement is to upload IT 168 only when uploading
of IT 14 is successful. For this i am using the message table of the first upload(for IT14). if the message
type is 'S'(success) then i am uploading IT168 else i am moving it to an error internal table. Please suugest
wthr this logic is fine. Also where should i call BDC_CLOSE_GROUP. currently i am calling it after the
PERFORM for upload of infotype 168 but it is giving error "unable to open BDC_CLOSE_GROUP".
Can anyone suggest me the solution through some sample code.
i am attaching here my code for your reference.
REPORT  ZUSAHR_IN_BN_E_014_168  NO STANDARD PAGE HEADING
                        LINE-COUNT 65 LINE-SIZE 132.
*=======================================================================
TYPE-POOLS
*=======================================================================
TYPE-POOLS: slis,
            truxs.
*=======================================================================
TABLES
*=======================================================================
TABLES: pernr.
*=======================================================================
INFOTYPES
*=======================================================================
INFOTYPES: 0000,                                    "Action
           0014,                                    "Recurring payement/deductions
           0168.                                    "Insurance plan
*=======================================================================
TYPES
*=======================================================================
TYPES : BEGIN OF t_0014_0168,
         num(20) type c,         "Number
         actcode(1) type c,      "action code
         lgart LIKE p0014-lgart, "Wage Type
        betrg LIKE q0014-betrg, "Amount
         betrg(14) type c, "Amount
         bplan LIKE p0168-bplan, "Benefit plan
         bcovr like p0168-bcovr, "Insurance Option
        END OF t_0014_0168,
        BEGIN OF t_pernr,
          pernr LIKE p0002-pernr,  "personnel number
          perid like p0002-perid,  "SSN
        END OF t_pernr,
        BEGIN OF errmsg,
          pernr LIKE p0014-pernr,  "personnel number
          messg(85),              " message text
        END OF errmsg,
        BEGIN OF succmsg,
          pernr LIKE p0014-pernr,  "personnel number
         messg(85),              " message text
        END OF succmsg.
*=======================================================================
INTERNAL TABLES
*=======================================================================
DATA : i_itab TYPE STANDARD TABLE OF t_0014_0168,
       i_pernr TYPE STANDARD TABLE OF t_pernr,
       i_bdcitab TYPE STANDARD TABLE OF bdcdata ,
       i_bdcmsgcoll TYPE STANDARD TABLE OF bdcmsgcoll,
       i_errmsg TYPE STANDARD TABLE OF errmsg,
       i_succmsg TYPE STANDARD TABLE OF succmsg.
*=======================================================================
RANGES
*=======================================================================
*=======================================================================
DATA DECLARATION
*=======================================================================
DATA : messg(85).
*=======================================================================
GLOBAL WORKAREAS
*=======================================================================
DATA : wa_itab TYPE t_0014_0168,
       wa_pernr TYPE t_pernr,
       wa_bdcitab TYPE bdcdata ,
       wa_bdcmsgcoll TYPE bdcmsgcoll,
       wa_errmsg TYPE errmsg,
       wa_succmsg TYPE succmsg.
*=======================================================================
GLOBAL VARIABLES
*=======================================================================
DATA : g_n1 TYPE sy-dbcnt.
*=======================================================================
GLOBAL CONSTANTS
*=======================================================================
DATA : g_x TYPE c VALUE 'X',
       g_asc    TYPE char10 VALUE 'ASC',
       g_xls(3) TYPE c VALUE 'XLS',
       g_f TYPE c VALUE 'F',
       g_1 TYPE c VALUE '1',
       g_0 TYPE c VALUE '0',
       g_u TYPE c VALUE 'U',
       g_int(3) TYPE c VALUE 'INT',
       g_raw(3) TYPE c VALUE 'RAW',
       G_A(1) TYPE C VALUE 'A',
       G_C(1) TYPE C VALUE 'C',
       G_D(1) TYPE C VALUE 'D'.
*=======================================================================
SELECTION-SCREEN
*=======================================================================
*Block for Additional selection
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_check TYPE char1 DEFAULT 'X', "check box for test run
             p_file1 TYPE  rlgrap-filename OBLIGATORY, " upload file
             p_file2 TYPE rlgrap-filename OBLIGATORY, " succ emp
             p_file3 TYPE rlgrap-filename OBLIGATORY. " err emp
SELECTION-SCREEN END OF BLOCK b1.
*=======================================================================
AT SELECTION-SCREEN
*=======================================================================
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
  PERFORM sub_file_intake.
*=======================================================================
START-OF-SELECTION
*=======================================================================
START-OF-SELECTION.
  PERFORM sub_data_upload.
  PERFORM GET_PERNR_SSN.
*=======================================================================
END-OF-SELECTION
*=======================================================================
END-OF-SELECTION.
*> upload the data using BDC
  PERFORM sub_bdc_upload.
*> To display the contents of the input file for test run
  IF p_check = space.
    PERFORM sub_output.
  ELSE.
*> To display in the messages after uploading the input file
    PERFORM sub_output_messages.
  ENDIF.
*&      Form  sub_file_intake
      F4 on filename to accept file
-->  p1        text
<--  p2        text
FORM sub_file_intake .
To provide F4 Functionality for file path
  CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
      program_name  = syst-repid
    CHANGING
      file_name     = p_file1
    EXCEPTIONS
      mask_too_long = 1
      OTHERS        = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDFORM.                    " sub_file_intake
*&      Form  SUB_DATA_UPLOAD
       Upload the input file and perform the checkings.
-->  p1        text
<--  p2        text
FORM SUB_DATA_UPLOAD .
*> local variable for filename
  DATA : l_file1 TYPE string.
*> assign value for file1.
  l_file1 = p_file1.
*> function to upload the input file
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                = l_file1
      filetype                = g_asc
      has_field_separator     = g_x
    TABLES
      data_tab                = i_itab
    EXCEPTIONS
      file_open_error         = 1
      file_read_error         = 2
      no_batch                = 3
      gui_refuse_filetransfer = 4
      invalid_type            = 5
      no_authority            = 6
      unknown_error           = 7
      bad_data_format         = 8
      header_not_allowed      = 9
      separator_not_allowed   = 10
      header_too_long         = 11
      unknown_dp_error        = 12
      access_denied           = 13
      dp_out_of_memory        = 14
      disk_full               = 15
      dp_timeout              = 16
      OTHERS                  = 17.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDFORM.                    " SUB_DATA_UPLOAD
*&      Form  sub_output
      if program is on test run mode then display records
FORM sub_output .
*> Count the number of employee to be processed
  CLEAR g_n1.
  DESCRIBE TABLE i_itab LINES g_n1.
  IF g_n1 NE 0.
*> if program is in test run mode then display
    LOOP AT i_itab INTO wa_itab.
      WRITE: / wa_itab-num,
               wa_itab-lgart,
               wa_itab-betrg,
               wa_itab-bplan,
               wa_itab-bcovr.
    ENDLOOP.
  ENDIF.
ENDFORM.                    " sub_output
*&      Form  sub_bdc_upload
      bdc upload
FORM sub_bdc_upload .
*> Count the number of employee to be processed
  CLEAR g_n1.
  DESCRIBE TABLE i_itab LINES g_n1.
  IF g_n1 NE 0.
    PERFORM sub_open_group.
    PERFORM sub_bdc_sessions.
   PERFORM sub_close_group.
  ELSE.
    MESSAGE e003(zmsg) WITH text-021.
  ENDIF.
ENDFORM.                    " sub_bdc_upload
*&      Form  sub_open_group
      bdc_open_group
FORM sub_open_group .
*> group name
  DATA : c_group LIKE apqi-groupid .
  c_group = text-001.
  CALL FUNCTION 'BDC_OPEN_GROUP'
    EXPORTING
      client              = sy-mandt
      group               = c_group
      holddate            = sy-datum
      keep                = g_x
      user                = sy-uname
      prog                = sy-cprog
    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.
ENDFORM.                    " sub_open_group
*&      Form  sub_close_group
      Close the BDC Session
FORM sub_close_group .
  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.
ENDFORM.                    " sub_close_group
*&      Form  sub_bdc_sessions
      BDC Sessions
FORM sub_bdc_sessions .
*> Local Constants
  DATA: l_ctumode LIKE ctu_params-dismode VALUE 'A',
        l_cupdate LIKE ctu_params-updmode VALUE 'S',
        l_startdate(10) type c,
        l_enddate(10) type c,
        l_tcode(4) TYPE c VALUE 'PA30',
        l_info(2) TYPE c VALUE '14'.
  LOOP AT i_itab INTO wa_itab.
    perform bdc_dynpro      using 'SAPMP50A' '1000'.
   IF  wa_itab-actcode = G_A.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=INS'.
   ELSEIF  wa_itab-actcode = G_D.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=DEL'.
   ELSEIF  wa_itab-actcode = G_C.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=MOD'.
   ENDIF.
    perform bdc_field       using 'RP50G-PERNR' wa_itab-num.
    perform bdc_field       using 'RP50G-TIMR6'
                                  'X'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RP50G-CHOIC'.
    perform bdc_field       using 'RP50G-CHOIC' l_info.
    perform bdc_dynpro      using 'MP001400' '2010'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'Q0014-BETRG'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'P0014-BEGDA'
                                  '03/18/2008'.
    perform bdc_field       using 'P0014-ENDDA'
                                  '12/31/9999'.
    perform bdc_field       using 'P0014-LGART' wa_itab-lgart.
   perform bdc_field       using 'Q0014-BETRG' wa_itab-betrg.
    perform bdc_field       using 'Q0014-BETRG'
                                   wa_itab-betrg.
                                 '               248'.
   perform bdc_field       using 'P0014-BETRG' wa_itab-betrg.
    perform bdc_field       using 'P0014-WAERS'
                                  'USD'.
    perform bdc_dynpro      using 'MP001400' '2010'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'P0014-BEGDA'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=UPD'.
    perform bdc_field       using 'P0014-BEGDA'
                                  '03/18/2008'.
    perform bdc_field       using 'P0014-ENDDA'
                                  '12/31/9999'.
   perform bdc_field       using 'P0014-LGART' wa_itab-lgart.
   perform bdc_field       using 'Q0014-BETRG' wa_itab-betrg.
   perform bdc_field       using 'P0014-BETRG' wa_itab-betrg.
    perform bdc_field       using 'P0014-WAERS'
                                  'USD'.
*>  refresh the message tab
    REFRESH i_bdcmsgcoll.
    CALL TRANSACTION l_tcode USING i_bdcitab
                     MODE   l_ctumode
                     UPDATE l_cupdate
                     MESSAGES INTO i_bdcmsgcoll.
*>  refresh the bdc data tab
    REFRESH i_bdcitab.
*>  store the message for this pernr
    PERFORM sub_build_messages.
  ENDLOOP.
ENDFORM.                    " sub_bdc_sessions
       Start new screen                                              *
FORM bdc_dynpro USING program dynpro.
  CLEAR wa_bdcitab.
  wa_bdcitab-program  = program.
  wa_bdcitab-dynpro   = dynpro.
  wa_bdcitab-dynbegin = g_x.
  APPEND wa_bdcitab TO i_bdcitab.
ENDFORM.                    "BDC_DYNPRO
       Insert field                                                  *
FORM bdc_field USING fnam fval.
  IF fval <> space.
    CLEAR wa_bdcitab.
    wa_bdcitab-fnam = fnam.
    wa_bdcitab-fval = fval.
    APPEND wa_bdcitab TO i_bdcitab.
  ENDIF.
ENDFORM.                    "BDC_FIELD
*&      Form  sub_build_messages
      Generate the messages
FORM sub_build_messages .
*> Local Constants
  DATA : l_s TYPE c VALUE 'S'.
  LOOP AT i_bdcmsgcoll INTO wa_bdcmsgcoll.
*> generate the message
    CALL FUNCTION 'MESSAGE_TEXT_BUILD'
      EXPORTING
        msgid               = wa_bdcmsgcoll-msgid
        msgnr               = wa_bdcmsgcoll-msgnr
        msgv1               = wa_bdcmsgcoll-msgv1
        msgv2               = wa_bdcmsgcoll-msgv2
        msgv3               = wa_bdcmsgcoll-msgv3
        msgv4               = wa_bdcmsgcoll-msgv4
      IMPORTING
        message_text_output = messg
      EXCEPTIONS
        OTHERS              = 1.
    IF sy-subrc EQ 0.
*> if message type is 'S' then store in successful table
      IF wa_bdcmsgcoll-msgtyp = l_s.
        MOVE wa_itab-num TO wa_succmsg-pernr.
        MOVE messg TO wa_succmsg-messg.
        APPEND wa_succmsg TO i_succmsg.
        CLEAR wa_succmsg.
        PERFORM BDC_UPLOAD_168.
      ELSE.
*> if message type is 'E' then store in error table
        MOVE wa_itab-num TO wa_errmsg-pernr.
        MOVE messg TO wa_errmsg-messg.
        APPEND wa_errmsg TO i_errmsg.
        CLEAR wa_errmsg.
      ENDIF.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " sub_build_messages
*&      Form  sub_output_messages
      text
-->  p1        text
<--  p2        text
FORM sub_output_messages .
  IF p_check = g_x.
*> clear the count
    CLEAR g_n1.
*> count the number of successful employees
    DESCRIBE TABLE i_succmsg LINES g_n1.
    IF g_n1 <> 0 .
*> download success file
      PERFORM sub_succ_file.
*> display the successful employees
      WRITE :/ text-002.
      LOOP AT i_succmsg INTO wa_succmsg.
        WRITE:/ wa_succmsg-pernr, wa_succmsg-messg.
      ENDLOOP.
    ENDIF.
*> clear the count
    CLEAR g_n1.
*> count the number of error employees
    DESCRIBE TABLE i_errmsg LINES g_n1.
    IF g_n1 <> 0 .
*> download error file
      PERFORM sub_err_file.
*> display the error employees
      WRITE :/ text-003.
      LOOP AT i_errmsg INTO wa_errmsg.
        WRITE:/ wa_errmsg-pernr,wa_errmsg-messg.
      ENDLOOP.
    ENDIF.
  ENDIF.
ENDFORM.                   " sub_output_messages
*&      Form  SUB_SUCC_FILE
      text
-->  p1        text
<--  p2        text
FORM sub_succ_file .
*> local variable for filename
  DATA : l_file1 TYPE string.
*> assign value for file1.
  l_file1 = p_file2.
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                = l_file1
      filetype                = g_asc
    TABLES
      data_tab                = i_succmsg
    EXCEPTIONS
      file_write_error        = 1
      no_batch                = 2
      gui_refuse_filetransfer = 3
      invalid_type            = 4
      no_authority            = 5
      unknown_error           = 6
      header_not_allowed      = 7
      separator_not_allowed   = 8
      filesize_not_allowed    = 9
      header_too_long         = 10
      dp_error_create         = 11
      dp_error_send           = 12
      dp_error_write          = 13
      unknown_dp_error        = 14
      access_denied           = 15
      dp_out_of_memory        = 16
      disk_full               = 17
      dp_timeout              = 18
      file_not_found          = 19
      dataprovider_exception  = 20
      control_flush_error     = 21
      OTHERS                  = 22.
  IF sy-subrc EQ 0.
    MESSAGE s003(zmsg) WITH text-006.
  ENDIF.
ENDFORM.                    " SUB_SUCC_FILE
*&      Form  SUB_ERR_FILE
      text
-->  p1        text
<--  p2        text
FORM sub_err_file .
*> local variable for filename
  DATA : l_file1 TYPE string.
*> assign value for file1.
  l_file1 = p_file3.
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                = l_file1
      filetype                = g_asc
    TABLES
      data_tab                = i_errmsg
    EXCEPTIONS
      file_write_error        = 1
      no_batch                = 2
      gui_refuse_filetransfer = 3
      invalid_type            = 4
      no_authority            = 5
      unknown_error           = 6
      header_not_allowed      = 7
      separator_not_allowed   = 8
      filesize_not_allowed    = 9
      header_too_long         = 10
      dp_error_create         = 11
      dp_error_send           = 12
      dp_error_write          = 13
      unknown_dp_error        = 14
      access_denied           = 15
      dp_out_of_memory        = 16
      disk_full               = 17
      dp_timeout              = 18
      file_not_found          = 19
      dataprovider_exception  = 20
      control_flush_error     = 21
      OTHERS                  = 22.
  IF sy-subrc EQ 0.
    MESSAGE s003(zmsg) WITH text-007.
  ENDIF.
ENDFORM.                    " SUB_ERR_FILE
*&      Form  GET_PERNR_SSN
      text
-->  p1        text
<--  p2        text
FORM GET_PERNR_SSN .
  data : l_cnt type i.
  describe table i_itab lines l_cnt.
  if l_cnt ge 0.
    SELECT PERNR PERID FROM PA0002 INTO table i_pernr
           FOR ALL ENTRIES IN i_itab
           WHERE PERID EQ i_itab-num.
    IF SY-SUBRC EQ 0.
      PERFORM MODIFY_TABLE.
    ENDIF.
  endif.
ENDFORM.                    " GET_PERNR_SSN
*&      Form  MODIFY_TABLE
      text
-->  p1        text
<--  p2        text
FORM MODIFY_TABLE .
  LOOP AT i_itab INTO wa_itab.
    READ TABLE i_pernr INTO wa_pernr WITH KEY perid = wa_itab-num.
    IF SY-SUBRC EQ 0.
      MOVE WA_PERNR-PERNR TO WA_ITAB-NUM.
      MODIFY i_itab FROM wa_itab.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " MODIFY_TABLE
*&      Form  BDC_UPLOAD_168
      text
-->  p1        text
<--  p2        text
FORM BDC_UPLOAD_168 .
PERFORM sub_open_group.
  PERFORM sub_bdc_sessions_168.
  PERFORM sub_close_group.
ENDFORM.                    " BDC_UPLOAD_168
*&      Form  SUB_BDC_SESSIONS_168
      text
-->  p1        text
<--  p2        text
FORM SUB_BDC_SESSIONS_168 .
  DATA: l_ctumode LIKE ctu_params-dismode VALUE 'A',
         l_cupdate LIKE ctu_params-updmode VALUE 'S',
         l_sdate(10) type c,
         l_edate(10) type c,
         l_tcode(4) TYPE c VALUE 'PA30',
         l_info(3) TYPE c VALUE '168'.
  LOOP AT i_itab INTO wa_itab.
    perform bdc_dynpro      using 'SAPMP50A' '1000'.
    IF  wa_itab-actcode = G_A.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=INS'.
    ELSEIF  wa_itab-actcode = G_D.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=DEL'.
    ELSEIF  wa_itab-actcode = G_C.
      perform bdc_field       using 'BDC_OKCODE'
                                    '=MOD'.
    ENDIF.
    perform bdc_field       using 'RP50G-PERNR' wa_itab-num.
    perform bdc_field       using 'RP50G-TIMR6'
                                  'X'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RP50G-CHOIC'.
    perform bdc_field       using 'RP50G-CHOIC' l_info.
    perform bdc_dynpro      using 'MP016800' '2000'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'P0168-BEGDA'
                                  '03/18/2008'.
    perform bdc_field       using 'P0168-ENDDA'
                                  '12/31/9999'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'P0168-BCOVR'.
    perform bdc_field       using 'P0168-BPLAN' wa_itab-bplan.
    perform bdc_field       using 'P0168-BCOVR' wa_itab-bcovr.
    perform bdc_field       using 'Q0168-CSTDT'
                                  '03/18/2008'.
    perform bdc_field       using 'Q0168-EEPER'
                                  '2'.
    perform bdc_field       using 'P0168-PERIO'
                                  '2'.
    perform bdc_dynpro      using 'MP016800' '2000'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'P0168-BEGDA'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=UPD'.
    perform bdc_field       using 'P0168-BEGDA'
                                  '03/18/2008'.
    perform bdc_field       using 'P0168-ENDDA'
                                  '12/31/9999'.
    perform bdc_field       using 'P0168-BPLAN' wa_itab-bplan.
    perform bdc_field       using 'P0168-BCOVR' wa_itab-bcovr.
    perform bdc_field       using 'Q0168-CSTDT'
                                  '03/18/2008'.
    perform bdc_field       using 'Q0168-EEPER'
                                  '2'.
*>  refresh the message tab
    REFRESH i_bdcmsgcoll.
    CALL TRANSACTION l_tcode USING i_bdcitab
                     MODE   l_ctumode
                     UPDATE l_cupdate
                     MESSAGES INTO i_bdcmsgcoll.
*>  refresh the bdc data tab
    REFRESH i_bdcitab.
*>  store the message for this pernr
    PERFORM sub_build_messages_168.
  ENDLOOP.
ENDFORM.                    " SUB_BDC_SESSIONS_168
*&      Form  SUB_BUILD_MESSAGES_168
      text
-->  p1        text
<--  p2        text
FORM SUB_BUILD_MESSAGES_168 .
*> Local Constants
  DATA : l_s TYPE c VALUE 'S'.
  LOOP AT i_bdcmsgcoll INTO wa_bdcmsgcoll.
*> generate the message
    CALL FUNCTION 'MESSAGE_TEXT_BUILD'
      EXPORTING
        msgid               = wa_bdcmsgcoll-msgid
        msgnr               = wa_bdcmsgcoll-msgnr
        msgv1               = wa_bdcmsgcoll-msgv1
        msgv2               = wa_bdcmsgcoll-msgv2
        msgv3               = wa_bdcmsgcoll-msgv3
        msgv4               = wa_bdcmsgcoll-msgv4
      IMPORTING
        message_text_output = messg
      EXCEPTIONS
        OTHERS              = 1.
    IF sy-subrc EQ 0.
*> if message type is 'S' then store in successful table
      IF wa_bdcmsgcoll-msgtyp = l_s.
        MOVE wa_itab-num TO wa_succmsg-pernr.
        MOVE messg TO wa_succmsg-messg.
        APPEND wa_succmsg TO i_succmsg.
        CLEAR wa_succmsg.
      ELSE.
*> if message type is 'E' then store in error table
        MOVE wa_itab-num TO wa_errmsg-pernr.
        MOVE messg TO wa_errmsg-messg.
        APPEND wa_errmsg TO i_errmsg.
        CLEAR wa_errmsg.
      ENDIF.
    ENDIF.
  ENDLOOP.
Many thanks in advance!!!!
Rupesh

For the IDOC perspective, you can uses CREMAS.
For the mass maintenance you still have XK99 (which also uses CREMAS internally)
True there is NO BAPI
For the BDC and the table control. Well this is not really true.
In batchinput, instead of maintaining the rows by there Number, you should select it at the first position.
OK-CODE /06 will open a selection screen SAPMF02K 2324. The result of the selection screen goes to the first line of the table control.
Of course this works only in BDC
reward points if helpful
Edited by: Alain Bacchi  on Jun 18, 2008 8:48 AM

Similar Messages

  • BDC Program for FCH5 and FCH6

    Hi ALL,
    Pls send me BDC program for FCH5 and FCH6 in function module it self..
    How to write BDC the program in function module for FCH5 and FCH6..
    Thanks

    HI ,
    Thanks for your message,
    I'm doing the one bank payment(Out Sourcing Cheque) (ZCITI)transaction so in that implementation i need the FCH5 and FCH6 BDC programs.
    can you send me the sample code of BDC programs => thread locked  for above tcodes bcz i haven't done BDC programs in Function modules.
    Thanks in advance.
    Edited by: kishan P on Oct 15, 2010 4:00 PM

  • Need to create a mass upload program for appraisal document creation for multiple employee in abap hr

    Hi Expertise,
    I need to create a mass upload program for appraisal document creation for manager and his multiple employee
    at a time using tcode appcreate.
    Please help me out.
    Best regards,
    Priyaranjan

    Hi,
    I have done appraisal document creation for bulk using txt file.
    this fm used for single for creation in standard tcode (phap_prepare):  'WZ_HRHAP_0DOC_WZ01_START'.
    So create ztcode  usinh this fm for single form then record BDC for this tcode and called this tcode in that bdc for bulk creation .
    While recording for single I have used manual option instead of automatic .

  • Need to create a mass upload program for appraisal document creation for multiple employee

    Hi Expertise,
    I need to create a mass upload program for appraisal document creation for manager and his multiple employee
    at a time using tcode appcreate.
    Please help me out.
    Best regards,
    Priyaranjan

    Hi Priyaranjan,
    I think you can take the abap'ers help in creating the program. But u need to provide them the exact functionality and the required specifications in creating the appraisal document.
    Even tcode also u can get it prepared by Abap'ers.
    Thanks and Regards
    Balaji

  • What's the best approach/program for finding and eliminating duplicate photos on my hard drive?

    What's the best approach/program for finding and eliminating duplicate photos on my hard drive? I have a "somewhat" older version of iPhoto (5.0.4), and it doesn't seem to offer anything like that except during the importing phase of syncing my phone...

    I wonder, is there room to transfer them to your phone, & then back to filter them?

  • ABAP program for BAPI and convert DB into XML

    ABAP program for BAPI and convert DB into XML
    Thank you,
    Regards,
    Jagrut BharatKumar Shukla

    Refer the link -
    give an example of bapi coding?
    how can we transfer huge amount of data from database server to xml format
    Regards,
    Amit
    Reward all helpful replies.

  • Where can we find the standard program for scripts and smartform for vl02

    where can we find the standard program for scripts and smartform for vl02
    regard,
    anil

    If it is a standard Script Output see that all config in NACE tcode was done correctly and in the Application document the output type was properly defined and attached to a medium, partner and all communication related things like printer name, when to print the output and number of messages etc are entered in the document
    the go to the related application Tcode
    (for sales order goto VA02 or VA03)
    (delivery -VL02N or VL03N)
    for Invoice VF02 or VF03
    for PO -goto ME9F
    enter doc number, Issue Output to -> screen/printer
    then see the output
    step 1 : copy the z layout into testing client thru SCC1.
    step2 : go to se71 and check modified layout.
    step3 : if it is under logistics.. go to TCODE "NACE".
    u will see various applictions for each business process.
    there u have configure ur related layout according to requirments,
    for example u consider for Request fo Quatation..
    there is APPLICATION called "EA"
    click and enter into it. configure it with ur requirments, for help consult with ur functonal consaltant, and save it.
    step 4 : goto tcode ME9A for requst for quatation(RFQ).
    step 5 : enter test data avalable and check it with message display.
    it is same for other applications like Contract agreament --> ME9k
    invoice --> vl02n
    and goes on..
    Reward points for useful Answers

  • What is the best All in One program for picture and video editing?

    Hello i am new to photoshop and would like to really make some fantastic photos and video for my family and friends. I want to add effects to video and Edit photos to the 10th degree. Can someone please recommend an Adobe program. Should i get CS4 extended should i get master suite? Also where can i watch Video Tutorials that start from the basic and lead to the complex. Thanks in advance

    What is the best All in One program for picture and video editing?
    There is no such thing. If there were, nobody would bother writing different applications. If you are primarily focused on still image editing and video, Adobe Production Premium is the way to go. You can find any number of tutorials just by searching Google and many good ones are linked from the Adobe help systems as well.
    Mylenium

  • Best program for monitoring and blocking internet use on my kids mobile devices, iPads, iPhones from my MAC

    Whats the best program for monitoring and blocking internet sites and usage for my kids on their mobile devices ipads, iphones and ipods, all from my desktop mac?

    Can't be done from your Mac remotely.
    But you can enable parental controls directly on iOS devices.
    iOS: Understanding Restrictions (parental controls)

  • Writing an Upload Program for Business Partner, its address and Attributes

    Hi SAP Gurus,
    I am in process of writing a tech design and code for an upload program which requires uploading a list of million Business Partners, its address (primarily Zip Code) and a list of Marketing Attributes of those Business Partners. The data will come in a .csv extract which will contain the BP Name, Zip Code, Marketing Attributes (X, Y, Z, etc) and then through this upload we will be creating BPs in the system and then updating its address and then Marketing Attributes.
    The approach that I have chosen is -
    1) Select the file from the presentation server using the class/method CL_GUI_FRONTEND_SERVICES /GUI_UPLOAD FM
    2) Call the FM TEXT_CONVERT_XLS_TO_SAP to transfer the content of the MS Excel file to an internal table for further processing.
    3) Call the FM - BAPI_BUPA_CREATE_FROM_DATA and pass the necessary parameters to upload/create the Business Partner and then call the FM BAPI_TRANSACTION_COMMIT to ensure the upload is complete.
    4) Once the upload of BP is complete, then upload the address (Zip Code) data through the FM - BAPI_BUPA_ADDRESS_ADD and then call the FM BAPI_TRANSACTION_COMMIT to ensure the address upload is complete.
    5) Post the upload of BP and address data, call the FM CRM_MKTBP_PROCESS_BP_LIST to upload the Marketing Attributes of the Business Partners to the relevant tables and then again call the BAPI_TRANSACTION_COMMIT.
    I just wanted to check if the above steps are correct or am I missing something important there??
    Would appreciate expert opinion/guidance on this.
    There is a time constraint on completing this; hence would appreciate a quick and reliable response to it.
    BR,
    Ravi

    Hi Clemens,
    Thanks for your input.
    So, just wanted to re-iterate the points you highlighted -
    1) Instead of presentation server, you want the file to be read from application server and schedule this program as a background job? Am I following you correctly?
    2) Link the address upload along with the BP upload only (at the same time instead of separately) to ease of double processing through one FM - BAPI_BUPA_CREATE_FROM_DATA
    3) Calling BAPI_TRANSACTION_COMMIT every 1000 BPs or so for faster processing.
    However, you did not mention anything about attribute upload. Is that approach fine? or do I need to include anything more there?
    Please confirm and then I can close this question.
    BR,
    Ravi

  • Upload program for Vendor master Partner Data in XK02 needed info

    Hello Experts,
    I need to write data uplaod program for XK02 for vendor master Partner functions. ( Basically we created some custom partner functions and attach it to many existing vendors ).
    So kindly advice me which is the suitable upload method for this.
    1) There is no BAPI available for editing vendors.
    2) BDC is not possible because the Vendor partner screen is having table control and some records are already filled. (No of row not fixed).
    Is there any IDOC available or any standard input pgm?
    Please give suggestion.
    Thanks and rgds,
    Anand

    For the IDOC perspective, you can uses CREMAS.
    For the mass maintenance you still have XK99 (which also uses CREMAS internally)
    True there is NO BAPI
    For the BDC and the table control. Well this is not really true.
    In batchinput, instead of maintaining the rows by there Number, you should select it at the first position.
    OK-CODE /06 will open a selection screen SAPMF02K 2324. The result of the selection screen goes to the first line of the table control.
    Of course this works only in BDC
    reward points if helpful
    Edited by: Alain Bacchi  on Jun 18, 2008 8:48 AM

  • Need upload program for Vendor master partners (XK02)

    Hello Experts,
    I need to write data uplaod program for XK02 for vendor master Partner functions. ( Basically we created some custom partner functions and attach it to many existing vendors ).
    So kindly advice me which is the suitable upload method for this.
    1) There is no BAPI available for editing vendors.
    2) BDC is not possible because the Vendor partner screen is having table control and some records are already filled. (No of row not fixed).
    Is there any IDOC available or any standard input pgm?
    Please give suggestion.
    Thanks and rgds,
    Anand

    Hi,
    You can use LSMW --> Vendor Master which supports bothe XK01 and XK02.
    This is a standard Batch input program (RFBIKR00). Look at this program documentation for more info.
    Regards
    Sudhir Atluru

  • BDC or BAPI for me01 and me02 please read the requirement below

    Hi Experts
    I am having one requirement ,that
    I need to write a BDC program for Source list
    My alt file is having 3 filed with
    matnr werks lifnr
    if the material no and werks are same and the lifnr is not existing then it has to add the new vendor with the material and werks to the source list
    if matnr  werks and lifnr are not existing then need to create a new source list
    flat file
    10000001 4200 0230000000
    10000001 4200 0230000000
    10000001 4200 0230000000
    10000001 4200 0230000001
    10000002 4210 0230000002
    see in this flat file I'm having two diffrent vendors
    suppose in eord table existing
    matnr , werks,lifnr
    10000001   4200 0230000000
    so nw it has to check for whether vendor is existing or not if existing nothing to do if not then it has to add the new vendor
    if matnr werks and lifnr or not existing then it has to create new source list       
    means create the vendor
    Is there any BAPI or any sample prog is thr    please provide me
    WILL GIVE YOU POINTS IMMEDIATELY
    Thanks in advance

    Hi
    You can search in SDN for regarding Table Control and also go through the below links:
    Here are some of the links
    Re: Handling The Table Control while working with BDC
    Re: how do we handle BDC table control
    Re: how to create bdc with table control
    Regards,
    Vishwa.

  • Office 365 installed, can't choose Word 2007 as the default program for docx and doc files

    I have a client who just installed Office 365 on his Windows 7 PC. He still has Office 2007 installed. He's struggling with the changes in Word 2013 and wants me to uninstall Office 365. I thought I'd just set the default program association for .docx and
    .doc programs to Word 2007 but that doesn't seem possible. I can choose Default Programs, Associate a file type etc., and find the .docx extension. The current default is Word (desktop). I highlight the .docx extension and choose Change Program. The older
    version of Word isn't listed so I click Browse and find Program Files\Microsoft Office\Office12\winword.exe. Click OK, OK, OK, etc, but .docx files still open in Word 2013. The Default Program applet evidently sees all versions of Word as the same and refuses
    to change the association. How do I accomplish this ridiculously simple task?

    Fixed. Used a great little app from NirSoft called
    FileTypesMan. The built-in Windows utilities are getting worse by leaps and bounds.

  • EBS Financials Concurrent programs for Finance and HR

    Hi EBS Guru's ,
    I am compiling a list of concurrent programs that must be successfully processed in the EBS before the Incremental ETL load (from Data warehouse) is started.
    Did anyone have identified the concurrent programs from the EBS side, especially for Finance and HR?
    has anyone have identified few of the tasks ? that without done,Reports will not get the right (fresh) data on the reports,unless the concurrent program (also known as Interface programs)
    best regards,
    Kamlesh

    No ,these Concurrent Programs are from the EBS (Oracle Apps ),nothing to do with Data warehouse.
    these programs should be run in the source system,otherwise the incremental data in the Datawarehouse would be stale.

Maybe you are looking for

  • Install Window 7 Via BOOTCAMP and create extra partitons for Personal Data

    Hello All; I'm new to Mac, Just purchased the MBP Mid 2012 non retina 2 months ago.. and upgraded to Mountain Lion 10.8.2 I'd like to Install Winows 7 via BOOTCAMP and have extra 1 or 2 partitions (ExFAT) on the same drive for my personal data, any a

  • Having Multiple issues..Need help to solve L870D ST3NX1

    Dear All, I recently bought new laptop from ToshibaDirect.com. (L870D ST3NX1) As I have already posted the issue, I had problem with making partition and after using EasyUS partition software my machine was not able to recognize the recovery default

  • HT5429 maps on iphone 5 do not display anything

    Hi everyone. I recently bought a new iPhone 5 and I have a serious problem with my maps app. It does not display anything I search except the grid lines and pins. please help how can I fix it.  pls send the instructions at [email protected] Thank you

  • MVT 651 versus MVT 655

    L.S. Here at our customer we have a return process where standard MVT 651 is used. We want to have the option that goods, with quality, are posted using a MVT655. At first we would like to create QM entries for this material, but the question is if t

  • Notes on iPhone

    How can I transfer my notes on my old iPhone to my new iPhone 3g? and can I save them to my computer somehow? very important stuff that I need to keep with me. Please let me know.