Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Determine the source of a loaded column from script only

Situation I have only the scripts available and can't touch the QV server and don't have access to the QVW environment.

What I am trying is to document the qv scripts. I've made my parser and worked quite nice.

One thing still missing  is in case of resident load find the QVD source for this.

Using a recursive routine I can determine the first source.

But what to do in these situations:

BKPF_R3:

LOAD     if(applymap('Request_SCC', SAP_ODW_Key) = BUKRS, 'Yes', 'No')                        as _CC_R3_in_ODW_Ok,

        if(exists(ODW_Key_FP, SAP_ODW_Key & '_' & GJAHR & num(MONAT,'00')),'Ok','Not OK')    as _SAP_FP_in_ODW_Ok,

        BKPF_Kernel &'_'& BKPF_DocKey_Yr                                                    as  SAP#,                    // MW - Kernel name added to SAP Doc key to avoid NL01 issue

        SAP_ODW_Key                                                                            as  ODW#,

*;

LOAD    BUKRS & '_' & num(BELNR,'0000000000')                                                as  BKPF_DocKey,             // without year

        BUKRS & '_' & num(BELNR,'0000000000') & '_' & GJAHR                                    as  BKPF_DocKey_Yr,         // with year

        if(STJAH=0000,'No','Yes')                                                            as _SAP_R3_is_Reversal,

        left(BKTXT_2, 15)                                                                    as  SAP_ODW_Key,

        if(left(BKTXT,3)<>'REQ','No','Yes')                                                    as _SAP_BKTXT_is_REQ,

*;

LOAD    trim(upper(PurgeChar(BKTXT,' "')))                                                    as     BKTXT_2,

*           

Resident Tmp; DROP TABLE Tmp;

I want to determine the source of the columns of the second load. Like SAP_R3_is_reversal..

What I do know is copying the labels to the load statements and then based on the resident name and the load label names navigate to the former loads until I find one with a source name. What must be the label name of the second load BKPF_R3 or Tmp?

Thanks in advance!

John

1 Solution

Accepted Solutions
Not applicable
Author

I looked harder to this issue and created the following algorithm.

For every load without a source look upwards until a new load label found copy the source name to every load without a source and without a residence name.

Now a second loop over all the load items

For loads without a source and without a resident name. Copy the resident name to every load.

When this is done a recursive routine will find the correct data source. The recursion stops if a load is found with a source name.

John

View solution in original post

2 Replies
Not applicable
Author

Since there are no replies. I will try to make this more clear to you.

My goal is this for every column I want to determine it's ultimate source. I have the script in memory (loads, columns etc) and can create the documentation output wanted.

Load Year from [source_name] qvd it is simple I got the answer it is source name

The difficulties start when using resident load.

In case of this script

z:

load year, * from [source] (qvd)

x:

load

customer_name

load resident z;

y:

load birth_data

resident x;

So if I want to know the source of brith_date I found it's resident name x. With x I walk upwards in the tree and find another resident name z. From z I found the source.

So but what to do for these situations where not every load have it's own load label:

z:

load year, * from [source] (qvd);

load

customer_name

load resident z;

y:

load birth_data

resident x;

Now the second load has no load label. Which load label must I give this to have an algorithm to get to the source?

John

Not applicable
Author

I looked harder to this issue and created the following algorithm.

For every load without a source look upwards until a new load label found copy the source name to every load without a source and without a residence name.

Now a second loop over all the load items

For loads without a source and without a resident name. Copy the resident name to every load.

When this is done a recursive routine will find the correct data source. The recursion stops if a load is found with a source name.

John