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: 

Release status of Purchase Requisition

Former Member
0 Kudos

Hi All,

Can anyone tell me about the database table where Release status of Purchase Requisition is getting stored?

Its little urgent to know......

Kindly help me.....

Regards

Pavan

1 ACCEPTED SOLUTION

former_member156446
Active Contributor
0 Kudos

&----


*& Form fr_get_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fr_get_data.

*Get SO

SELECT avbeln aposnr apstyv amatnr

FROM vbap AS a

JOIN vbak AS b

ON avbeln = bvbeln

JOIN vbpa AS c

ON bvbeln = cvbeln

INTO TABLE gt_data

WHERE b~vbeln IN so_so

AND b~auart EQ c_zor "Only Sales Orders

AND c~kunnr IN ra_kunnr. "from selection screen

DELETE ADJACENT DUPLICATES FROM gt_data COMPARING vbeln posnr.

*get data of the production order

IF NOT gt_data[] IS INITIAL.

SELECT aaufnr aposnr akdauf akdpos awepos aelikz

b~objnr

FROM afpo AS a

JOIN aufk AS b

ON aaufnr = baufnr

INTO TABLE gt_prd

FOR ALL ENTRIES IN gt_data

WHERE a~kdauf EQ gt_data-vbeln

AND a~kdpos EQ gt_data-posnr.

ENDIF.

*Get partner data

IF NOT gt_data[] IS INITIAL.

SELECT vbeln posnr parvw kunnr

FROM vbpa

INTO TABLE gt_partner

FOR ALL ENTRIES IN gt_data

WHERE vbeln EQ gt_data-vbeln.

ENDIF.

*Get Purchase Order

IF NOT gt_data[] IS INITIAL.

SELECT ebeln ebelp vbeln vbelp

FROM ekkn

INTO TABLE gt_po

FOR ALL ENTRIES IN gt_data

WHERE vbeln EQ gt_data-vbeln

AND vbelp EQ gt_data-posnr.

SELECT vbeln posnr banfn

FROM vbep

INTO TABLE gt_preq

FOR ALL ENTRIES IN gt_data

WHERE vbeln EQ gt_data-vbeln

AND posnr EQ gt_data-posnr.

ENDIF.

IF NOT gt_po[] IS INITIAL.

SELECT aebeln aprocstat a~lifnr

FROM ekko AS a

JOIN ekpo AS b

ON aebeln = bebeln

INTO TABLE gt_po_stat

FOR ALL ENTRIES IN gt_po

WHERE b~ebeln EQ gt_po-ebeln

AND b~ebelp EQ gt_po-ebelp.

ENDIF.

*Move data to output table

LOOP AT gt_data INTO wa_data.

wa_output-vbeln = wa_data-vbeln.

wa_output-posnr = wa_data-posnr.

wa_output-pstyv = wa_data-pstyv.

wa_output-matnr = wa_data-matnr.

READ TABLE gt_po INTO wa_po WITH KEY vbeln = wa_data-vbeln

vbelp = wa_data-posnr.

IF sy-subrc EQ 0.

wa_output-bstnk = wa_po-ebeln.

READ TABLE gt_po_stat INTO wa_po_stat WITH KEY ebeln = wa_po-ebeln.

IF sy-subrc EQ 0.

wa_output-lifnr = wa_po_stat-lifnr.

CASE wa_po_stat-procstat.

WHEN '01'.

wa_output-po_st = 'Version in process'.

WHEN '02'.

wa_output-po_st = 'Active'.

WHEN '03'.

wa_output-po_st = 'In release'.

WHEN '04'.

wa_output-po_st = 'Partially released'.

WHEN '05'.

wa_output-po_st = 'Released Completely'.

WHEN '08'.

wa_output-po_st = 'Rejected'.

ENDCASE.

ENDIF. "inner read subrc

ENDIF. "outer read subrc

READ TABLE gt_preq INTO wa_preq WITH KEY vbeln = wa_data-vbeln

posnr = wa_data-posnr.

IF sy-subrc EQ 0.

wa_output-banfn = wa_preq-banfn.

ENDIF.

READ TABLE gt_prd INTO wa_prd WITH KEY kdauf = wa_data-vbeln

kdpos = wa_data-posnr.

IF sy-subrc EQ 0.

wa_output-aufnr = wa_prd-aufnr.

*get the purchase requisition for production order as well

SELECT SINGLE banfn

FROM ebkn

INTO wa_output-banfn

WHERE aufnr EQ wa_prd-aufnr.

*Get the status of the production order

PERFORM fr_get_prd_stat USING wa_prd-objnr

CHANGING wa_output-prd_stat.

ENDIF. " sy-subrc

READ TABLE gt_partner INTO wa_partner WITH KEY vbeln = wa_data-vbeln

parvw = c_we.

IF sy-subrc EQ 0.

wa_output-sh = wa_partner-kunnr.

ENDIF.

READ TABLE gt_partner INTO wa_partner WITH KEY vbeln = wa_data-vbeln

parvw = c_ag.

IF sy-subrc EQ 0.

wa_output-sp = wa_partner-kunnr.

ENDIF.

APPEND wa_output TO gt_output.

CLEAR: wa_data, wa_prd,wa_partner,wa_output.

ENDLOOP.

ENDFORM. " fr_get_data

4 REPLIES 4

Former Member
0 Kudos

Hi,

Check the field FRGZU in EBAN table

i048168
Advisor
Advisor
0 Kudos

Hi,

Check the field FRGZU in EBAN table.

Regards

Vadi

arpit_shah
Contributor
0 Kudos

hi..

check the field FRGZU in EBAN.

Regards / Arpit

former_member156446
Active Contributor
0 Kudos

&----


*& Form fr_get_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM fr_get_data.

*Get SO

SELECT avbeln aposnr apstyv amatnr

FROM vbap AS a

JOIN vbak AS b

ON avbeln = bvbeln

JOIN vbpa AS c

ON bvbeln = cvbeln

INTO TABLE gt_data

WHERE b~vbeln IN so_so

AND b~auart EQ c_zor "Only Sales Orders

AND c~kunnr IN ra_kunnr. "from selection screen

DELETE ADJACENT DUPLICATES FROM gt_data COMPARING vbeln posnr.

*get data of the production order

IF NOT gt_data[] IS INITIAL.

SELECT aaufnr aposnr akdauf akdpos awepos aelikz

b~objnr

FROM afpo AS a

JOIN aufk AS b

ON aaufnr = baufnr

INTO TABLE gt_prd

FOR ALL ENTRIES IN gt_data

WHERE a~kdauf EQ gt_data-vbeln

AND a~kdpos EQ gt_data-posnr.

ENDIF.

*Get partner data

IF NOT gt_data[] IS INITIAL.

SELECT vbeln posnr parvw kunnr

FROM vbpa

INTO TABLE gt_partner

FOR ALL ENTRIES IN gt_data

WHERE vbeln EQ gt_data-vbeln.

ENDIF.

*Get Purchase Order

IF NOT gt_data[] IS INITIAL.

SELECT ebeln ebelp vbeln vbelp

FROM ekkn

INTO TABLE gt_po

FOR ALL ENTRIES IN gt_data

WHERE vbeln EQ gt_data-vbeln

AND vbelp EQ gt_data-posnr.

SELECT vbeln posnr banfn

FROM vbep

INTO TABLE gt_preq

FOR ALL ENTRIES IN gt_data

WHERE vbeln EQ gt_data-vbeln

AND posnr EQ gt_data-posnr.

ENDIF.

IF NOT gt_po[] IS INITIAL.

SELECT aebeln aprocstat a~lifnr

FROM ekko AS a

JOIN ekpo AS b

ON aebeln = bebeln

INTO TABLE gt_po_stat

FOR ALL ENTRIES IN gt_po

WHERE b~ebeln EQ gt_po-ebeln

AND b~ebelp EQ gt_po-ebelp.

ENDIF.

*Move data to output table

LOOP AT gt_data INTO wa_data.

wa_output-vbeln = wa_data-vbeln.

wa_output-posnr = wa_data-posnr.

wa_output-pstyv = wa_data-pstyv.

wa_output-matnr = wa_data-matnr.

READ TABLE gt_po INTO wa_po WITH KEY vbeln = wa_data-vbeln

vbelp = wa_data-posnr.

IF sy-subrc EQ 0.

wa_output-bstnk = wa_po-ebeln.

READ TABLE gt_po_stat INTO wa_po_stat WITH KEY ebeln = wa_po-ebeln.

IF sy-subrc EQ 0.

wa_output-lifnr = wa_po_stat-lifnr.

CASE wa_po_stat-procstat.

WHEN '01'.

wa_output-po_st = 'Version in process'.

WHEN '02'.

wa_output-po_st = 'Active'.

WHEN '03'.

wa_output-po_st = 'In release'.

WHEN '04'.

wa_output-po_st = 'Partially released'.

WHEN '05'.

wa_output-po_st = 'Released Completely'.

WHEN '08'.

wa_output-po_st = 'Rejected'.

ENDCASE.

ENDIF. "inner read subrc

ENDIF. "outer read subrc

READ TABLE gt_preq INTO wa_preq WITH KEY vbeln = wa_data-vbeln

posnr = wa_data-posnr.

IF sy-subrc EQ 0.

wa_output-banfn = wa_preq-banfn.

ENDIF.

READ TABLE gt_prd INTO wa_prd WITH KEY kdauf = wa_data-vbeln

kdpos = wa_data-posnr.

IF sy-subrc EQ 0.

wa_output-aufnr = wa_prd-aufnr.

*get the purchase requisition for production order as well

SELECT SINGLE banfn

FROM ebkn

INTO wa_output-banfn

WHERE aufnr EQ wa_prd-aufnr.

*Get the status of the production order

PERFORM fr_get_prd_stat USING wa_prd-objnr

CHANGING wa_output-prd_stat.

ENDIF. " sy-subrc

READ TABLE gt_partner INTO wa_partner WITH KEY vbeln = wa_data-vbeln

parvw = c_we.

IF sy-subrc EQ 0.

wa_output-sh = wa_partner-kunnr.

ENDIF.

READ TABLE gt_partner INTO wa_partner WITH KEY vbeln = wa_data-vbeln

parvw = c_ag.

IF sy-subrc EQ 0.

wa_output-sp = wa_partner-kunnr.

ENDIF.

APPEND wa_output TO gt_output.

CLEAR: wa_data, wa_prd,wa_partner,wa_output.

ENDLOOP.

ENDFORM. " fr_get_data