‎2008 Aug 18 4:43 PM
Hello all,
I have the following requirement. Let me know how to proceed.
I have a complex internal table with the following fields/structures/tables:-
1. Order Number
2. X - Complex data structure
a. Header - Structure
b. Items - table
c. Partners - table
d. Conditions - table
e. Dates - table
3. Y - Comples data structure (same as X)Now I want to loop at Items table in X and based on PSTYV I have to modify (flip the signs of the price) the prices of that item in Conditions table.
How can I achieve this? Any clue?
Thanks,
Edited by: Lavanya Boora on Aug 18, 2008 5:43 PM
‎2008 Aug 18 5:27 PM
Hello.
Do something like this:
LOOP AT itab INTO wa1.
LOOP AT wa1-x-items INTO wa2 WHERE order_number = wa1-x-header-order_number.
CHECK wa2-pstyv EQ 'ABCD'.
LOOP AT wa1-x-conditions ASSIGNING <fs1>
WHERE order_number = wa1-x-header-order_number
AND order_item = wa2-order_item.
<fs1>-kbetr = <fs1>-kbetr * - 1.
ENDLOOP.
ENDLOOP.
ENDLOOP.
Regards.
Valter Oliveira.
‎2008 Aug 18 4:54 PM
You will be able to access it like:
LOOP AT ITAB.
LOOP AT ITAB-CONDTIONS INTO WA_CONDITIONS
ENDLOOP.
ENDLOOP.
Regards,
Naimesh Patel
‎2008 Aug 18 4:59 PM
Hi Lavanya,
You can look at the following eg:which will modify the internal table(Deep structure) to append all the line item for a particular purchase order no.Let me know if u have any queries.
REPORT z_vig_deep_struct.
TABLES:ekko.
BREAK-POINT.
DATA:BEGIN OF x_item,
ebelp TYPE ekpo-ebelp,
matnr TYPE mara-matnr,
makt TYPE makt-maktx,
END OF x_item.
DATA:BEGIN OF x_data ,
ebeln TYPE ekko-ebeln,
bukrs TYPE ekko-bukrs,
bstyp TYPE ekko-bstyp,
maktx TYPE makt-maktx,
x_deep LIKE STANDARD TABLE OF x_item ,
END OF x_data.
DATA:it_data LIKE TABLE OF x_data,
v_tem(4).
START-OF-SELECTION.
SELECT ebeln bukrs bstyp FROM ekko INTO CORRESPONDING FIELDS OF
TABLE it_data
UP TO 10 ROWS.
CHECK it_data[] IS NOT INITIAL.
LOOP AT it_data INTO x_data.
SELECT ebelp matnr FROM ekpo INTO CORRESPONDING FIELDS OF TABLE x_data-x_deep
WHERE ebeln = x_data-ebeln.
REPLACE ALL OCCURRENCES OF 'ABCD' IN x_data-maktx
WITH 'RRRRRRRRRRRRRRRR'.
MODIFY it_data FROM x_data .
ENDLOOP.
Regards,
Vigneswaran S
‎2008 Aug 18 5:27 PM
Hello.
Do something like this:
LOOP AT itab INTO wa1.
LOOP AT wa1-x-items INTO wa2 WHERE order_number = wa1-x-header-order_number.
CHECK wa2-pstyv EQ 'ABCD'.
LOOP AT wa1-x-conditions ASSIGNING <fs1>
WHERE order_number = wa1-x-header-order_number
AND order_item = wa2-order_item.
<fs1>-kbetr = <fs1>-kbetr * - 1.
ENDLOOP.
ENDLOOP.
ENDLOOP.
Regards.
Valter Oliveira.