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

how to write query for this.

Former Member
0 Likes
444

hi,

i have table pa0002 with fields nachn and vorna.

i m writting coding every time i m getting first record as output.

those two fields , two rows showing same record.

coding is like this

SELECT telnum kartnr zutart pernr zdate pinnr puknr tarif1 tarif2 tarif3 gtype imei twincard twinbill einbau beschr text1 text2 text3

FROM zfm_handy

INTO TABLE it_zfm_handy.

*

*select * from zfm_handy into corresponding fields of table it_zfm_handy.

*

IF NOT it_zfm_handy[] IS INITIAL.

SELECT nachn

vorna

pernr

FROM pa0002

INTO TABLE it_pa0002

FOR ALL ENTRIES IN it_zfm_handy where pernr = it_zfm_handy-pernr and ( NACHN ne space or vorna ne space ).

ENDIF. " not it_zfm_handy

LOOP AT it_zfm_handy.

READ TABLE it_pa0002 with key pernr = it_zfm_handy-pernr.

  • KEY pernr = it_zfm_handy-pernr.

  • read table it_pa0002 index 1.

IF sy-subrc = 0.

CLEAR it_moblist.

MOVE-CORRESPONDING it_zfm_handy TO it_moblist.

MOVE-CORRESPONDING it_pa0002 TO it_moblist.

APPEND it_moblist .

ENDIF. " sy-subrc

ENDLOOP.

hi,

i have table pa0002 with fields nachn and vorna.

i m writting coding every time i m getting first record as output.

those two fields , two rows showing same record.

coding is like this

SELECT telnum kartnr zutart pernr zdate pinnr puknr tarif1 tarif2 tarif3 gtype imei twincard twinbill einbau beschr text1 text2 text3

FROM zfm_handy

INTO TABLE it_zfm_handy.

*

*select * from zfm_handy into corresponding fields of table it_zfm_handy.

*

IF NOT it_zfm_handy[] IS INITIAL.

SELECT nachn

vorna

pernr

FROM pa0002

INTO TABLE it_pa0002

FOR ALL ENTRIES IN it_zfm_handy where pernr = it_zfm_handy-pernr and ( NACHN ne space or vorna ne space ).

ENDIF. " not it_zfm_handy

LOOP AT it_zfm_handy.

READ TABLE it_pa0002 with key pernr = it_zfm_handy-pernr.

  • KEY pernr = it_zfm_handy-pernr.

  • read table it_pa0002 index 1.

IF sy-subrc = 0.

CLEAR it_moblist.

MOVE-CORRESPONDING it_zfm_handy TO it_moblist.

MOVE-CORRESPONDING it_pa0002 TO it_moblist.

APPEND it_moblist .

ENDIF. " sy-subrc

ENDLOOP.

3 REPLIES 3
Read only

Former Member
0 Likes
418

hi,

The problem is with

SELECT nachn

vorna

pernr

FROM pa0002

INTO TABLE it_pa0002

FOR ALL ENTRIES IN it_zfm_handy where pernr = it_zfm_handy-pernr.

here it is selecting only 10 persons. i have 1000 per

loop at table TABLE it_zfm_handy and for every record where the field pernr > 0, select the corresponding name from PA0002. plz write this statement according to this requirement.

Read only

0 Likes
418

Try specifying BEGDA and ENDDA.

Rob

Read only

0 Likes
418

Select all the key fields in your query:

PERNR

SUBTY

OBJPS

SPRPS

ENDDA

BEGDA

SEQNR

Thanks,

Santosh