2009 Apr 27 8:43 AM
Hi
Below is my bseg table data. My requirement is if line item 1 of zuonr is space i want to get this value from line 2 of kunnr.
BUKRS BELNR GJAHR BUZEI ZUONR KUNNR
7063 0140951570 2009 001
7063 0140951570 2009 002 0000017017 0000055555my output will be
BUKRS BELNR GJAHR BUZEI ZUONR KUNNR
7063 0140951570 2009 001 0000055555
7063 0140951570 2009 002 0000017017 0000055555
Hi
Below is my bseg table data. My requirement is if line item 1 of zuonr is space i want to get this value from line 2 of kunnr.
BUKRS BELNR GJAHR BUZEI ZUONR KUNNR
7063 0140951570 2009 001
7063 0140951570 2009 002 0000017017 0000055555my output will be
BUKRS BELNR GJAHR BUZEI ZUONR KUNNR
7063 0140951570 2009 001 0000055555
7063 0140951570 2009 002 0000017017 0000055555
2009 Apr 27 8:49 AM
Hi Kumar,
Define one more table (itab2) of same structure.
Loop at 1st table.
Itab2-bukrs = itab1-bukrs.
Itab2-belnr = itab1-belnr.
Itab2-gjahr = itab1-gjahr.
Itab2-bezei = itab1-bezei.
If itab1-zuonr = space.
Itab2-zuonr = itab1-kunnr.
Else.
Itab2-zuonr = itab1-zuonr.
Endif.
Append itab2.
Endloop.
Hope this will help you.
Best Regards,
Deepa Kulkarni
2009 Apr 27 8:51 AM
Loop at itab.
read table itab into wa with key bukrs belnr gjahr Kunnr ne space.
if sy-subrc eq 0.
itab-zuonr = wa-kunnr.
modify itab .
endif.
endloop.
2009 Apr 27 8:51 AM
be clear if u hve only 2 entries of lineitems with same unique keys.
loop at ur internaltable. now if the zounr val is space then increment the sy-tabix value.
and read that particular line item and get the value of kunnr. Now assign this to the zounr in the loop.
2009 Apr 27 9:17 AM
hi
make two work area wa1 and wa2 like itab.
now use the following code
loop at itab into wa1.
if wa1-zuonr = space.
flage = 'X'.
elseif flage = 'X'.
data ind TYPE i.
ind = sy-tabix - 1.
read table itab into wa2 index ind.
wa2-zuonr = wa1-kunnr.
modify itab from wa2 index ind.
CLEAR wa2.
CLEAR flage.
endif.
ENDLOOP.
2009 Apr 27 9:23 AM
2009 Apr 27 9:26 AM
or you can use the following code
loop at itab into wa1.
if wa1-zuonr = space.
data ind type i.
ind = sy-tabix + 1.
read table itab into wa2 index ind.
wa1-zuonr = wa2-kunnr.
modify itab from wa1.
CLEAR wa2.
endif.
ENDLOOP.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |