2014 Dec 11 7:52 AM
Hi Expert..
I have problem to display the tax description as below
program code as below:
clear lt_t007s.
SELECT mwskz text1 kalsm
INTO TABLE lt_t007s
FROM t007s
FOR ALL ENTRIES IN lt_ekpo
WHERE mwskz = lt_ekpo-mwskz AND kalsm = 'TAXMY'.
IF sy-subrc EQ 0.
sort lt_t007s by mwskz.
ENDIF.
LOOP AT lt_t007s INTO lw_t007s.
READ TABLE lt_t007s INTO lw_t007s with key mwskz = lw_ekpo-mwskz Binary search.
IF sy-subrc eq 0.
it_output-t007s-text1 = lw_t007s-text1.
it_output-t007s-mwskz = lw_t007s-mwskz.
it_output-t007s-kalsm = lw_t007s-kalsm.
ENDIF.
ENDLOOP.
when i debug, the value are correctly filled as below:
Thus, what else i can do so that the output can be displayed.
please help and guide me.
ur kindness most appreciated
Thanks, regards.
liyana
2014 Dec 11 7:58 AM
hii liyana.
you are reading same table in loop and in condition you are comparing it with ekpo table.
please change your loop also add modify table statement in your logic.
Regards
Gaurav
Hi Expert..
I have problem to display the tax description as below
program code as below:
clear lt_t007s.
SELECT mwskz text1 kalsm
INTO TABLE lt_t007s
FROM t007s
FOR ALL ENTRIES IN lt_ekpo
WHERE mwskz = lt_ekpo-mwskz AND kalsm = 'TAXMY'.
IF sy-subrc EQ 0.
sort lt_t007s by mwskz.
ENDIF.
LOOP AT lt_t007s INTO lw_t007s.
READ TABLE lt_t007s INTO lw_t007s with key mwskz = lw_ekpo-mwskz Binary search.
IF sy-subrc eq 0.
it_output-t007s-text1 = lw_t007s-text1.
it_output-t007s-mwskz = lw_t007s-mwskz.
it_output-t007s-kalsm = lw_t007s-kalsm.
ENDIF.
ENDLOOP.
when i debug, the value are correctly filled as below:
Thus, what else i can do so that the output can be displayed.
please help and guide me.
ur kindness most appreciated
Thanks, regards.
liyana
2014 Dec 11 7:58 AM
hii liyana.
you are reading same table in loop and in condition you are comparing it with ekpo table.
please change your loop also add modify table statement in your logic.
Regards
Gaurav
2014 Dec 11 8:02 AM
Hi Liyana,
Cahnge your loop to below code. It will work.
LOOP AT lt_ekpo INTO lw_ekpo.
READ TABLE lt_t007s INTO lw_t007s with key mwskz = lw_ekpo-mwskz Binary search.
IF sy-subrc eq 0.
it_output-t007s-text1 = lw_t007s-text1.
it_output-t007s-mwskz = lw_t007s-mwskz.
it_output-t007s-kalsm = lw_t007s-kalsm.
ENDIF.
ENDLOOP.
2014 Dec 11 8:06 AM
You made a mistake in:
READ TABLE lt_t007s INTO lw_t007s with key mwskz = lw_ekpo-mwskz (this one is Always empty)
If you do this you need to loop at lt_ekpo into lw_ekpo, but you are looping around the table lt_t007s and then read the same table with a work area that will therefore always be empty.
Hence sy-subrc will Always be <> 0 and your output will not be filled.
It should be constructed somehow like:
1. Select all the entries from EKPO and place them in LT_EKPO
2. Select all entries from t007s (for all entries after checking lt_ekpo is not initial)and place them in table lt_t007s
3. Loop around LT_EKPO and READ LT_T007s
4. move the fields from LW_ekpo and LW_T007S to the respective output fields.
I also see in the screen shot that you created a deep structure as output. Not a good idea.
Why don't you define an output type that only holds the fields you ant to show w/o any deep structure e.g:
Types: Begin of type ty_output,
mwskz type mwskz,
kalsm type kalsm_d,
text1 type text1_007s
end of ty_output,
tt_output type standard table of ty_output.
Data: lt_output type tt_output,
lwa_output type ty_output.
Offcourse you need to add all fields to the output table that you want to show.
Next to that I would not use TAXMY hardcoded but also read this from the corresponding table ( I think it is the EKKO table)
2014 Dec 11 8:48 AM
after change the loop, it still cannot display the tax code.
regards,
liyana
2014 Dec 11 8:50 AM
Well then there must be another mistake in the code which we cannot see. Can you place the full code or attach it ?
2014 Dec 11 8:53 AM
Hi Liyana,
I am not sure how you have defined you it_output table. Declare a work area for that and append the work area to internal table it_output.
Types: Begin of type ty_output,
mwskz type mwskz,
kalsm type kalsm_d,
text1 type text1_007s
end of ty_output.
Data: lt_output type standard table of ty_output,
lwa_output type ty_output.
LOOP AT lt_ekpo INTO lw_ekpo.
READ TABLE lt_t007s INTO lw_t007s with key mwskz = lw_ekpo-mwskz Binary search.
IF sy-subrc eq 0.
lw_output-t007s-text1 = lw_t007s-text1.
lw_output-t007s-mwskz = lw_t007s-mwskz.
lw_output-t007s-kalsm = lw_t007s-kalsm.
append lw_output to it_output.
ENDIF.
ENDLOOP.
2014 Dec 11 9:10 AM
2014 Dec 11 9:22 AM
2014 Dec 12 5:21 AM
thanks everyone, the problem already solved. i put below select statement inside looping of lw_ekpo, then, append to it_output.
CLEAR lt_t007s.
SELECT mwskz text1 kalsm
INTO CORRESPONDING FIELDS OF TABLE lt_t007s
FROM t007s
WHERE mwskz = lw_ekpo-mwskz AND kalsm = 'TAXMY'.
IF sy-subrc EQ 0.
sort lt_t007s by mwskz.
ENDIF.
READ TABLE lt_t007s INTO lw_t007s with key mwskz = lw_ekpo-mwskz Binary search.
IF sy-subrc eq 0.
it_output-t007s-text1 = lw_t007s-text1.
it_output-t007s-mwskz = lw_t007s-mwskz.
it_output-t007s-kalsm = lw_t007s-kalsm.
ENDIF.
Thanks, regards
liyana
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |