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

where can i put Loop..... and Endloop

Former Member
0 Likes
566

Hi Friends,

I'm the BW consultant...

i had written one START ROUTINE.. for the purpose of this is... it was fetching the Product codes data from another DSO .. based on Bill no's

for this i had create one structure..

after that i had create one table..

after that i had create one work area..

but the problem is it was fetching first record from the DSO and loaded into consolidated DSO... not all the product numbers.. each bill contain several products...

for this.. in start routine.. i defined gloabally.. the structure.. and select statement..

TYPES: BEGIN OF ITAB,

/BIC/RBILLNO TYPE /BIC/OIRBILLNO,

/BIC/RPRD_CDE TYPE /BIC/OIRPRD_CDE,

/BIC/RPRD_QTY TYPE /BIC/OIRPRD_QTY,

/BIC/RUNT_PRI TYPE /BIC/OIRUNT_PRI,

/BIC/RPRD_RATE TYPE /BIC/OIRPRD_RATE,

END OF ITAB,

JTAB TYPE STANDARD TABLE OF ITAB WITH NON-UNIQUE DEFAULT KEY.

DATA : KTAB TYPE JTAB ,

KTAB_WA TYPE ITAB,

SELECT /BIC/RBILLNO /BIC/RPRD_CDE /BIC/RPRD_QTY /BIC/RUNT_PRI

/BIC/RPRD_RATE FROM /BIC/ATESTODS100 INTO TABLE KTAB FOR ALL ENTRIES IN SOURCE_PACKAGE WHERE /BIC/RBILLNO = SOURCE_PACKAGE-/BIC/RBILLNO.

And I wrote select statement... it was working fine....

and field level.. i had written the following code...

CLEAR KTAB_WA.

READ TABLE KTAB INTO KTAB_WA with key /BIC/RBILLNO = SOURCE_FIELDS-/BIC/RBILLNO BINARY SEARCH.

IF sy-subrc eq 0 .

RESULT = ktab_wa-/bic/rprd_cde.

ENDIF.

so, how can i put the loop for this... can you plz tell me the solution..

regards

BABU

Hi Friends,

I'm the BW consultant...

i had written one START ROUTINE.. for the purpose of this is... it was fetching the Product codes data from another DSO .. based on Bill no's

for this i had create one structure..

after that i had create one table..

after that i had create one work area..

but the problem is it was fetching first record from the DSO and loaded into consolidated DSO... not all the product numbers.. each bill contain several products...

for this.. in start routine.. i defined gloabally.. the structure.. and select statement..

TYPES: BEGIN OF ITAB,

/BIC/RBILLNO TYPE /BIC/OIRBILLNO,

/BIC/RPRD_CDE TYPE /BIC/OIRPRD_CDE,

/BIC/RPRD_QTY TYPE /BIC/OIRPRD_QTY,

/BIC/RUNT_PRI TYPE /BIC/OIRUNT_PRI,

/BIC/RPRD_RATE TYPE /BIC/OIRPRD_RATE,

END OF ITAB,

JTAB TYPE STANDARD TABLE OF ITAB WITH NON-UNIQUE DEFAULT KEY.

DATA : KTAB TYPE JTAB ,

KTAB_WA TYPE ITAB,

SELECT /BIC/RBILLNO /BIC/RPRD_CDE /BIC/RPRD_QTY /BIC/RUNT_PRI

/BIC/RPRD_RATE FROM /BIC/ATESTODS100 INTO TABLE KTAB FOR ALL ENTRIES IN SOURCE_PACKAGE WHERE /BIC/RBILLNO = SOURCE_PACKAGE-/BIC/RBILLNO.

And I wrote select statement... it was working fine....

and field level.. i had written the following code...

CLEAR KTAB_WA.

READ TABLE KTAB INTO KTAB_WA with key /BIC/RBILLNO = SOURCE_FIELDS-/BIC/RBILLNO BINARY SEARCH.

IF sy-subrc eq 0 .

RESULT = ktab_wa-/bic/rprd_cde.

ENDIF.

so, how can i put the loop for this... can you plz tell me the solution..

regards

BABU

3 REPLIES 3
Read only

Former Member
0 Likes
548

<i>READ TABLE KTAB INTO KTAB_WA with key /BIC/RBILLNO = SOURCE_FIELDS-/BIC/RBILLNO BINARY SEARCH.

IF sy-subrc eq 0 .

RESULT = ktab_wa-/bic/rprd_cde.

ENDIF.</i>

You can use loop endloop instead of READ TABLE..

LOOP AT KTAB INTO KTAB_WA with key /BIC/RBILLNO = SOURCE_FIELDS-/BIC/RBILLNO.

CHECK sy-subrc eq 0 .

RESULT = ktab_wa-/bic/rprd_cde.

ENDLOOP.

Regards

Prax

Read only

Former Member
0 Likes
548

You can try this instead of

READ TABLE KTAB INTO KTAB_WA with key /BIC/RBILLNO = SOURCE_FIELDS-/BIC/RBILLNO BINARY SEARCH.

try this change

loop at KTAB INTO KTAB_WA where /BIC/RBILLNO = SOURCE_FIELDS-/BIC/RBILLNO.

RESULT = ktab_wa-/bic/rprd_cde.

endloop.

regards

shiba dutta

Read only

0 Likes
548

ThankQ Friends..

But still it was added only one record.. that means.. previously it was added first recrd.. but.. now after aputting the loop it was added only Last record..

my requirement is.. i want to get all the records.. Product numbers.. based on that bill no..

plz help on this.. i dont know coding..

regards

Babu