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

I need help in my code..

Former Member
0 Likes
873

i am the fields populating my internal tables and i am printing data from there. but i dont want to populate tables for some

value of a particular column.

How will be the WHere condition ....?

Suppose one of the column in internal table is 'partner type'.

I want to only populate for 'SP', 'BP','PH' .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
804

Hi,

loop at itab where partner type = 'SP' or partner type = 'BP' partner type = 'PH' .

write : /partner type.

endloop.

Cheers,

jose.

5 REPLIES 5
Read only

Former Member
0 Likes
805

Hi,

loop at itab where partner type = 'SP' or partner type = 'BP' partner type = 'PH' .

write : /partner type.

endloop.

Cheers,

jose.

Read only

0 Likes
804

wHERE IS THE PROBLEM ?? HERE REGARDING MY ABOVE QUESTION

SELECT

VBPA~VBELN

vbpa~adrnr

VBPA~PARVW

VBPA~KUNNR

VBPA~ADRNP

TPART~VTEXT

FROM VBPA AS VBPA

INNER JOIN TPART AS TPART

ON VBPAPARVW EQ TPARTPARVW

AND SPRAS = SY-LANGU

INTO CORRESPONDING FIELDS OF TABLE I_PARTNER

WHERE VBPA~VBELN EQ S_VBELN

and VBPA~PARVW EQ "SP"

OR VBPA~PARVW EQ "BP"

OR VBPA~PARVW EQ "SH".

Read only

0 Likes
804

Hi,

SELECT 
VBPA~VBELN
vbpa~adrnr
VBPA~PARVW
VBPA~KUNNR
VBPA~ADRNP
TPART~VTEXT
FROM VBPA AS VBPA
INNER JOIN TPART AS TPART
ON VBPA~PARVW EQ TPART~PARVW
AND SPRAS = SY-LANGU
INTO CORRESPONDING FIELDS OF TABLE I_PARTNER
WHERE VBPA~VBELN EQ S_VBELN "if s_vbeln is select-option change it like this VBPA~VBELN IN S_VBELN
and ( VBPA~PARVW EQ 'SP'  "brackets , single quotes
OR VBPA~PARVW EQ 'BP' 
OR VBPA~PARVW EQ 'SH' ).

Cheers,

jose.

Read only

0 Likes
804

Hi,

In the above scenario, the internal table i_partner will have values only if the partner type is SP, BP or SH.

So you can just write the values from the internal table i_partner just as it is.

Regards.

Read only

Former Member
0 Likes
804

TABLES: vbpa.

ranges: r_parvw for vbpa-parvw.

data: begin of i_vbpa occurs 0,

vbeln like vbpa-vbeln,

posnr like vbpa-posnr,

kunnr like vbpa-kunnr,

parvw like vbpa-parvw,

end of i_vbpa.

DATA: BEGIN OF i_final OCCURS 0,

vbeln LIKE vbpa-vbeln,

posnr LIKE vbpa-posnr,

kunnr LIKE vbpa-kunnr,

parvw LIKE vbpa-parvw,

END OF i_final.

r_parvw-low = 'AG'.

r_parvw-sign = 'I'.

r_parvw-option = 'EQ'.

APPEND r_parvw.

r_parvw-low = 'RE'.

APPEND r_parvw.

r_parvw-low = 'RG'.

APPEND r_parvw.

SELECT vbeln

posnr

kunnr

parvw

FROM vbpa

INTO TABLE i_vbpa

UP TO 50 ROWS.

loop at i_vbpa where parvw in r_parvw.

i_final = i_vbpa.

append i_final.

clear i_final.

endloop.

*OR

loop at i_vbpa where parvw eq 'AG' or parvw EQ 'RE' or parvw EQ 'RG'.

i_final = i_vbpa.

append i_final.

clear i_final.

endloop.

loop at i_final.

write:/ i_final-vbeln,i_final-posnr,i_final-kunnr,i_final-parvw.

endloop.