Application Development and Automation 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: 
Read only

FM value passing

Former Member
0 Likes
1,318

Hi

I have to use following FM for taking the old rate in my form. So what value to pass in xcdshw?

Still i am using it but the old rate is not getting generated only new rate is genarated.

  Please tell if anyone knows about this issue.

CALL FUNCTION 'ME_READ_CHANGES_EINKBELEG'

     EXPORTING

*     ADDRESS_NUMBER        =

       document              = is_ekko

*     DATE_OF_CHANGE        =

*     TIME_OF_CHANGE        =

       print_operation       = '2'

     TABLES

*     XCDHDR                =

*     XCDSHW                =

       xekpo                 = IT_PEKPO

*     XAEND                 = it_XAEND

          .

10 REPLIES 10
Read only

Former Member
0 Likes
1,153

Hi,

Uncomment XCDHDR and XCDSHW in TABLES section.

Pass the document number to the FM and run it.

You will get the change documents in  XCDHDR (Header changes)  and XCDSHW (Item changes).

PS:

Also, close the previous thread.

Thanks,

Shambu

Read only

0 Likes
1,153

Hi shambu

    please tell wat exactly i have to pass in xcdhdr and xcdshw with sample an also where to pass document number exactly because already i have passed is_ekko there in document.

CALL FUNCTION 'ME_READ_CHANGES_EINKBELEG'

     EXPORTING

*     ADDRESS_NUMBER        =

       document              = is_ekko

*     DATE_OF_CHANGE        =

*     TIME_OF_CHANGE        =

       print_operation       = '2'

     TABLES

*     XCDHDR                =

*     XCDSHW                =

       xekpo                 = IT_PEKPO

*     XAEND                 = it_XAEND

          .

Read only

Former Member
0 Likes
1,153

Also select the data from ekko for is_ekko and from ekpo for it_pekpo before the FM call.

Read only

former_member212854
Participant
0 Likes
1,153

Hi Abhijeet,

You need to pass the date and time of the changed value inorder to get the old rate.

sample:

   SELECT datvr uhrvr INTO (*nast-datvr, *nast-uhrvr) FROM nast
             WHERE kappl EQ h_kappl
               AND kschl EQ object-kschl
               AND objky EQ h_ebeln
               AND vstat EQ '1'
       ORDER BY datvr DESCENDING uhrvr DESCENDING.
      EXIT.
    ENDSELECT.
  ENDIF.

*- read not yet processed header records of change documents
*--- check only change documents, which are created later
*--- than last processed NAST record
  objectid = ekko-ebeln.
  REFRESH: icdhdr, xaend, xaetx.
  REFRESH: edit.
  refresh: doc-xaend.                                    

* P.O. Items necessary for function module
  SELECT * FROM ekpo INTO TABLE doc_xekpo
           WHERE ebeln EQ ekko-ebeln.
  SORT doc_xekpo BY ebeln ebelp.

* select changes
  CALL FUNCTION 'ME_READ_CHANGES_EINKBELEG'
    EXPORTING
      document        = ekko
      date_of_change  = *nast-datvr
      time_of_change  = *nast-uhrvr
      print_operation = xdruvo
    TABLES
      xcdhdr          = icdhdr
      xaend           = doc-xaend                         

*      xcdshw          = edit
      xekpo           = doc_xekpo.

  IF NOT icdhdr[] IS INITIAL.
    sy-subrc = 0.
  ENDIF.

you get ouput in ICDHDR.

structure of table doc-xaend  

    TYPES:
     BEGIN OF doc_XAEND.
          include structure cdshw.
  types:   EBELP LIKE EKPO-EBELP,
           ZEKKN LIKE EKKN-ZEKKN,
           ETENR LIKE EKET-ETENR,
           CTXNR LIKE T166C-CTXNR,
           ROUNR LIKE T166C-ROUNR,
           INSERT,
           FLAG_ADRNR,
        END OF doc_XAEND.

  DATA: doc-xaend type doc_xaend occurs 0,
        wa_xaend type doc_xaend.

structure of table icdhdr

   DATA: BEGIN OF ICDHDR OCCURS 50.         

        INCLUDE STRUCTURE CDHDR.
DATA: END OF ICDHDR.  

structure of table doc_xekpo

    DATA: doc_xekpo LIKE ekpo OCCURS 0
        WITH HEADER LINE.

structure of parameter xdruvo

is type 'C'.

You could also refer to note no  814219 , 678128.

regards,

Ashwin

Read only

0 Likes
1,153

Hi Ashwin

  Thanks for the code .But while activating getting error regarding the syntax in below commmnd

SELECT datvr uhrvr INTO (*nast-datvr, *nast-uhrvr) FROM nast

Read only

0 Likes
1,153

Hi,


Did you declare variables for datvr and uhrvr ? or TABLES: *NAST. in the top ?

It doesnt have to be TABLES: *NAST you can delcare as TABLES: NAST also

and change the parameters in select as

SELECT datvr uhrvr INTO (nast-datvr, nast-uhrvr) FROM nast

or variables as

data: datvr type nast-datvr,

        uhrvr type nast-uhrvr.

and change the parameters in select as

SELECT datvr uhrvr INTO (datvr, uhrvr) FROM nast

regards,

Ashwin

Read only

0 Likes
1,153

Hi

  i have done as like below.when checking through debbuger no data found in select query.

types : begin of ty_nast,

        datvr type NA_datvr,

        uhrvr type NA_uhrvr,

        kappl type SNA_KAPPL,

        kschl type SNA_kschl,

        objky type NA_objkey,

        vstat type NA_vstat,

*       vstat like nast-vstat,

        end of ty_nast.

   data : it_nast type table of ty_nast,

          wa_nast type ty_nast.

        DATA: BEGIN OF ICDHDR OCCURS 50.

         INCLUDE STRUCTURE CDHDR.

       DATA: END OF ICDHDR.

*

     SELECT datvr uhrvr kappl kschl objky vstat from nast INTO TABLE  it_nast

*             WHERE KAPPL EQ

*               AND KSCHL EQ KSCHL

*               AND objky EQ O-EBELN

                where vstat EQ '1'

        ORDER BY datvr DESCENDING uhrvr DESCENDING.

*      EXIT.

*    ENDSELECT.

     select * from ekpo into table it_pekpo

        where ebeln EQ is_ekko-ebeln.

*  sort lt_xaend by ebeln ebelp.

   CALL FUNCTION 'ME_READ_CHANGES_EINKBELEG'

     EXPORTING

*     ADDRESS_NUMBER        =

       document              = is_ekko

      DATE_OF_CHANGE        = wa_nast-datvr

      TIME_OF_CHANGE        = wa_nast-uhrvr

       print_operation       = '2'

     TABLES

      XCDHDR                = icdhdr

*     XCDSHW                = IT_PEKPO

       xekpo                 = IT_PEKPO

      XAEND                 = lt_xaend

          .

     IF NOT icdhdr[] IS INITIAL.

     sy-subrc = 0.

   ENDIF.

Read only

0 Likes
1,153

Hi

  i have done as like below.when checking through debbuger no data found in select query.

types : begin of ty_nast,

        datvr type NA_datvr,

        uhrvr type NA_uhrvr,

        kappl type SNA_KAPPL,

        kschl type SNA_kschl,

        objky type NA_objkey,

        vstat type NA_vstat,

*       vstat like nast-vstat,

        end of ty_nast.

   data : it_nast type table of ty_nast,

          wa_nast type ty_nast.

        DATA: BEGIN OF ICDHDR OCCURS 50.

         INCLUDE STRUCTURE CDHDR.

       DATA: END OF ICDHDR.

*

     SELECT datvr uhrvr kappl kschl objky vstat from nast INTO TABLE  it_nast

*             WHERE KAPPL EQ

*               AND KSCHL EQ KSCHL

*               AND objky EQ O-EBELN

                where vstat EQ '1'

        ORDER BY datvr DESCENDING uhrvr DESCENDING.

*      EXIT.

*    ENDSELECT.

     select * from ekpo into table it_pekpo

        where ebeln EQ is_ekko-ebeln.

*  sort lt_xaend by ebeln ebelp.

   CALL FUNCTION 'ME_READ_CHANGES_EINKBELEG'

     EXPORTING

*     ADDRESS_NUMBER        =

       document              = is_ekko

      DATE_OF_CHANGE        = wa_nast-datvr

      TIME_OF_CHANGE        = wa_nast-uhrvr

       print_operation       = '2'

     TABLES

      XCDHDR                = icdhdr

*     XCDSHW                = IT_PEKPO

       xekpo                 = IT_PEKPO

      XAEND                 = lt_xaend

          .

     IF NOT icdhdr[] IS INITIAL.

     sy-subrc = 0.

   ENDIF.

Read only

0 Likes
1,153

Hi Ashvin

  The old date is still not getting displayed in my smart form when i call it.

Thanks

Regards

Abhijeet

Read only

Former Member
0 Likes
1,153

Hi

I have use below code in my smartform for getting the old rate instead of new rate.But

while debugging in function module it reads correct below items..

ADDRESS_NUMBER        = wa_header-exnum

       document              = l_ekko

But after document i wont fetch the time and date from nast table.

TYPES: BEGIN OF ty_chg_texts,

ebeln TYPE ekpo-ebeln,        "Purchase Order number

ebelp TYPE ekpo-ebelp,        "Line item number

ctxnr TYPE t166t-ctxnr,       "Text number for change text

chtxt TYPE t166t-chtxt,       "Description of Changed Field in Printout

f_old TYPE cdshw-f_old,       "Old value

f_new TYPE cdshw-f_new,       "New/changed value

END OF ty_chg_texts.

TYPES: BEGIN OF ty_meein_xaend.

         INCLUDE STRUCTURE cdshw.

TYPES:

ebelp LIKE ekpo-ebelp,        "PO number

zekkn LIKE ekkn-zekkn,        "Sequential Number of Account Assignment

etenr LIKE eket-etenr,        "Delivery Schedule Line Counter

ctxnr LIKE t166c-ctxnr,       "Text number for change text

rounr LIKE t166c-rounr,       "Routing number

insert,

flag_adrnr,

END OF ty_meein_xaend.

TYPES: ty_meein_xaend_tab TYPE STANDARD TABLE OF ty_meein_xaend.

DATA: IT_PEKPO TYPE STANDARD TABLE OF EKPO.

DATA:  l_ekko TYPE EKKO,

       GT_CHG_TEXTS type standard table of TY_CHG_TEXTS.

DATA: lT_XAEND TYPE STANDARD TABLE OF ty_meein_xaend,

       ls_xaend TYPE ty_meein_xaend,

       ls_chg_texts TYPE TY_CHG_TEXTS.

types : begin of ty_nast,

        datvr type NA_datvr,

        uhrvr type NA_uhrvr,

*       kappl type S

*  NA_KAPPL,

*       kschl type SNA_kschl,

*       objky type NA_objkey,

        vstat type NA_vstat,

*       vstat like nast-vstat,

        end of ty_nast.

   data : it_nast type table of ty_nast,

          wa_nast type ty_nast.

        DATA: BEGIN OF ICDHDR OCCURS 50.

         INCLUDE STRUCTURE CDHDR.

       DATA: END OF ICDHDR.

*

     SELECT datvr uhrvr  vstat from nast INTO TABLE  it_nast

*             WHERE KAPPL EQ

*               AND KSCHL EQ KSCHL

*               AND objky EQ O-EBELN

                where vstat EQ '1'"wa_nast-vstat

        ORDER BY datvr DESCENDING uhrvr DESCENDING.

*      EXIT.

*    ENDSELECT.

*    select * from ekpo into table it_pekpo

*       where ebeln EQ l_ekko-ebeln.

*  sort lt_xaend by ebeln ebelp.

   break-point.

   CALL FUNCTION 'ME_READ_CHANGES_EINKBELEG'

     EXPORTING

      ADDRESS_NUMBER        = wa_header-exnum

       document              = l_ekko

*     DATE_OF_CHANGE        = wa_nast-datvr

*     TIME_OF_CHANGE        = wa_nast-uhrvr

       print_operation       = '2'

     TABLES

      XCDHDR                = icdhdr

       XAEND                 = lt_xaend

*     XCDSHW                = IT_PEKPO

       xekpo                 = IT_PEKPO

          .