Application Development 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 Statement Issue

Former Member
0 Kudos

HI,

I am facing problem with read statement, please find below my code and provide the solution.

My Internal Tables.

TYPES: BEGIN OF TYP_BSAK,

BUKRS TYPE BSAK-BUKRS,

LIFNR TYPE BSAK-LIFNR,

AUGDT TYPE BSAK-AUGDT,

GJAHR TYPE BSAK-GJAHR,

BELNR TYPE BSAK-BELNR,

BUZEI TYPE BSAK-BUZEI,

BUDAT TYPE BSAK-BUDAT,

BLART TYPE BSAK-BLART,

DMBTR TYPE BSAK-DMBTR,

SGTXT TYPE BSAK-SGTXT,

AUGBL TYPE BSAK-AUGBL,

HKONT TYPE BSAK-HKONT,

END OF TYP_BSAK.

DATA : IT_BSAK TYPE STANDARD TABLE OF TYP_BSAK WITH HEADER LINE,

WA_BSAK TYPE TYP_BSAK.

READ STATEMENT :

LOOP AT IT_BSIS INTO WA_BSIS. -> I am getting data in wa_BSIs

READ TABLE IT_BSAK INTO WA_BSAK -> I am Getting record in IT_BSAK bu the same is not populated in WA_BSAK

WITH KEY BUKRS = S_BUKRS.

IF SY-SUBRC = 0.

WA_OUTPUT-SAPSYS = 'PROBE'.

WA_OUTPUT-BUKRS = WA_BSAK-BUKRS.

WA_OUTPUT-BUKRS = WA_BSAK-BUKRS.

WA_OUTPUT-BELNR = WA_BSAK-BELNR.

WA_OUTPUT-SGTXT = WA_BSAK-SGTXT.

WA_OUTPUT-BUDAT = WA_BSAK-BUDAT.

WA_OUTPUT-AUGBL = WA_BSAK-AUGBL.

WA_OUTPUT-LIFNR = WA_LFA1-LIFNR.

WA_OUTPUT-NAME1 = WA_LFA1-NAME1.

WA_OUTPUT-STRAS = WA_LFA1-STRAS.

WA_OUTPUT-ORT01 = WA_LFA1-ORT01.

WA_OUTPUT-REGIO = WA_LFA1-REGIO.

WA_OUTPUT-PSTLZ = WA_LFA1-PSTLZ.

WA_OUTPUT-STCD2 = WA_LFA1-STCD2.

ENDIF.

APPEND WA_OUTPUT TO IT_OUTPUT.

ENDLOOP.

Thanks and Regards

VB

1 ACCEPTED SOLUTION

Former Member
0 Kudos

This is still a pretty basic question. Please press F1 on READ before posting here.

Rob

8 REPLIES 8

Former Member
0 Kudos

This is still a pretty basic question. Please press F1 on READ before posting here.

Rob

Former Member
0 Kudos

i hope that S_BUKRS is a select option.. which is of type SIGN|OPTION|LOW|HIGH..

so you statement

with key BUKRS = S_BUKRS is comparing like this '1000' = 'IEQ1000'. and these defnitely are not the same... right!!!

so what you need to do is pass a specfic BUKRS like S_BUKRS-LOW.

where BUKRS = S_BUKRS-LOW.

0 Kudos

READ TABLE IT_BSAK INTO WA_BSAK -> I am Getting record in IT_BSAK bu the same is not populated in WA_BSAK

WITH KEY BUKRS = S_BUKRS-low.

And please be sure whether you will have more values in select options.

Else you will need to pass s_bukrs-HIGH as well,

Please de bug and read the H1 help.

Thanks!

Former Member
0 Kudos

Hi,

I hope You have use below code solved your problem.

LOOP AT IT_BSIS INTO WA_BSIS

READ TABLE IT_BSAK INTO WA_BSAK

WITH KEY BUKRS = WA_BSIS-BUKRS.

IF SY-SUBRC = 0.

WA_OUTPUT-SAPSYS = 'PROBE'.

WA_OUTPUT-BUKRS = WA_BSAK-BUKRS.

WA_OUTPUT-BUKRS = WA_BSAK-BUKRS.

WA_OUTPUT-BELNR = WA_BSAK-BELNR.

WA_OUTPUT-SGTXT = WA_BSAK-SGTXT.

WA_OUTPUT-BUDAT = WA_BSAK-BUDAT.

WA_OUTPUT-AUGBL = WA_BSAK-AUGBL.

WA_OUTPUT-LIFNR = WA_LFA1-LIFNR.

WA_OUTPUT-NAME1 = WA_LFA1-NAME1.

WA_OUTPUT-STRAS = WA_LFA1-STRAS.

WA_OUTPUT-ORT01 = WA_LFA1-ORT01.

WA_OUTPUT-REGIO = WA_LFA1-REGIO.

WA_OUTPUT-PSTLZ = WA_LFA1-PSTLZ.

WA_OUTPUT-STCD2 = WA_LFA1-STCD2.

ENDIF.

APPEND WA_OUTPUT TO IT_OUTPUT.

ENDLOOP.

Thanks

Regards

I.Muthukumar.

Edited by: I.Muthukumar on Jun 25, 2010 12:43 PM

Former Member
0 Kudos

Hi,

I think you wanted to refer the bukrs value present in wa_bsis instead of s_bukrs, if it is the case refer the following logic.

LOOP AT IT_BSIS INTO WA_BSIS. -> I am getting data in wa_BSIs

READ TABLE IT_BSAK INTO WA_BSAK -> I am Getting record in IT_BSAK bu the same is not populated in WA_BSAK

WITH KEY BUKRS = wa_BSIs-bukrs.

IF SY-SUBRC = 0.

WA_OUTPUT-SAPSYS = 'PROBE'.

WA_OUTPUT-BUKRS = WA_BSAK-BUKRS.

WA_OUTPUT-BUKRS = WA_BSAK-BUKRS.

WA_OUTPUT-BELNR = WA_BSAK-BELNR.

WA_OUTPUT-SGTXT = WA_BSAK-SGTXT.

WA_OUTPUT-BUDAT = WA_BSAK-BUDAT.

WA_OUTPUT-AUGBL = WA_BSAK-AUGBL.

WA_OUTPUT-LIFNR = WA_LFA1-LIFNR.

WA_OUTPUT-NAME1 = WA_LFA1-NAME1.

WA_OUTPUT-STRAS = WA_LFA1-STRAS.

WA_OUTPUT-ORT01 = WA_LFA1-ORT01.

WA_OUTPUT-REGIO = WA_LFA1-REGIO.

WA_OUTPUT-PSTLZ = WA_LFA1-PSTLZ.

WA_OUTPUT-STCD2 = WA_LFA1-STCD2.

ENDIF.

APPEND WA_OUTPUT TO IT_OUTPUT.

ENDLOOP.

Regards,

Preetham

Former Member
0 Kudos

Hi,

You can follow the following steps always,

sort it_bsak. /* this should be on required fields to be easy for searching

loop at it_bsis into wa_bsis.

clear wa_bsak

read table it_bsak into wa_bsak with key bukrs = wa_bsis-bukrs binary search.

if sy-subrc eq 0.

/* write your append statements when seach is successful.

endif.

clear wa_bsis.

endloop.

I am not sure why are you using s_bukrs. If you clarify the requirement more, I will be able to guide you better.

Former Member
0 Kudos

I think it's about time everyone pressed F1 on READ.

Rob

0 Kudos

> read (v.) to translate written text into meaningful ideas within one's own mind. People usually read to gain knowledge or to awaken their imagination. Sadly, the act of reading seems to have been "bred out" of the human race. People these days would much rather desensetize themselves with stupid rap noise and violent, pornographic, and otherwise unintelligent forms of media. If you are an ABAP developer and find it hard to read, do yourself a favor and get help. No offense! Reading is a great and powerful thing, and only by fully taking advantage of it can one open his or her mind to the possibilities of his or her own future.

"urban dictionary" with one adjustment