cancel
Showing results for 
Search instead for 
Did you mean: 

Start Routine to Two DSOs

Former Member
0 Kudos

Hi Experts,

I have two DSOs, One for 0MATERIAL_ATTR and another for 0MAT_SALES_ATTR. My requirement is to write a start routine while updating to YMAT_SALES_ATTR DSO which has a reference of Material from the YMAT_ATTR DSO. The material DSO is already loaded.

I have a written the Start routine for it. Now I have to Load the Materials to another Error DSO(YSALES_ERR) when the reference is not found. I have to rewirite the same start routine to update another DSO with the above condition.

I would appreciate some help.

Thanks,

Seema

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Seema,

Instead of loading error / missing records to an Error ODS, create a Table and update directly using a simple ABAP statement (Update or Modify).

Write a code in start routine of update rules of Mat_Sales, compare and update to table.

Hope it Helps

Srini

Former Member
0 Kudos

Hi Srinivas,

This is what Iam exactly trying to do. If you see my Post I have pasted a code which has a DELETE statement. Instead of that I need to update in the external table.

Can you help me with the steps. Iam sorry I dont have ABAP experience.

Thanks,

Seema

Answers (1)

Answers (1)

Former Member
0 Kudos

As far as I understood you need to compare Material and Material sales and find the data which has no sales reference and record them to the error cube.

If so here is the solution:

You have to write a routine for error cube data load and in this data load

--create an internal table from material sales ODS with three fields:sign,option, material reference.

--put 'I' for sign, put 'EQ' for option and fill the material reference from material sales ods.

--remove adjacent duplicates from this newly created internal table.

--start a select loop on material ods with condition of the references that are not included in the internal table you created. inside this select make necessary additions to the error ODS.

Hope this helps.

Thanks

Former Member
0 Kudos

Hi Baris,

Thanks for the Info.

Now I have solution to write the records which are not present in the YMATERIAL into a external table. Please help me with the steps .

Following is the code which I have written .

select /BIC/YMATERIAL

from /BIC/AYCL1O00900

into table it_t_matnr.

Sort it_t_matnr.

CLEAR wa_source_package.

LOOP AT SOURCE_PACKAGE INTO wa_SOURCE_PACKAGE.

CLEAR wa_t_matnr.

READ TABLE it_t_matnr with key material =

wa_source_package-mat_sales

INTO wa_t_matnr

BINARY SEARCH.

IF SY-SUBRC NE 0.

  • The current material doesnu2019t exist in table /BIC/AYCL1O00900.

DELETE TABLE SOURCE_PACKAGE FROM WA_SOURCE_PACKAGE.

ENDIF.

Instead if the DELETE statement, I need to write them in a External Table.

Thanks in advance.

Seema

Former Member
0 Kudos

Seema,

Use update or Modify statement instead of Delete. Create an table at SE11 and use.


select /BIC/YMATERIAL
from /BIC/AYCL1O00900
into table it_t_matnr.

Sort it_t_matnr.

CLEAR wa_source_package.
LOOP AT SOURCE_PACKAGE INTO wa_SOURCE_PACKAGE.

CLEAR wa_t_matnr.

READ TABLE it_t_matnr with key material =
wa_source_package-mat_sales
INTO wa_t_matnr
BINARY SEARCH.

IF SY-SUBRC NE 0.
The current material doesnu2019t exist in table /BIC/AYCL1O00900. 

UPDATE TABLE <TABLE NAME> FROM WA_SOURCE_PACKAGE.

ENDIF.

Srini

Former Member
0 Kudos

Hi Srinivas,

Thanks for the help. Do I need to Declare the external table anywhere in the code. It is giving and error as "<Table name> is not expected".

Please help.

Thanks ,

Seema