Skip to Content
author's profile photo Former Member
Former Member

RE: abapers problem in migo

hi gurus

/h

this is my code, and in migo if i click on check it is checking for all lineitems, it should check for only one line item and display log message should be displayed for one lineitem.

if sy-tcode = 'MIGO' OR sy-tcode = 'MIGO_GR'.

Data : BUKRS LIKE BKPF-BUKRS,

DATE LIKE SY-DATUM,

CURRY LIKE BKPF-GJAHR.

Data : Begin of it_mseg occurs 0,

mblnr like mseg-mblnr,

* bwart like mseg-bwart,

* gjahr like mseg-gjahr,

* lifnr like mseg-lifnr,

END OF it_mseg.

Data : Begin of it_mkpf occurs 0 ,

mblnr like mkpf-mblnr,

xblnr like mkpf-xblnr,

* frbnr like mkpf-frbnr,

* bwart like mseg-bwart,

* gjahr like mseg-gjahr,

* lifnr like mseg-lifnr,

END OF it_mkpf.

Data : Begin of it_mkpf2 occurs 0 ,

mblnr like mkpf-mblnr,

frbnr like mkpf-frbnr,

END OF it_mkpf2.

Data : Begin of it_mkpf3 occurs 0 ,

mblnr like mkpf-mblnr,

frbnr like mkpf-frbnr,

END OF it_mkpf3.

Data : ref type mkpf-xblnr,

bol type mkpf-frbnr.

Data : doc_no type mkpf-mblnr,

inv_no type mkpf-xblnr,

output type string.

read TABLE mkpf.

Bukrs = '8888'.

DATE = mkpf-budat.

CALL FUNCTION 'GET_CURRENT_YEAR'

EXPORTING

BUKRS = Bukrs

DATE = DATE

IMPORTING

* CURRM =

CURRY = CURRY

* PREVM =

* PREVY =

.

if mseg is not INITIAL.

read TABLE mseg .

if mseg-bwart = '101'.

select mblnr from mseg

into table it_mseg

where bwart = mseg-bwart

and lifnr = mseg-lifnr

and gjahr = curry.

if it_mseg[] is not INITIAL.

delete ADJACENT DUPLICATES FROM it_mseg COMPARING mblnr.

select mblnr xblnr from mkpf

into table it_mkpf

FOR ALL ENTRIES IN it_mseg

where mblnr = it_mseg-mblnr

and xblnr = mkpf-xblnr.

*****************************************************

if it_mkpf[] is not initial.

Read table it_mkpf index 1.

clear : doc_no,

inv_no,

output.

doc_no = it_mkpf-mblnr.

inv_no = it_mkpf-xblnr.

Concatenate 'This DC No:' Inv_no 'Available For Doc No : ' doc_no into output

separated by space.

Message output Type 'E'.

endif.

select mblnr frbnr from mkpf

into table it_mkpf2

FOR ALL ENTRIES IN it_mseg

where mblnr = it_mseg-mblnr

and frbnr = mkpf-frbnr.

******************************************************

if it_mkpf2[] is not INITIAL.

Read table it_mkpf2 index 1.

clear : doc_no,

inv_no,

output.

doc_no = it_mkpf2-mblnr.

inv_no = it_mkpf2-frbnr.

Concatenate 'This Invoice No:' inv_no 'Available For Doc No : ' doc_no into output

separated by space.

Message output Type 'E'.

/h

with warm regards

nagaraj

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 28, 2013 at 04:51 AM

    In which BADi did you put this code?

    you can set a global variable, so that for next pass, you can avoid checks

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      for implicit enhancements

      you can make use any sap gloabl variable (there is a danger that this can be used else where)

      better export a variable to memry For Eg: import lv_repeated call from 'memory'.

      if lv_repeated initial.

      """""""do your code

      lv_repeated = 'X'.

      export lv_repeated to memory

      endif.

  • author's profile photo Former Member
    Former Member
    Posted on May 28, 2013 at 05:00 AM

    Hi,

    If you need to check one record at a time,

    Try to declare global flag and set it for the line item it checked. If the line item errors are cleared then clear the flag and then continue your check for second line item.

    Using this approach you achieve your requirement.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 28, 2013 at 05:11 AM

    please tell us where did u put this code.

    i understand this is in Implicit Enhancement >> but which one.

    If there is any subroutine or something else.😕


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.