on 12-16-2006 8:09 AM
dear all,
below is a sql stmt which does a query to an ODS in BW. What i'm trying to archieve is to assign value bbp_po_id to a key field within an ODS. I dont know ABAP and how to return a single value back to BW. Can someone please show guide me?
SELECT bbp_po_id bbp_poitem
FROM /BIC/AZCF_O100
INTO TABLE lt_cfsrm_po
WHERE bbp_po_id = COMM_STRUCTURE-bbp_po_id
AND bbp_poitem = COMM_STRUCTURE-bbp_poitem
AND prod_type = '02'.
hI,
Use the below coe in the start routinf of Update rules.
TYPES: BEGIN OF ITAB_STRUCTURE,
bbp_po_id like /BIC/AZCF_O100-bbp_po_id,
bbp_poitem like /BIC/AZCF_O100-bbp_poitem,
bbp_coitem like /BIC/AZCF_O100-bbp_coitem ,
TYPES END OF ITAB_STRUCTURE.
DATA:
lt_cfsrm_po TYPE SORTED TABLE OF ITAB_STRUCTURE
WITH HEADER LINE
WITH NON-UNIQUE KEY bbp_po_id bbp_poitem INITIAL SIZE 0.
SELECT bbp_po_id bbp_poitem bbp_coitem FROM /BIC/AZCF_O100 INTO
CORRESPONDING FIELDS OF TABLE lt_cfsrm_po
FOR ALL ENTRIES IN DATA_PACKAGE
WHERE bbp_po_id = DATA_PACKAGE-bbp_po_id
AND bbp_poitem = DATA_PACKAGE-bbp_poitem
AND prod_type = '02'.
LOOP AT DATA_PACKAGE.
READ TABLE lt_cfsrm_po WITH KEY bbp_po_id = DATA_PACKAGE-bbp_po_id
bbp_poitem = DATA_PACKAGE-bbp_poitem.
IF SY-SUBRC EQ 0.
DATA_PACKAGE-bbp_coitem = lt_cfsrm_po-bbp_coitem.
mODIFY DATA_PACKAGE.
ENDIF.
endloop.
With rgds,
Anil Kumar Sharma .P
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Simon,
a bit confuse .... the code will return the same bbp_po_id and bbp_poitem,
since the condition/WHERE clause use same field.
to return single value you can use code like
SELECT single *
FROM /BIC/AZCF_O100
INTO TABLE lt_cfsrm_po
WHERE .....
if sy-subrc = 0.
result = lt_cfsrm_po-bbp_po_id.
endif.
result = ods key field to be filled
if your ods has large volume data, you may consider to put the select in global area, and retrieve later in each routine, and if performance still suffer, consider indexing
in global area
SELECT *
FROM /BIC/AZCF_O100
INTO TABLE lt_cfsrm_po
WHERE .....
in routine
read table lt_cfsrm_po with key fieldname = comm_structure-fieldname binary search.
if sy-subrc = 0.
result = lt_cfsrm_po-bbp_po_id.
endif.
you will need at least a field that can match to the ods and return the other field(s).
hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
10 | |
8 | |
8 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.