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

internal table

Former Member
0 Likes
709

Hi folks,

I have an internal table which contains matnr ,werks and lgort.

Now i want to separate records like matnr having single plant (werks) and single lgorts.

and i want 2 separate records like matnr having no lgort.

How can i do this???

Thanks in advance......

7 REPLIES 7
Read only

Former Member
0 Likes
685

Are you trying to have two tables with the results? or one table with both?

Read only

0 Likes
685

2 tables.......

Read only

Former Member
0 Likes
685

hi check this ..it will generate the output with matnr,plant,lgort...if u double click it will shows the matnr ,plant..

tables: mard.

data: begin of itab occurs 0,

matnr like mard-matnr,

werks like mard-werks,

lgort like mard-lgort,

end of itab.

data: begin of itab1 occurs 0,

matnr like mard-matnr,

werks like mard-werks,

end of itab1.

select-options:s_werks for mard-werks.

start-of-selection.

select matnr

werks

lgort

from mard

into table itab

where werks in s_werks.

loop at itab.

write:/ itab-matnr,itab-werks,itab-lgort.

endloop.

at line-selection.

if sy-lsind = 1.

select matnr

werks

from mard

into table itab1

where werks in s_werks.

loop at itab1.

write:/ itab1-matnr,itab1-werks.

endloop.

endif.

regards,

venkat

Read only

0 Likes
685

that is not my requirement.Anyway thanks for reply......

Read only

Former Member
0 Likes
685

hi ...

1st requirement ...

matnr aving no LGORT ...

parameters lgort type mard-lgort.

Select matnr

werks

from mard

where lgort = ' '.

2nd Requirment ...

Select matnr

werks

lgort

from mard

into itab1

where werks = s_werks

and lgort = s_lgort.

loop at itab1.

if itab1-matnr ne v_matnr.

append itab2.

endif.

at new matnr.

v_matnr = itab1-matnr.

endat.

endloop.

Read only

0 Likes
685

i want 2 separate it from an internal table .not by writing select statements....

Read only

Former Member
0 Likes
685

maybe this will help


DATA:
  BEGIN OF myrec,
    matnr        TYPE matnr,
    werks        TYPE werks_d,
    lgorts       TYPE c,
  END OF myrec,
  it_base LIKE STANDARD TABLE OF my_rec,
  it_werk LIKE STANDARD TABLE OF my_rec,
  it_gorts LIKE STANDARD TABLE OF my_rec.

LOOP AT it_base INTO myrec.
  IF NOT myrec-werks IS INITIAL.
    APPEND myrec TO it-werks.
  ENDIF.
  IF NOT myrec-lgorts IS INITIAL.
    APPEND myrec TO it-gorts.
  ENDIF.
ENDLOOP.