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

Complex Internal tables - Modifications!

Former Member
0 Likes
854

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

1 ACCEPTED SOLUTION
Read only

valter_oliveira
Active Contributor
0 Likes
594

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.

3 REPLIES 3
Read only

naimesh_patel
Active Contributor
0 Likes
594

You will be able to access it like:


LOOP AT ITAB.
  LOOP AT ITAB-CONDTIONS INTO WA_CONDITIONS
  ENDLOOP.
ENDLOOP.

Regards,

Naimesh Patel

Read only

former_member491305
Active Contributor
0 Likes
594

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

Read only

valter_oliveira
Active Contributor
0 Likes
595

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.