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

BADI,

Former Member
0 Likes
439

Hi,

l used a BADI to populate custom table with information from delivery. Depending of some criteria.

Look like we can only use structure in OO to work with.

How can l add new row into Ztable ?

Robert

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
421

In OO environment:

you cannot use a table with header line & you cannot access a table directly.

You have to define a work area and use it to modify/update the internal/z-tables.

Syntax:

Modify ztable from wa_ztable.

Example From SAP Help:

DATA message_wa TYPE t100. 

message_wa-sprsl = 'EN'. 
message_wa-arbgb = 'MYMSGCLASS'. 
message_wa-msgnr =  '100'. 
message_wa-text =  'Some new message ...'. 

MODIFY t100 FROM message_wa.

3 REPLIES 3
Read only

Former Member
0 Likes
421

Hi Robert,

Use 'Modify dbtable from WA' statement.

here WA is the structure & dbtable is ur custom ztable.

Read only

Former Member
0 Likes
422

In OO environment:

you cannot use a table with header line & you cannot access a table directly.

You have to define a work area and use it to modify/update the internal/z-tables.

Syntax:

Modify ztable from wa_ztable.

Example From SAP Help:

DATA message_wa TYPE t100. 

message_wa-sprsl = 'EN'. 
message_wa-arbgb = 'MYMSGCLASS'. 
message_wa-msgnr =  '100'. 
message_wa-text =  'Some new message ...'. 

MODIFY t100 FROM message_wa.

Read only

Former Member
0 Likes
421

Dear Robert,

Yes you have to object oriented programing inside BADI.

Use this sample it should help you.

DATA ztab_wa TYPE ztab.

ztab_wa -field1 = 'AAAA'.

ztab_wa -field2 = 'BBBB'.

ztab_wa -field3 = 'CCCC'.

ztab_wa -field4 = 'DDDD'.

INSERT INTO ztab VALUES ztab_wa.

hope this would help you.Do reward points for useful answers.

Regards,

Suresh.