‎2006 Dec 19 2:00 PM
Hi,
I have my internal table as follows:
DATA: BEGIN OF I_DATA OCCURS 0,
prgname TYPE SYST-REPID,
matnr TYPE mara-matnr,
berid TYPE mdma-berid,
END OF I_DATA.
Data that fills into can be as follows:
Ex:
PROGRAM1,1000,MRP1
PROGRAM1,1000,MRP1
PROGRAM1,2000,MRP1
PROGRAM2,1000,MRP1
PROGRAM2,1000,MRP1
PROGRAM2,2000,MRP1
PROGRAM3,1000,MRP1
PROGRAM3,1000,MRP1
PROGRAM3,2000,MRP1
It can any order in above way.
Then i will sort the above data as follows:
SORT I_DATA BY prgname matnr berid.
Now here my issue is:
DATA: t_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE.
I need to push the above internal table data into T_OBJTXT internal table as follows:
It should first Display program Name as Program Name: Program3, Then column heading MATNR, BERID below it and data of that program[1st] below them till all the 1st program's data finished. Whenever MATNR value changes in this program list i need to print an ***** like line. TO indicate all the materials printed.
When 2nd program comes again i have to write Program Name: Program2, Then column heading MATNR, BERID below it and data of that program[1st] below them till all the 1st program's data finished. Whenever MATNR value changes in this program list i need to print an ***** like line. TO indicate all the materials printed.
When 3nd program comes again i have to write Program Name: Program3, Then column heading MATNR, BERID below it and data of that program[1st] below them till all the 1st program's data finished. Whenever MATNR value changes in this program list i need to print an ***** like line. TO indicate all the materials printed.
Etc. Same process we need to follow.
The final out put should be as below:
*****************************************
PROGRAM NAME : PROGRAM1
*****************************************
MATNR, BERID
-
1000,MRP!
1000,MRP1
*****************************************
2000,MRP1
*****************************************
PROGRAM NAME : PROGRAM2
*****************************************
MATNR, BERID
-
1000,MRP!
1000,MRP1
*****************************************
2000,MRP1
*****************************************
PROGRAM NAME : PROGRAM3
*****************************************
MATNR, BERID
-
1000,MRP!
1000,MRP1
*****************************************
2000,MRP1
Like wise o/p need to be send to I_OBJTXT and to email.
<b>The logic i have written is as follows:</b>
LOOP AT I__DATA.
AT NEW PRGNAME.
MOVE '*****************************************' TO t_objtxt-line.
APPEND t_objtxt.
CLEAR t_objtxt.
CONCATENATE t_objtxt-line 'PROGRAM NAME : '
I_DATA-PRGNAME
INTO t_objtxt-line.
APPEND t_objtxt.
CLEAR t_objtxt.
MOVE '*****************************************' TO t_objtxt-line.
APPEND t_objtxt.
CLEAR t_objtxt.
CONCATENATE TEXT-024 " Material
TEXT-025 " MRP
INTO t_objtxt-line
SEPARATED BY C_COMMA.
APPEND t_objtxt.
CLEAR t_objtxt.
MOVE '-----------------------------------------' TO t_objtxt-line.
CONCATENATE t_objtxt-line '------------------' INTO t_objtxt-line.
APPEND t_objtxt.
CLEAR t_objtxt.
ENDAT.
* MOVE '' TO t_objtxt-line.
* APPEND t_objtxt.
* CLEAR t_objtxt.
CONCATENATE I_DATA-MATNR
I_DATA-BERID
INTO t_objtxt-line
SEPARATED BY C_COMMA.
APPEND t_objtxt.
CLEAR t_objtxt.
AT END OF MATNR.
MOVE '' TO t_objtxt-line.
APPEND t_objtxt.
CLEAR t_objtxt.
MOVE '*****************************************' TO t_objtxt-line.
CONCATENATE t_objtxt-line '******************' INTO t_objtxt-line.
CONCATENATE t_objtxt-line '******************' INTO t_objtxt-line.
APPEND t_objtxt.
CLEAR t_objtxt.
ENDAT.
ENDLOOP.
The above logic is not working correctly.
Can anybody give me correct logic for the same.
Thanks in advance.
Thanks,
Deep.
‎2006 Dec 19 2:12 PM