Skip to Content
0
Former Member
May 21, 2015 at 11:01 AM

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

69 Views

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.