‎2007 Jul 18 3:36 PM
Hello Experts,
Actually, I have one structure and in that I am using one table type .
e.g. in the main structure, fields are as follows,
po_number po_line_item_no gr_details
here gr_details is table type having following fields.
gr_number gr_qty gr_date
As we all know that one po can have multiple GR,
I want to append entries in the above structure in such a way that for one po entry , in the same record , multiple Gr entries should come.
I am doing one program , in it is mendatory.
can anyone please revert back on the same with High Priority ( Coding in Program to append values as per explained above ).
Best Regards,
Rashmi.
‎2007 Jul 18 3:41 PM
Hi,
Use Select statement along with FOR ALL ENTRIES and get the data required for all the PO-NUMBERS into an internal table.
Then Loop at the Main table.
LOOP AT PO_MAIN INTO WA_PO.
DATA: temp_tab like PO_DETAILS.
LOOP AT PO_DETAILS INTO WA_DETAILS WHERE PO_NUMBER = WA_PO-PO_NUMBER.
APPEND WA_DETAILS to TEMP_TAB.
ENDLOOP.
WA_PO-GR_DETAILS = temp_tab.
clear temp_tab.
ENDLOOP.
Regards,
Sesh
‎2007 Jul 18 3:47 PM
field-symbols : <tab> type table,
<wa> type any.
data: wa like line of str-tab.
assign str-tab[] to <tab>.
assign wa to <wa> .
append <wa> to <tab>.
Hope it will work..
Regards
Prax
‎2007 Jul 18 4:00 PM
check this program code..
REPORT ZPRAX5.
type-pools: TRUXS.
data: begin of itab,
fld1(10) type c,
fld2(10) type c,
tab type TRUXS_T_TEXT_DATA,
end of itab.
data: wa like line of itab-tab.
append '786765876' to itab-tab.
append '678977876' to itab-tab.
itab-fld1 = '4786'.
itab-fld2 = '4989786'.
loop at itab-tab into wa.
write:/ wa.
endloop.Regards
Prax
‎2007 Jul 18 6:38 PM
Hi!
For the same PO entry multiple GRs in same record is not possible. But you can have multiple GR entries in your internal table with same PO details.
For eg. If you have one PO with 4 GRs then you will have 4 lines in internal table that belong to same PO but different GRs. In this case PO details would be redundant.
To read these values into internal table
1. You can read the GR details into corresponding columns of internal table and then update the PO columns for these records.
2. The other bit diffcult way could be to read all PO details into internal table. Then loop at internal table for each PO find out the no. of GRs. If it has N no of GRs then add (N-1) rows with same PO details and different GR details and update the N the GR detail into the existing row of the internal table. If it has only 1 GR then update the existing line. If PO has no GR then delete the table line.
Reward points for all the useful answers.