2022 Apr 11 3:23 PM
Hi all, I wanted to update LFA1 with pan number so I have used the following code to do the same
CONCATENATE 'EE' gs_pa0185-pernr INTO gv_lifnr.
gw_lfa1-lifnr = gv_lifnr.
gw_lfa1-j_1ipanno = gs_pa0185-icnum.
READ TABLE gt_lfa1 INTO gs_lfa1 WITH KEY lifnr = gv_lifnr.
IF sy-subrc = 0.
CALL FUNCTION 'VENDOR_UPDATE'
EXPORTING
i_lfa1 = gw_lfa1
i_lfb1 = gw_lfb1
i_lfm1 = gw_lfm1
i_ylfa1 = gw_ylfa1
i_ylfb1 = gw_ylfb1
i_ylfm1 = gw_ylfm1
TABLES
t_xlfas = gt_xlfas
t_xlfb5 = gt_xlfb5
t_xlfbk = gt_xlfbk
t_xlfza = gt_xlfza
t_ylfas = gt_ylfas
t_ylfb5 = gt_ylfb5
t_ylfbk = gt_ylfbk
t_ylfza = gt_ylfza.
This made the LFA1 to get overwritten as I have updated it using FM without passing all the fileds, Is there any way that I can bring back the original master data?
2022 Apr 11 7:33 PM
Hi saikumarpogu812 ,
you used an update function module that performs the changes directly on the database. Normally you have to fill the (X)LFA1 and the corresponding Y-structure as well. The Y-structure contains the unchanged data of LFA1 before the change. You also have to consider the field UPDKZ ("I" for Insert, "U" for Update, "D" for Delete). SAP compares afterwards the X- and Y-structure to determine the changes to be posted on the database.
In your scenario, you only filled the LFA1-structure with only the fields that you want to change. That's why SAP is clearing all the other relevant fields. I guess that you cannot undo this change on the database when the COMMIT WORK as processed already.
I am sorry.
Kind regards
Jens
2022 Apr 11 7:33 PM
Hi saikumarpogu812 ,
you used an update function module that performs the changes directly on the database. Normally you have to fill the (X)LFA1 and the corresponding Y-structure as well. The Y-structure contains the unchanged data of LFA1 before the change. You also have to consider the field UPDKZ ("I" for Insert, "U" for Update, "D" for Delete). SAP compares afterwards the X- and Y-structure to determine the changes to be posted on the database.
In your scenario, you only filled the LFA1-structure with only the fields that you want to change. That's why SAP is clearing all the other relevant fields. I guess that you cannot undo this change on the database when the COMMIT WORK as processed already.
I am sorry.
Kind regards
Jens
2022 Apr 11 7:40 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |