Application Development 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: 

ABAP - BDC transaction not saving changes to records

Former Member
0 Kudos

I am trying to write my first ABAP code using BDC recording. Essentially I would like to flag the "Final Delivery" field (EKPO-EGLKZ) for a range of documents by recording transaction MASS.

The code runs without errors - but the changes are not saved. I have run the code in "Processing Mode: A" (Display all screens) and the program successfully loops through each record & saves the updated fields. When I look at the documents in ME23N the changes have not been saved. Running the MASS transaction manually results in the changes being successfully saved so I can rule out any data validation issues.

Does anyone know why the changes refuse to save when running the code below?

I have considered trying to use BAPI_PO_CHANGE instead of BDC, but I am new to ABAP and I thought the BDC code would be less complex.

-




report Z_MASS_REMOVE_FDI_DCI
       no standard page heading line-size 255.

include bdcrecx1.

TYPES: BEGIN OF ty_tab,
MASSOBJTYP(7),
MASSVARNAM(7),
DOCNO(9),
ITEM(1),
END OF ty_tab.

DATA : it_tab TYPE STANDARD TABLE OF ty_tab.

DATA : wa_tab TYPE ty_tab.

START-OF-SELECTION.

CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'X:\STO.TXT'
* FILETYPE = 'ASC
has_field_separator = 'X'
TABLES
data_tab = it_tab
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.

END-OF-SELECTION.

LOOP AT it_tab INTO wa_tab.
WRITE:/ wa_tab-MASSOBJTYP,
wa_tab-MASSVARNAM,
wa_tab-DOCNO,
wa_tab-ITEM.

PERFORM open_group.

perform bdc_dynpro      using 'SAPMMSDL' '0100'.
perform bdc_field       using 'BDC_CURSOR'
                              'MASSSCREEN-OBJECT'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'MASSSCREEN-OBJECT'
                              wa_tab-MASSOBJTYP.
perform bdc_field       using 'MASSSCREEN-VARNAME'
                              wa_tab-MASSVARNAM.
perform bdc_dynpro      using 'SAPMMSDL' '0100'.
perform bdc_field       using 'BDC_CURSOR'
                              'MASSSCREEN-OBJECT'.
perform bdc_field       using 'BDC_OKCODE'
                              '=NEXT'.
perform bdc_dynpro      using 'SAPLMASS_SEL_DIALOG' '0100'.
perform bdc_field       using 'BDC_CURSOR'
                              'MASSFREESEL-LOW(01)'.
perform bdc_field       using 'MASSFREESEL-LOW(01)'
                              wa_tab-DOCNO.
perform bdc_dynpro      using 'SAPLMASS_SEL_DIALOG' '0100'.
perform bdc_field       using 'BDC_OKCODE'
                              '/00'.
perform bdc_field       using 'BDC_CURSOR'
                              'MASSFREESEL-LOW(02)'.
perform bdc_field       using 'MASSFREESEL-LOW(02)'
                              wa_tab-ITEM.
perform bdc_dynpro      using 'SAPLMASS_SEL_DIALOG' '0100'.
perform bdc_field       using 'BDC_OKCODE'
                              '=CRET'.
perform bdc_field       using 'BDC_CURSOR'
                              'MASSFREESEL-LOW(01)'.
perform bdc_dynpro      using 'SAPLMASSINTERFACE' '0200'.
perform bdc_field       using 'BDC_OKCODE'
                              '=FDAE'.
perform bdc_field       using 'BDC_CURSOR'
                              'NR_ITEMS'.
perform bdc_dynpro      using 'SAPLMASSINTERFACE' '0200'.
perform bdc_field       using 'BDC_OKCODE'
                              '=SAVE'.
perform bdc_field       using 'BDC_CURSOR'
                              'NR_ITEMS'.
perform bdc_dynpro      using 'SAPLMASSMSGLIST' '0300'.
perform bdc_field       using 'BDC_CURSOR'
                              'REOML-MSGTXT(01)'.
perform bdc_field       using 'BDC_OKCODE'
                              '=EXIT'.

perform bdc_transaction using 'MASS'.

ENDLOOP.
PERFORM close_group.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Where is BDC_INSERT.

If u use OPEN and CLOSE_group u need to use INSERT_GROUP also to update in database.

A session will be created and u nedd to run the Session in Sm35 in order to update the database.

Edited by: Ranjith Kumar on Sep 18, 2008 6:41 AM

2 REPLIES 2

Former Member
0 Kudos

Where is BDC_INSERT.

If u use OPEN and CLOSE_group u need to use INSERT_GROUP also to update in database.

A session will be created and u nedd to run the Session in Sm35 in order to update the database.

Edited by: Ranjith Kumar on Sep 18, 2008 6:41 AM

Former Member
0 Kudos

Hi,

try this

Write your loop statements after

perform open_group

regards

padma