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: 

Ship to Party and Bill to Party with salesitem is not displaying in ALV report when fetched from VBPA

Former Member
0 Kudos
362

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.

12 REPLIES 12

Former Member
0 Kudos
270

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

Former Member
0 Kudos
270

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.

0 Kudos
270

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.

0 Kudos
270


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.

0 Kudos
270

Hi gaurav,

After passing 'SH' , no values are displaying in the report.

Best rgds/thnks,

Srikanth.

0 Kudos
270


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.

former_member223213
Participant
0 Kudos
270

hi srikanth,

Did you sort the internal table GT_VBPA with vbeln posnr parvw. ??

Thanks & Regards,

Manoj.

0 Kudos
270

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.

0 Kudos
270

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.

0 Kudos
270

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.

0 Kudos
270

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.

0 Kudos
270

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