Application Development and Automation 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: 
Read only

Classical Report

Former Member
0 Likes
1,288

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,260

You can use the system variable SY-SYSID(system id) for machine_id

15 REPLIES 15
Read only

Former Member
0 Likes
1,260

Do U want DATA ELEMNT or DOMAIN???

Read only

Former Member
0 Likes
1,260

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

Read only

Former Member
0 Likes
1,261

You can use the system variable SY-SYSID(system id) for machine_id

Read only

Former Member
0 Likes
1,260

Hi sipra jain,

You can use SY-SYSID as a machine Id.

Read only

0 Likes
1,260

thnx but my first prob is still unanswered.

Regards,

Sipra

Read only

former_member404244
Active Contributor
0 Likes
1,260

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

Read only

anversha_s
Active Contributor
0 Likes
1,260

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

Read only

Former Member
0 Likes
1,260

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

Read only

0 Likes
1,260

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

Read only

former_member404244
Active Contributor
0 Likes
1,260

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

Read only

0 Likes
1,260

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

Read only

0 Likes
1,260

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

Read only

Former Member
0 Likes
1,260

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

Read only

former_member404244
Active Contributor
0 Likes
1,260

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

Read only

Former Member
0 Likes
1,260

Thnx for contributing in solving my prob.

Regards,

Sipra