cancel
Showing results for 
Search instead for 
Did you mean: 

regarding select statement

Former Member
0 Kudos

Dear experts,

I am fetching data from likp table.and my select statement is:

SELECT vbeln

vgbel

posnr

arktx

fkimg

mwsbp

aubel

brgew

netwr FROM vbrp

INTO TABLE it_vbrp

WHERE vbeln = wa_vbrk-vbeln.

IF sy-subrc EQ 0.

SORT it_vbrp BY aubel.

DELETE ADJACENT DUPLICATES FROM it_vbrp COMPARING vbeln.

SELECT vgbel

vbeln

posnr FROM lips

INTO TABLE it_lips

FOR ALL ENTRIES IN it_vbrp

WHERE vbeln = it_vbrp-vgbel.

IF sy-subrc EQ 0.

READ TABLE it_lips INTO wa_lips INDEX 1 .

DELETE ADJACENT DUPLICATES FROM it_lips COMPARING vgbel.

IF sy-subrc EQ 0.

SELECT SINGLE vbeln

lfdat

erdat

erzet

wadat_ist

spe_wauhr_ist

lifnr

inco1

anzpk

ablad

traty

btgew FROM likp

INTO wa_likp

WHERE vbeln = wa_lips-vbeln.

IF sy-subrc EQ 0.

MOVE :wa_likp-vbeln TO wa_header-doc_vbeln,

wa_likp-lfdat TO wa_header-doc_lfdat,

wa_likp-erdat TO wa_header-pre_erdat,

wa_likp-erzet TO wa_header-pre_erzet,

wa_likp-wadat_ist TO wa_header-rem_wadat_ist,

wa_likp-spe_wauhr_ist TO wa_header-rem_spe_wauhr_ist,

wa_likp-lifnr TO wa_header-ven_code,

wa_likp-inco1 TO wa_header-delv_terms,

wa_likp-anzpk TO wa_header-num_packages,

wa_likp-ablad TO wa_header-destination,

wa_likp-traty TO wa_header-mode_trans.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

while I am debugging data is coming into it_lips but no data is coming in LIKP table.Plz suggest me what may be the problem?

Regards.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

HI,

IF sy-subrc EQ 0.

SELECT SINGLE vbeln

lfdat

erdat

erzet

wadat_ist

spe_wauhr_ist

lifnr

inco1

anzpk

ablad

traty

btgew FROM likp

INTO wa_likp

WHERE vbeln = wa_lips-vbeln.

While selecting from likp by comparing vbeln you are using wa_lips-vbeln for comparision. But you are no where looping that internal table into work area as a result no data will be there for comparing vbeln while selecting. please check this might be the reason for not coming data into internal table.

while selecting from lips also you are using both for all entries as well as where condition that to in the where condition comparing vbeln with last record of internal table which was finally fetched because you are no where looped that itab into workarea. please check this also.

SELECT vgbel

vbeln

posnr FROM lips

INTO TABLE it_lips

FOR ALL ENTRIES IN it_vbrp

WHERE vbeln = it_vbrp-vgbel.

Hope this will give you some idea,

Regards,

Aswini.

Former Member
0 Kudos

HI

Thanks 4 ur reply.Even though i tried using For all entries data is not coming from likp table.Plz clarify it.

Regards.

former_member188005
Contributor
0 Kudos

Chitty,

For the select query LIKP you are comapring the VBELN of LIPS .

The missing thing FOR ALL ENTRIES IN LIPS for the select query for LIKP.

Regards..