2014 May 13 11:09 AM
Hi experts
could anybody please let me know how to use offset for select-option parameter. i can able to use offset for table fields, variabiles and all , but don't know how to use for parameters.
following is my code
SELECT-OPTIONS: s_prctr FOR vbsegs-prctr OBLIGATORY.
here "prctr" length is 10.
i'm using two tables 1. vbsegd-bupla
2. vbsegs-prctr
here prctr+6(4) = bupla.
"Bupla" length is 4
SELECT belnr gjahr bukrs bupla sgtxt buzei FROM vbsegd INTO CORRESPONDING FIELDS OF TABLE it_vbsegd FOR ALL ENTRIES IN it_vbkpf
WHERE belnr = it_vbkpf-belnr
AND gjahr = it_vbkpf-gjahr
AND bukrs = it_vbkpf-bukrs
AND bupla IN s_prctr.
the above statement is not working as prctr and bupla lenths are different. here i want to use offset.
SELECT belnr gjahr bukrs prctr sgtxt buzei FROM vbsegs INTO CORRESPONDING FIELDS OF TABLE it_vbsegs FOR ALL ENTRIES IN it_vbkpf
WHERE belnr = it_vbkpf-belnr
AND gjahr = it_vbkpf-gjahr
AND bukrs = it_vbkpf-bukrs
AND prctr IN s_prctr.
this is working as prctr and s_prctr lengths are equal.
could anybody please help me out in this.
Thanks in advance.
regards
satish
2014 May 13 11:24 AM
Hi Satish,
You can write following logic:
1. Define new range table r_itab of BUPLA type.
2. If S_PRCTR-high is initial then go to step-3 else go to step-4
3. Loop on S_PRCTR and then offset the PRCTR value, further append it to range table r_itab(fiel-Low)
4. Append S_PRCTR-low, S_PRCTR-high value into range table-low,high value after offsetting the value
3. Further use the range table r_itab in Select query.
Regards,
Sudeesh Soni
Hi Satish,
You can write following logic:
1. Define new range table r_itab of BUPLA type.
2. If S_PRCTR-high is initial then go to step-3 else go to step-4
3. Loop on S_PRCTR and then offset the PRCTR value, further append it to range table r_itab(fiel-Low)
4. Append S_PRCTR-low, S_PRCTR-high value into range table-low,high value after offsetting the value
3. Further use the range table r_itab in Select query.
Regards,
Sudeesh Soni
2014 May 13 11:24 AM
Hi Satish,
You can write following logic:
1. Define new range table r_itab of BUPLA type.
2. If S_PRCTR-high is initial then go to step-3 else go to step-4
3. Loop on S_PRCTR and then offset the PRCTR value, further append it to range table r_itab(fiel-Low)
4. Append S_PRCTR-low, S_PRCTR-high value into range table-low,high value after offsetting the value
3. Further use the range table r_itab in Select query.
Regards,
Sudeesh Soni
2014 May 13 12:23 PM
Hi sudeesh,
Thanks for your kt. your post was helped me to resolve my issue.
Thanks for the prompt reply.
Regards
satish
2014 May 13 11:27 AM
Below code will work for you.
SELECT-OPTIONS: s_prctr FOR vbsegs-prctr OBLIGATORY.
RANGES: s_bupla FOR vbsegd-bupla.
s_bupla[] = s_prctr[].
DELETE ADJACENT DUPLICATES FROM s_bupla.
SELECT belnr gjahr bukrs bupla sgtxt buzei FROM vbsegd INTO CORRESPONDING FIELDS OF TABLE it_vbsegd FOR ALL ENTRIES IN it_vbkpf
WHERE belnr = it_vbkpf-belnr
AND gjahr = it_vbkpf-gjahr
AND bukrs = it_vbkpf-bukrs
AND bupla IN s_bupla.
2014 May 13 11:44 AM
Hi Digesh,
Thank you for your valuable time . my issue has been resolved with your helpful reply.
Thanks a lot again.
regards
satish
2014 May 13 12:33 PM
Instead of s_bupla[] = s_prctr[].
Use below logic.
LOOP AT s_prctr.
s_bupla-sign = s_prctr-sign.
s_bupla-option = s_prctr-option.
s_bupla-low = s_prctr-low+6(4).
s_bupla-high = s_prctr-high+6(4).
APPEND s_bupla.
ENDLOOP.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |