2015 May 21 12:01 PM
Dear Experts,
My requirement is to display ship to party and bill to party with reference to the sales order through ALV report. When i was trying to fetch the data from VBPA table looping from VBAP , the ship to party & bill to party is not displaying in the ALV report.
Coding is as below.
LOOP AT GT_VBAP INTO GS_VBAP.
GS_FINAL-VBELN = GS_VBAP-VBELN.
GS_FINAL-POSNR = GS_VBAP-POSNR.
GS_FINAL-MATNR = GS_VBAP-MATNR.
GS_FINAL-WERKS = GS_VBAP-WERKS.
GS_FINAL-WAERK = GS_VBAP-WAERK.
READ TABLE GT_VBAK INTO GS_VBAK WITH KEY VBELN = GS_VBAP-VBELN.
GS_FINAL-AUART = GS_VBAK-AUART.
READ TABLE GT_VBPA INTO GS_VBPA WITH KEY VBELN = GS_VBAP-VBELN
POSNR = GS_VBAP-POSNR
PARVW = 'WE' BINARY SEARCH.
GS_FINAL-SHIP_NO = GS_VBPA-KUNNR.
READ TABLE GT_VBPA INTO GS_VBPA WITH KEY VBELN = GS_VBAP-VBELN
POSNR = GS_VBAP-POSNR
PARVW = 'RE' BINARY SEARCH.
IF SY-SUBRC = 0.
GS_FINAL-BILL_NO = GS_VBPA-KUNNR.
ELSE.
CLEAR : GS_VBPA.
READ TABLE GT_VBPA INTO GS_VBPA WITH KEY VBELN = GS_VBAP-VBELN
PARVW = 'RE' BINARY SEARCH.
IF SY-SUBRC = 0.
GS_FINAL-BILL_NO = GS_VBPA-KUNNR.
ENDIF.
ENDIF.
READ TABLE GT_VBKD INTO GS_VBKD WITH KEY VBELN = GS_VBAP-VBELN
POSNR = GS_VBAP-POSNR.
GS_FINAL-BSTKD = GS_VBKD-BSTKD.
GS_FINAL-BSTDK = GS_VBKD-BSTDK.
APPEND GS_FINAL TO GT_FINAL.
ENDLOOP.
Best rgds/thnks,
Srikanth.
2015 May 21 12:06 PM
hi Srikanth ,
Read table with binary clause should be sorted table with key use in binary clause.
Please check if the table is sorted with key.
regards.
Nilesh
2015 May 21 12:12 PM
Also if the table is sorted check if the partner function has conversion exit applied in the debuuger.
if yes try SH instead of WE and BP for RE.
Hope this helps.
2015 May 21 12:32 PM
Hi gaurav,
After doing , the if the POSNR field has value in VBPA the result is generated, if there is no value the value is not generated. Pls find the below screenshot for the better understanding.
VBPA having sales item ( POSNR )
VBPA not having line item will not display ship to party / bill to party.
2015 May 21 1:39 PM
Those without the POSNR are for header partner functions, and with POSNR are for Line items partner functions.
Did you get the values after passing the SH in parvw.
2015 May 21 2:00 PM
Hi gaurav,
After passing 'SH' , no values are displaying in the report.
Best rgds/thnks,
Srikanth.
2015 May 22 5:33 AM
In that case your code seem right, can you debug your code where you are passing the partner ship to party or bill to party and paste the screen shot.
Check also if it getting cleared at some other point in your code.
Hope this helps.
2015 May 21 12:19 PM
hi srikanth,
Did you sort the internal table GT_VBPA with vbeln posnr parvw. ??
Thanks & Regards,
Manoj.
2015 May 21 12:37 PM
Dear Manoj,
Yes i've sorted the internal table GT_VBPA. But in the scenario having line item not displayed in VBPA , the output is not displayed. As explained the same with screen shot to Mr.gaurav.
Best rgds/thnks,
Srikanth.
2015 May 21 1:26 PM
Hi srikanth,
Bold is added code to your code ,
try this , i may be use full to you
Read gt_vbpa with key condition vbeln
posnr
parvw.
if sy-subrc eq 0.
move customer name.
else.
read gt_vbpa with key condition vbeln
posnr = ' '
parvw. (no duplicate records, y means primary key)
if sy-subrc eq 0
gs_final-bill no = gs_vbpa-kunnr.
endif.
endif.
Thanks & Regards,
Manoj.
2015 May 21 1:46 PM
Dear Manoj,
Thanks for your time. The result is the same . No output is displayed when in VBPA there is no sales item ( POSNR )
Best rgds/thnks,
Srikanth.
2015 May 21 1:58 PM
hi Srikanth,
it has to get the customer if it do not get issue may be with parvw.
check partner given at parvw.
use fm: SD_PARTNER_DETERMINATION
Thanks & Regards,
Manoj.
2015 May 22 11:04 AM
Dear all,
Thanks for all for spending your time on the Query. It was the problem with IF and ENDIF as i was passing the ENDIF after reading all the other tables before appending. I got the solution . Thanks again.
Best rgds/thnks,
Srikanth