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

How to modify table in this case

Former Member
0 Likes
556

Dear All,

I have a main table and an internal table as follows. As you can see the common field is QMNUM. I have to modify this main_table from the Internal table so that my main_table gets all the four entries for the QNUM from the internal table. How to write the loop in this case?

Thanx in advance.

Alok.

MAIN_TABLE

MBLNR QMNUM MJAHR BKTXT MATNR

-


500000793 000200000003 2006 A04567 ANNGRI14

INTERNAL _TABLE

QMNUM FENUM FEGRP FECOD ANZFEHLER

-


000200000003|0001 |L#1FE-03|0001 | 4 |

000200000003|0002 |L#1FE-03|0002 | 3 |

000200000003|0003 |L#1FE-03|0003 | 2 |

000200000003|0004 |L#1FE-03|0004 | 1 |

Dear All,

I have a main table and an internal table as follows. As you can see the common field is QMNUM. I have to modify this main_table from the Internal table so that my main_table gets all the four entries for the QNUM from the internal table. How to write the loop in this case?

Thanx in advance.

Alok.

MAIN_TABLE

MBLNR QMNUM MJAHR BKTXT MATNR

-


500000793 000200000003 2006 A04567 ANNGRI14

INTERNAL _TABLE

QMNUM FENUM FEGRP FECOD ANZFEHLER

-


000200000003|0001 |L#1FE-03|0001 | 4 |

000200000003|0002 |L#1FE-03|0002 | 3 |

000200000003|0003 |L#1FE-03|0003 | 2 |

000200000003|0004 |L#1FE-03|0004 | 1 |

3 REPLIES 3
Read only

Former Member
Read only

anversha_s
Active Contributor
0 Likes
530

hi,

put 1 more field in ur internal table along

with <i>QMNUM</i>.

better to put<i> MBLNR</i>

loop at internal_table into wa.

modify ztable from wa comparing QMNUM  MBLNR.
clear wa.

endloop.

rgds

anver

Read only

Former Member
0 Likes
530

hi ,

declare the additional fields in ur new internal table ITAB AS

MBLNR MJAHR BKTXT MATNR QMNUM FENUM FEGRP FECOD ANZFEHLER

to fetch the entries .

LOOP AT INTERNAL_TABLE.
READ TABLE MAIN_TABLE WITH KEY QMNUM  = INTERNAL TABLE-QMNUM.
IF SY-SUBRC EQ 0.
ITAB-MBLNR =  MAIN_TABLE-MBLNR.
ITAB-MJAHR =  MAIN_TABLE-MJAHR.
ITAB-BKTXT  =  MAIN_TABLE-BKTXT.
ITAB-MATNR =  MAIN_TABLE-MATNR.

ITAB-QMNUM         = INTERNAL_TABLE-QMNUM.
ITAB-FENUM          = INTERNAL_TABLE-FENUM.
ITAB-FEGRP           = INTERNAL_TABLE-FEGRP.
ITAB-FECOD           = INTERNAL_TABLE-FECOD.
ITAB-ANZFEHLER   = INTERNAL_TABLE- ANZFEHLER.

APPEND ITAB.
CLEAR ITAB.

ENDLOOP.

do like this ..

In ur case modify transporting the main table will cause inconsistencies as FENUM is there ,,

so better get the entries into a unified table having all the entries .

regards,

VIjay