cancel
Showing results for 
Search instead for 
Did you mean: 

Last PR no not displaying

Former Member
0 Kudos

hi ,

SELECT BANFN BADAT MATNR WERKS FROM EBAN INTO CORRESPONDING FIELDS OF TABLE gt_LASTPR

FOR ALL ENTRIES IN GT_EBAN " GT_EBAN is First Internal table.

WHERE BANFN LT GT_EBAN-BANFN

AND MATNR = GT_EBAN-MATNR

AND WERKS = GT_EBAN-WERKS.

READ TABLE GT_LASTPR INTO WA_LASTPR INDEX 1.

SORT GT_LASTPR BY matnr werks ASCENDING.

DELETE ADJACENT DUPLICATES FROM GT_LASTPR COMPARING matnr werks.

LOOP AT gt_LASTPR INTO WA_LASTPR.

ENDLOOP.

READ TABLE GT_LASTPR INTO WA_LASTPR INDEX 1.

see the above coding , I have different material and plant , against this material and plant combination i have different

last / Past

PR No , in my current PR I want to display last PR no. date against material and plant combination .

But here using this above coding same date is displaying for all against material and plant combination

how to display different last PR date in this form against material and plant combination ?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Ans rec...

Former Member
0 Kudos

Hi,

Check below logic

data : m_matnr type matnr,
           m_werks type werks_d,
           m_banfn type eban-banfn.

SELECT BANFN BADAT MATNR WERKS FROM EBAN INTO CORRESPONDING FIELDS OF TABLE gt_LASTPR
FOR ALL ENTRIES IN GT_EBAN " GT_EBAN is First Internal table.
WHERE BANFN LT GT_EBAN-BANFN
AND MATNR = GT_EBAN-MATNR
AND WERKS = GT_EBAN-WERKS.
SORT GT_LASTPR BY matnr werks badat ASCENDING.
clear : m_matnr, m_werks, m_banfn.
loop at gt_lastpr into wa_lastpr.
   if ( m_matnr ne wa_lastpr-matnr and 
         m_werks ne wa_lastpr-werks and
         m_matnr is not initial and
         m_werks is not initial ).
     write 😕 m_matnr, m_werks,'last pr no', m_banfn.
   endif.
   move wa_lastpr-matnr to m_matnr.
   move wa_lastpr-werks to m_werks.
   move wa_lastpr-banfn to m_banfn
endloop.
write 😕 m_matnr, m_werks,'last pr no', m_banfn.

Regards

Vinod

Former Member
0 Kudos

OK the data is displaying like

MATNR WERKS BANFN BADAT

1. 1946 1000 10014129 17.06.2010

2. 1938 1000 10014129 17.06.2010

3. 253-200 3000 10014129 17.06.2010

But i have three different material (MATNR) where only 1964 have last PR no like

MATNR WERKS BANFN BADAT

1. 1946 1000 10014129 17.06.2010

2. 1938 1000 - -

3 253-200 3000 - -

but in smartforms

I want in my smartfforms to display like

MATNR WERKS BANFN BADAT

1. 1946 1000 10014129 17.06.2010

2. 1938 1000 - -

3 253-200 3000 - -

If there are no PR no there should be blank.

Former Member
0 Kudos

Hi,

You are processing the LOOP based on the data from EBAN. Then how you will get the list of materials which do not have the last PR no attached to it ? The internal table will contain only the materials which will have records in EBAN.

Regards

Vinod

Former Member
0 Kudos

In selection screen I using current PR no 10014151 this created on date 18.08.2010, and the last PR no for

material 1964 is 10014129 date 17.06.2010,

But for 1938 or 253-200 Don't have any last PR like :-

MATNR WERKS BANFN BADAT

1946 1000 10014129 17.06.2010

1938 1000 - -

253-200 3000 - -

also for this

READ TABLE GT_LASTPO INTO WA_LASTPO INDEX 1.

is this is correct or not?