0% found this document useful (0 votes)
179 views2 pages

ANLB

This document contains SAP code for inserting a record into the ANLB table. It defines variables to store field values from the ANLB table. Selection options are used to filter the records retrieved from ANLB by company code and asset code. The field values stored in the variables are then used to populate the fields of a structure WA_M, which is then inserted into the ANLB table. If the insert is successful, a message is displayed.

Uploaded by

Sanjay P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
179 views2 pages

ANLB

This document contains SAP code for inserting a record into the ANLB table. It defines variables to store field values from the ANLB table. Selection options are used to filter the records retrieved from ANLB by company code and asset code. The field values stored in the variables are then used to populate the fields of a structure WA_M, which is then inserted into the ANLB table. If the insert is successful, a message is displayed.

Uploaded by

Sanjay P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

REPORT ZINSERT_PRG.

TABLES: ANLB.
*BREAK-POINT.
DATA: it_anlb TYPE TABLE OF anlb,
wa_m TYPe anlb .
DATA:
DATA:
DATA:
DATA:
DATA:
DATA:
DATA:
DATA:
DATA:

v_temp TYPE string.


v_temp1 TYPE string.
v_temp2 TYPE string.
v_temp3 TYPE string.
v_temp4 TYPE string.
v_temp5 TYPE string.
v_temp6 TYPE string.
v_temp7 TYPE string.
v_temp8 TYPE string.

SELECT-OPTIONS: s_bukrs FOR wa_m-bukrs OBLIGATORY,

"""company cod

e
s_anln1 FOR wa_m-anln1 OBLIGATORY,

""""""asset co

de
s_afabe FOR wa_m-afabe DEFAULT '32' .
BREAK-POINT.
SELECT *
FROM anlb
INTO TABLE it_anlb
WHERE afabe = '01' .
loop at it_anlb INTO wa_m WHERE anln1 = s_anln1-low and afabe = '01'.
"IF wa_m-afabe = '01'.
v_temp = wa_m-AFABG.
v_temp1 = wa_m-VMNTH.
v_temp2 = wa_m-INBDA.
v_temp3 = wa_m-PERFY.
v_temp4 = wa_m-ERNAM.
v_temp5 = wa_m-ERDAT.
v_temp6 = wa_m-AFASL.
v_temp7 = wa_m-NDJAR.
v_temp8 = wa_m-VYEAR.
" ENDIF.
endloop.
*wa_m-ernam = 'ZTEST'.
*wa_m-mandt = '200'.
*wa_m-bukrs = '1000'.
wa_m-bukrs = s_bukrs-low.
*wa_m-ANLN1 = '000021000547'.
wa_m-ANLN1 = s_anln1-low.
wa_m-ANLN2 = '0000'.
wa_m-AFABE = '32'.
wa_m-BDATU = '99991231'."'31.12.9999'.
""""yyyymmdd
wa_m-ADATU = '00000101'."'01.01.0000'.
wa_m-ERNAM = v_temp4.
wa_m-ERDAT = v_temp5. "'20160623'. "'23.06.2016'.
wa_m-AEDAT = '00000000'."'00.00.0000'.

wa_m-FELEI = '2000'.
wa_m-XGWGK = '0'.
wa_m-AFABG = v_temp. "'01.07.2016'.
*IF s_AFABE eq '32'.
*
**wa_m-AFABG = '20160701'. "'01.07.2016'.
*wa_m-AFABG = v_temp. "'01.07.2016'.
*
* wa_m-VMNTH = v_temp1.
* wa_m-INBDA = v_temp2.
*
*ENDIF.
wa_m-ZINBG = '00000000'. "'00.00.0000'.
wa_m-SAFBG = '00000000'. "'00.00.0000'.
wa_m-AFASL = v_temp6.
wa_m-NDJAR = v_temp7.
wa_m-NAPRZ = '0.0000'.
wa_m-SAPRZ = '0.0000'.
wa_m-APROP = '0.0000'.
wa_m-UMJAR = '0000'.
wa_m-NDURJ = '000'.
wa_m-NDURP = '000'.
wa_m-SCHRW = '0.00'.
wa_m-LGJAN = '2016'.
*wa_m-PERFY = '012'.
wa_m-PERFY = v_temp3.
wa_m-AUFWTG = '00'.
wa_m-VYEAR = v_temp8.
*if wa_m-vmnth = '004'.
*
*ENDIF.
*wa_m-VMNTH = '004'.
wa_m-VMNTH = v_temp1.
*wa_m-INBDA = '20160719'. "'19.07.2016'.
wa_m-INBDA = v_temp2. "'19.07.2016'.
wa_m-ABGDAT_B = '00000000'."'00.00.0000'.
wa_m-SCHRW_PROZ = '0.00000000000'.
wa_m-UMPER = '000'.
*wa_m-LINE_INDEX = '1'.
*wa_m-XGWGK = '0'.
insert into ANLB VALUES wa_m.

if sy-subrc = 0.
WRITE / 'Records inserted Successfully'.
ENDIF.

You might also like