Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

F4 Help for PO & PO ITEM

Dear Experts,

I had developed one module pool screen. my key fields in it are PO & PO ITEM.


Now I had create F4 help for PO which returns PO number only.


I want to return PO and PO item at time.


I had read many post and try but not satisfied.


Please check following code.


DATA: BEGIN OF IT_PO OCCURS 0,
          EBELN TYPE EKKO-EBELN,
          EBELP TYPE EKPO-EBELP,
          MATNR TYPE EKPO-MATNR,
          MAKTX TYPE MAKT-MAKTX,
         END OF IT_PO.

   REFRESH : IT_PO,I_RETURN_TAB.
   CLEAR :   W_RETURN_TAB.


   SELECT DISTINCT A~EBELN B~EBELP B~MATNR C~MAKTX
     INTO TABLE IT_PO
     FROM EKKO AS A
     INNER JOIN EKPO AS B
     ON A~EBELN = B~EBELN
     INNER JOIN MAKT AS C
     ON B~MATNR = C~MATNR
     WHERE A~BSART EQ 'NB'
       AND A~EKGRP IN ('P03','P12')
       AND  A~LIFNR EQ V_LIFNR
       AND ( ( A~FRGGR = '' AND A~FRGSX = '' AND A~FRGKE = '' ) OR
             ( A~FRGKE EQ 'R' ) )
       AND B~LOEKZ EQ ''
       AND B~ELIKZ EQ ''.


   CALL FUNCTION 'DYNP_GET_STEPL'
     IMPORTING
       POVSTEPL = V_DYNINDEX.

*  I_FIELD-FLDNAME    = 'EBELN'.
*  I_FIELD-DYFLDNAME  = 'WA_SCHEDULE-EBELN'.
*  APPEND I_FIELD.
*  CLEAR I_FIELD.
*  I_FIELD-FLDNAME    = 'EBELP'.
*  I_FIELD-DYFLDNAME  = 'WA_SCHEDULE-EBELP'.
*  APPEND I_FIELD.
*  CLEAR I_FIELD.

   IF IT_PO[] IS NOT INITIAL.
     SORT IT_PO BY EBELN DESCENDING EBELP ASCENDING.


     CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
         RETFIELD            = 'EBELN'
         DYNPPROG            = SY-REPID
         DYNPNR              = SY-DYNNR
         DYNPROFIELD         = 'WA_SCHEDULE-EBELN'
         VALUE_ORG           = 'S'
         STEPL               = V_DYNINDEX
         MULTIPLE_CHOICE     = 'X'
       TABLES
         VALUE_TAB           = IT_PO[]
         RETURN_TAB          = I_RETURN_TAB
*       FIELD_TAB              =
         DYNPFLD_MAPPING     = I_FIELD[].


*    BREAK-POINT.
*    READ TABLE I_RETURN_TAB INTO W_RETURN_TAB INDEX 1.
*    IT_PO-EBELN = W_RETURN_TAB-FIELDVAL.
*
*    IF SY-SUBRC = 0.
*      W_DYNPFIELDS-FIELDNAME    = 'WA_SCHEDULE-EBELN'.
*      W_DYNPFIELDS-FIELDVALUE   = IT_PO-EBELN.
*      W_DYNPFIELDS-STEPL        = V_DYNINDEX.
*      APPEND W_DYNPFIELDS TO I_DYNPFIELDS.
*      CLEAR W_DYNPFIELDS.
*      W_DYNPFIELDS-FIELDNAME    = 'WA_SCHEDULE-EBELP'.
*      W_DYNPFIELDS-FIELDVALUE   = IT_PO-EBELP.
*      W_DYNPFIELDS-STEPL        = V_DYNINDEX.
*      APPEND W_DYNPFIELDS TO I_DYNPFIELDS.
*      CLEAR W_DYNPFIELDS.
*      W_DYNPFIELDS-FIELDNAME    = 'WA_SCHEDULE-MATNR'.
*      W_DYNPFIELDS-FIELDVALUE   = IT_PO-MATNR.
*      W_DYNPFIELDS-STEPL        = V_DYNINDEX.
*      APPEND W_DYNPFIELDS TO I_DYNPFIELDS.
*      CLEAR W_DYNPFIELDS.
*      W_DYNPFIELDS-FIELDNAME    = 'WA_SCHEDULE-MAKTX'.
*      W_DYNPFIELDS-FIELDVALUE   = IT_PO-MAKTX.
*      W_DYNPFIELDS-STEPL        = V_DYNINDEX.
*      APPEND W_DYNPFIELDS TO I_DYNPFIELDS.
*      CLEAR W_DYNPFIELDS.
*      CALL FUNCTION 'DYNP_VALUES_UPDATE'
*        EXPORTING
*          DYNAME     = SY-REPID
*          DYNUMB     = SY-DYNNR
*        TABLES
*          DYNPFIELDS = I_DYNPFIELDS.
*    ENDIF.
   ELSE.
     MESSAGE 'No Purchase Orders found.' TYPE 'S'.
   ENDIF.

Regards,


Nayan Lad

Former Member
Not what you were looking for? View more on this topic or Ask a question