‎2006 Nov 20 3:55 AM
Hi,
1.I've created a Z table & want the values to be saved through programming in the table.i've got selection screen with 2 fields(MBLNR & MJAHR) based on which the values need to be saved(like MBLNR , MJAHR,sy-datum,sy-uname,& machine id i.e.system id.)
2.what shud be the data element for machine id so that it has value equal to system id?
Pls guide me as it is a bit urgent.
Helpful answers will be rewarded.
Regards,
Sipra
‎2006 Nov 20 3:59 AM
You can use the system variable SY-SYSID(system id) for machine_id
‎2006 Nov 20 3:58 AM
‎2006 Nov 20 3:58 AM
You can refer to the same data element that is being referred in the Z table.
Or is it that you are asking for the data element that you want to use in the Z table .
Regards,
Ravi
‎2006 Nov 20 3:59 AM
You can use the system variable SY-SYSID(system id) for machine_id
‎2006 Nov 20 4:12 AM
‎2006 Nov 20 5:33 AM
‎2006 Nov 20 5:43 AM
Hi Sipra,
created a Z table & want the values to be saved through programming in the table.i've got selection screen with 2 fields(MBLNR & MJAHR) based on which the values need to be saved(like MBLNR , MJAHR,sy-datum,sy-uname,& machine id i.e.system id.).
for ur question.
declare an internal table(itab) of the ztable structure.
Now move the values to the internal table(itab).
for example if u wnt the selection screen fields then
move : field1 to itab-field1,
field2 to itab-field2.
then update the ztable by giving command
UPDATE ZTABLE FROM TABLE itab.
if sy-subrc eq 0.
commit work.
endif.
Regards,
Nagaraj
Message was edited by:
nagaraj kumar nishtala
‎2006 Nov 20 5:49 AM
hi,
sample code .
REPORT ztestreport .
DATA : BEGIN OF int OCCURS 0,
field1 LIKE ztable-field1,
field2 LIKE ztable-field2,
field3 LIKE ztable-feild3,
END OF int.
int-field1 = '501'.
int-field2= 'Test Data'.
int-field3 = '0001'.
APPEND int.
INSERT ztable FROM TABLE int.
COMMIT WORK.Rgds
Anver
‎2006 Nov 20 5:57 AM
Hi Sipra,
1. You create Z table with mentioned field MBLNR , MJAHR,sy-datum,sy-uname,&
machine id.
Now create internal table LIKE z table.
and assign values to it.
it_z-mblnr = s_mblnr (from seleciton screen)
it_z-mjahr = s_mjahr (from seleciton screen)
it_z-date = sy-datum
it_z-name = sy-uname
it_z-sysid = sy-sysid.
APPEND it_z.
MODIFY Z* from it_z.
Commit work.
2. You can use SY-SYSID as data element
*REWARD if this helps
‎2006 Nov 20 6:31 AM
Hi,
I created the internal table IT_GE & proceeded the way u suggested but it is giving the error 'the work area IT_GE is not long enough.
what could be the possible reason?
Pls suggest.
Regards,
Sipra
‎2006 Nov 20 6:35 AM
Hi Sipra,
u need to create the internal table and workarea having ztable structure.then only it will work correctly.Already i have given my answer ,please chk and do it...it will work.
regards,
Nagaraj
‎2006 Nov 20 7:15 AM
Hi,
I did the same.
i'm pasting the declarations that i've made & pls guide me what the prob is?
DATA: BEGIN OF WA_GE,
MBLNR LIKE ZGEXIT-MBLNR,
MJAHR LIKE ZGEXIT-MJAHR,
UNAME LIKE SY-UNAME,
NAME_TEXTC LIKE ZGEXIT-NAME_TEXTC,
BUDAT1 LIKE SY-DATUM,
ETIME LIKE SY-UZEIT,
MACHID LIKE SY-SYSID,
END OF WA_GE.
DATA: IT_GE LIKE TABLE OF WA_GE WITH HEADER LINE.
regards,
Sipra
‎2006 Nov 20 7:27 AM
Hi Sipra,
Just check this link
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3660358411d1829f0000e82
9fbfe/frameset.htm
and try using this
DATA: BEGIN OF WA_GE <b>occurs 0</b>,
MBLNR LIKE ZGEXIT-MBLNR,
MJAHR LIKE ZGEXIT-MJAHR,
UNAME LIKE SY-UNAME,
NAME_TEXTC LIKE ZGEXIT-NAME_TEXTC,
BUDAT1 LIKE SY-DATUM,
ETIME LIKE SY-UZEIT,
MACHID LIKE SY-SYSID,
END OF WA_GE.
DATA: IT_GE LIKE TABLE OF WA_GE WITH HEADER LINE.
or u can simply use.
DATA: ITAB like table of ztable with header line.
if u still have problems in inserting data into Ztable have a look at these links
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/insert_i.htm
http://help.sap.com/saphelp_46c/helpdata/en/34/8e72c56df74873e10000009b38f9b8/content.htm
regards
Sachin
Message was edited by:
Sachin Dhingra
‎2006 Nov 20 8:40 AM
Hi,
the prob still persists(i.e. the work area IT_GE is not long enough).
the program gives no error if I comment the line that updates entries into z table but as soon as I uncomment it ,it gives the error as stated above.
Pls help me.
Regards,
Sipra
‎2006 Nov 20 8:55 AM
Hi Sipra,
do one thing
declare like this..
data : it_ge type standard table of ztable,
wa_ge type ztable.
also try like this.
TYPES: BEGIN OF ty_GE,
MBLNR LIKE ZGEXIT-MBLNR,
MJAHR LIKE ZGEXIT-MJAHR,
UNAME LIKE SY-UNAME,
NAME_TEXTC LIKE ZGEXIT-NAME_TEXTC,
BUDAT1 LIKE SY-DATUM,
ETIME LIKE SY-UZEIT,
MACHID LIKE SY-SYSID,
END OF ty_GE.
DATA: IT_GE TYPE STANDARD TABLE OF TY_GE,
WA_GE TYPE TY_GE.
REGARDS,
NAGARAJ
‎2006 Nov 21 4:06 AM