‎2022 Mar 30 3:49 PM
using bdc session method to upload excel file data to custom table,
but only one record is updating and rest are not.
plz help.
report ZBDC_PROG_PKB
no standard page heading line-size 255.
*include bdcrecx1.
*parameters: dataset(132) lower case.
*** Generated data section with specific formatting - DO NOT CHANGE ***
data: begin of record,
* data element:
VIEWNAME_001(030),
* data element: VIM_LTD_NO
LTD_DTA_NO_002(001),
* data element: VBELN_VA
VBELN_01_003(010),
* data element: VKORG
VKORG_01_004(004),
* data element: VTWEG
VTWEG_01_005(002),
* data element: SPART
SPART_01_006(002),
* data element: KNUMV
KNUMV_01_007(010),
end of record.
*** End generated data section ***
TYPES: BEGIN OF ls_bdc,
vbeln type VBELN_VA,
VKORG TYPE VKORG,
VTWEG TYPE VTWEG,
SPART TYPE SPART,
KNUMV TYPE KNUMV,
END OF ls_bdc.
DATA: lt_bdc TYPE TABLE OF ls_bdc,
wa_bdc TYPE ls_bdc,
lt_bdc1 TYPE TABLE OF ls_bdc,
wa_bdc1 TYPE ls_bdc,
lt_data TYPE truxs_t_text_data.
DATA: lt_bdcdata like bdcdata OCCURS 0 WITH HEADER LINE,
msgtab like bdcmsgcoll occurs 0 WITH HEADER LINE.
PARAMETERS: p_file TYPE rlgrap-filename.
start-of-selection.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
* PROGRAM_NAME = SYST-CPROG
* DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
IMPORTING
FILE_NAME = p_file
.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
I_LINE_HEADER = 'X'
I_TAB_RAW_DATA = lt_data
I_FILENAME = P_file
TABLES
I_TAB_CONVERTED_DATA = lt_bdc
* EXCEPTIONS
* CONVERSION_FAILED = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
IF lt_bdc is NOT INITIAL.
LOOP AT lt_bdc INTO wa_bdc.
wa_bdc1-vbeln = wa_bdc-vbeln.
wa_bdc1-vkorg = wa_bdc-vkorg.
wa_bdc1-vtweg = wa_bdc-vtweg.
wa_bdc1-spart = wa_bdc-spart.
wa_bdc1-knumv = wa_bdc-knumv.
APPEND wa_bdc1 TO lt_bdc1.
ENDLOOP.
ENDIF.
*perform open_dataset using dataset.
*perform open_group.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
* DEST = FILLER8
GROUP = 'ZBDC1'
* HOLDDATE = FILLER8
KEEP = 'X'
USER = sy-uname
* RECORD = FILLER1
* PROG = SY-CPROG
* DCPFM = '%'
* DATFM = '%'
* IMPORTING
* QID =
* 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.
* Implement suitable error handling here
ENDIF.
*do.
*
*read dataset dataset into record.
*if sy-subrc <> 0. exit. endif.
LOOP AT lt_bdc1 INTO wa_bdc1.
perform bdc_dynpro using 'SAPMSVMA' '0100'.
perform bdc_field using 'BDC_CURSOR'
'VIEWNAME'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'VIEWNAME'
record-VIEWNAME_001.
perform bdc_field using 'VIMDYNFLDS-LTD_DTA_NO'
record-LTD_DTA_NO_002.
perform bdc_dynpro using 'SAPLZVBAK_PKB' '0001'.
perform bdc_field using 'BDC_CURSOR'
'VIM_POSITION_INFO'.
perform bdc_field using 'BDC_OKCODE'
'=NEWL'.
perform bdc_dynpro using 'SAPLZVBAK_PKB' '0001'.
perform bdc_field using 'BDC_CURSOR'
'ZVBAK_PKB-KNUMV(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'ZVBAK_PKB-VBELN(01)'
wa_bdc1-vbeln.
* record-VBELN_01_003.
perform bdc_field using 'ZVBAK_PKB-VKORG(01)'
wa_bdc1-vkorg.
* record-VKORG_01_004.
perform bdc_field using 'ZVBAK_PKB-VTWEG(01)'
wa_bdc1-vtweg.
* record-VTWEG_01_005.
perform bdc_field using 'ZVBAK_PKB-SPART(01)'
wa_bdc1-vtweg.
* record-SPART_01_006.
perform bdc_field using 'ZVBAK_PKB-KNUMV(01)'
wa_bdc1-Knumv.
* record-KNUMV_01_007.
perform bdc_dynpro using 'SAPLZVBAK_PKB' '0001'.
perform bdc_field using 'BDC_CURSOR'
'ZVBAK_PKB-VBELN(02)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLZVBAK_PKB' '0001'.
perform bdc_field using 'BDC_CURSOR'
'ZVBAK_PKB-VBELN(02)'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_dynpro using 'SAPLZVBAK_PKB' '0001'.
perform bdc_field using 'BDC_CURSOR'
'ZVBAK_PKB-VBELN(02)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLZVBAK_PKB' '0001'.
perform bdc_field using 'BDC_CURSOR'
'ZVBAK_PKB-VBELN(02)'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_dynpro using 'SAPLZVBAK_PKB' '0001'.
perform bdc_field using 'BDC_CURSOR'
'ZVBAK_PKB-VBELN(01)'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_dynpro using 'SAPMSVMA' '0100'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'VIEWNAME'.
ENDLOOP.
*enddo.
*perform close_group.
*perform close_dataset using dataset.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'SM30'
* POST_LOCAL = NOVBLOCAL
* PRINTING = NOPRINT
* SIMUBATCH = ' '
* CTUPARAMS = ' '
TABLES
DYNPROTAB = lt_bdcdata
* EXCEPTIONS
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR lt_bdcdata.
lt_bdcdata-PROGRAM = PROGRAM.
lt_bdcdata-DYNPRO = DYNPRO.
lt_bdcdata-DYNBEGIN = 'X'.
APPEND lt_bdcdata.
ENDFORM.
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> space.
CLEAR lt_bdcdata.
lt_bdcdata-FNAM = FNAM.
lt_bdcdata-FVAL = FVAL.
APPEND lt_bdcdata.
ENDIF.
ENDFORM.
‎2022 Mar 30 8:42 PM
Did you try to run the batch input in visible mode in SM35 to see the detailed screen flow?
‎2022 Mar 30 9:19 PM
Is it me who don't understand, or are you really using Batch Input to insert lines in a custom table?
‎2022 Mar 31 6:05 AM
Yes Jens,
I did process the session in SM35 but it is only uploading one record only.
‎2022 Mar 31 7:31 AM
A batch input of the SM30 ? is there a difference with a direct update of the table ?
‎2022 Mar 31 7:45 AM
As Jens said, execute screen by screen, and tell us what you see. We are blind and you don't explain anything. How many SM30 transaction calls do you see in SM35 in your session? If you see only one line, it means that the culprit is your program. If you see more, execute screen by screen the 2 first SM30 transaction calls.