I have the below code which does what I want it to do, however I want to add additional code so that any blank record for fields exit_prnt_layout and exit_web_layout in table hrp5021 is filled in with text STANDARD. I know how to extract data from tables but I'm struggling to understand how to add this functionality. I am very new to abap and help is appreciated.
TABLES: hrp5021.
DATA: hrp5021_wa TYPE hrp5021.
PARAMETERS: objid LIKE hrp5021-objid.
END-OF-SELECTION.
SELECT SINGLE * FROM hrp5021 INTO hrp5021_wa
WHERE plvar = '01'
AND otype = 'VA'
AND objid = objid
AND istat = '4'
AND exit_prnt_layout = 'STANDARD'.
IF sy-subrc = 0.
hrp5021_wa-exit_prnt_layout = 'SMARTFORM'.
UPDATE hrp5021 FROM hrp5021_wa.
WRITE:/ 'VA', objid, 'was changed to Smartform'.
ELSE.
WRITE:/ 'No entry for conversion found'.
ENDIF.
DISCLAIMER
It is almost never a good idea to update an SAP standard table directly. If you are new to SAP you can remove the "almost" from that statement.
So while I will answer your question I would strongly suggest that you try to find a SAP-approved way to update the necessary fields using BDC, BAPI or a released function module.
The following code will update all entries where exit_prnt_layout is blank:
update hrp5021 set exit_prnt_layout = 'STANDARD'
where exit_prnt_layout = space.
write:/ sy-dbcnt ' entries updated'.
And the same for exit_web_layout:
update hrp5021 set exit_web_layout = 'STANDARD'
where exit_web_layout = space.
write:/ sy-dbcnt ' entries updated'.