on 08-05-2008 7:18 AM
hii,
as iam working on a BDC.
Iam facing a problem during the tcode execution.
During execution whenver i add a record that is allowing only when there is already an existing record.
If there is no record in that it is not allowing the ok code.
so please suggest any remedy for this.
<MOVED BY MODERATOR TO THE CORRECT FORUM>
Edited by: Alvaro Tejada Galindo on Aug 6, 2008 1:47 PM
hii,
hope this code may useful to u.
FORM load_data .
IF t_soft_succ[] IS NOT INITIAL.
PERFORM open_group.
perform insert_data.
LOOP AT t_soft_succ INTO w_soft_temp.
w_soft = w_soft_temp.
AT NEW doknr.
SELECT COUNT(*) FROM ztemst1 INTO w_count WHERE doknr = w_soft-doknr.
ENDAT.
PERFORM bdc_dynpro USING 'SAPMZEST' '9000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_field USING 'BDC_CURSOR'
'ZSEMST-DOKNR'.
PERFORM bdc_field USING 'ZSEMST-DOKNR'
w_soft-doknr.
IF w_count > 0.
*IF ALREADY THE ENTRIES ARE EXISTING THEN IT WILL EXECUTE THIS PART OF THE CODE.
PERFORM bdc_dynpro USING 'SAPMZEST' '9001'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ADD'.
PERFORM bdc_field USING 'BDC_CURSOR'
'%#AUTOTEXT012'.
ENDIF.
PERFORM bdc_dynpro USING 'SAPMZEST' '9001'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
PERFORM bdc_field USING 'BDC_CURSOR'
'ZSEMST-MSMXV(01)'.
*THIS PART OF THE CODE IS USED FOR DESELCTING THE ROW WHEN WE ADD NEW ENTRIES.
perform bdc_field using 'T_SOFT1-FLAG(01)'
''.
PERFORM bdc_field USING 'ZSEMST-IPCN(01)'
w_soft-ipcn.
PERFORM bdc_field USING 'ZSEMST-ATWRT(01)'
w_soft-atwrt.
PERFORM bdc_field USING 'ZSEMST-ATNAM(01)'
w_soft-atnam.
PERFORM bdc_field USING 'ZSEMST-MSMNV(01)'
w_soft-msmnv.
PERFORM bdc_field USING 'ZSEMST-MSMXV(01)'
w_soft-msmxv.
PERFORM bdc_dynpro USING 'SAPMZEST' '9001'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/EBACK'.
PERFORM bdc_field USING 'BDC_CURSOR'
'%#AUTOTEXT012'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=YES'.
PERFORM bdc_dynpro USING 'SAPMZEST' '9000'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/EBACK'.
PERFORM bdc_field USING 'BDC_CURSOR'
'ZSEMST-DOKNR'.
PERFORM bdc_transaction USING 'ZE01'.
*
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'ZE01' "TCODE
TABLES
dynprotab = bdcdata[]
EXCEPTIONS
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR :w_soft, w_soft_temp.
REFRESH bdcdata.
AT NEW doknr.
w_count = w_count + 1.
ENDAT.
AT END OF doknr.
CLEAR w_count.
ENDAT.
ENDLOOP.
PERFORM close_group.
SUBMIT rsbdcsub WITH mappe = 'ZSOFT_BS' AND RETURN.
ENDIF.
ENDFORM. " LOAD_DATA
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.