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: 

Hi

Former Member
0 Kudos
165

Hi,

In my program I am getting the ouput but output not in proper order. Can anyone check in 800 Client and can tell me how to write the output in Correct Order. Output Statement I had Highlighted in block Letters.

This is my program.

REPORT ZFS_TAB1 LINE-SIZE 180

LINE-COUNT 26(2)

NO STANDARD PAGE HEADING.

TYPES:

BEGIN OF TY_LFB1,

MINDK TYPE LFB1-MINDK,

END OF TY_LFB1,

BEGIN OF TY_EKKO,

EKGRP TYPE EKKO-EKGRP,

AEDAT TYPE EKKO-AEDAT,

EBELN TYPE EKKO-EBELN,

SUBMI TYPE EKKO-SUBMI,

BSART TYPE EKKO-BSART,

KTWRT TYPE EKKO-KTWRT,

LIFNR TYPE EKKO-LIFNR,

END OF TY_EKKO,

BEGIN OF TY_LFA1,

KTOKK TYPE LFA1-KTOKK,

NAME1 TYPE LFA1-NAME1,

ORT01 TYPE LFA1-ORT01,

REGIO TYPE LFA1-REGIO,

PSTLZ TYPE LFA1-PSTLZ,

TELF1 TYPE LFA1-TELF1,

TELFX TYPE LFA1-TELFX,

END OF TY_LFA1,

BEGIN OF TY_ADRC,

HOUSE_NUM1 TYPE ADRC-HOUSE_NUM1,

STREET TYPE ADRC-STREET,

PO_BOX TYPE ADRC-PO_BOX,

END OF TY_ADRC,

BEGIN OF TY_ADR6,

SMTP_ADDR TYPE ADR6-SMTP_ADDR,

END OF TY_ADR6,

BEGIN OF TY_WYT3,

LIFN2 TYPE WYT3-LIFN2,

END OF TY_WYT3.

TYPES:

BEGIN OF TY_OUTPUT,

MINDK TYPE LFB1-MINDK,

EKGRP TYPE EKKO-EKGRP,

AEDAT TYPE EKKO-AEDAT,

EBELN TYPE EKKO-EBELN,

SUBMI TYPE EKKO-SUBMI,

BSART TYPE EKKO-BSART,

KTWRT TYPE EKKO-KTWRT,

LIFNR TYPE EKKO-LIFNR,

KTOKK TYPE LFA1-KTOKK,

NAME1 TYPE LFA1-NAME1,

ORT01 TYPE LFA1-ORT01,

REGIO TYPE LFA1-REGIO,

PSTLZ TYPE LFA1-PSTLZ,

TELF1 TYPE LFA1-TELF1,

TELFX TYPE LFA1-TELFX,

HOUSE_NUM1 TYPE ADRC-HOUSE_NUM1,

STREET TYPE ADRC-STREET,

PO_BOX TYPE ADRC-PO_BOX,

SMTP_ADDR TYPE ADR6-SMTP_ADDR,

LIFN2 TYPE WYT3-LIFN2,

END OF TY_OUTPUT.

  • D A T A

DATA:

ST_LFB1 TYPE TY_LFB1,

IT_LFB1 TYPE TABLE OF TY_LFB1,

ST_EKKO TYPE TY_EKKO,

IT_EKKO TYPE TABLE OF TY_EKKO,

ST_LFA1 TYPE TY_LFA1,

IT_LFA1 TYPE TABLE OF TY_LFA1,

ST_ADRC TYPE TY_ADRC,

IT_ADRC TYPE TABLE OF TY_ADRC,

ST_ADR6 TYPE TY_ADR6,

IT_ADR6 TYPE TABLE OF TY_ADR6,

ST_WYT3 TYPE TY_WYT3,

IT_WYT3 TYPE TABLE OF TY_WYT3,

ST_OUTPUT TYPE TY_OUTPUT,

IT_OUTPUT TYPE TABLE OF TY_OUTPUT.

  • S E L E C T I O N S C R E E N

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS:

SMINDK FOR ST_LFB1-MINDK,

SAEDAT FOR ST_EKKO-AEDAT,

SEKGRP FOR ST_EKKO-EKGRP,

SLIFNR FOR ST_EKKO-LIFNR.

SELECTION-SCREEN END OF BLOCK B1.

  • T O P O F P A G E.

TOP-OF-PAGE.

<b>WRITE:/2'PUR GROUP' ,7 'DATE',15 'DOCNO', 20 'CNO', 25 'PDTY', 27 'PL VALUE',35 'VNDOR NO',40 'ACCGRP',45'NAME',55 'CITY', 65 'REGION', 75 'PCODE',

83 'TELPH',90 'TELFAX', 98 'MIND', 103 'H NUM',110 'STREET', 120 'POBOX',129 'EMAILID', 141 'INPT NUMB'.</b>

  • A T S E L E C T I O N S C R E E N

AT SELECTION-SCREEN.

PERFORM VALIDATE_MINDK.

PERFORM VALIDATE_EKGRP.

PERFORM VALIDATE_LIFNR.

  • S T A R T O F S E L E C T I O N.

START-OF-SELECTION.

PERFORM GETDATA_EKKO.

PERFORM GETMIND_LFB1.

PERFORM GET_VENDORMASTERDATA.

PERFORM GET_VENDORADDRESS.

PERFORM GET_VENDOREMAIL.

PERFORM GET_INVOICEPARTY.

SELECT EKKOEKGRP EKKOAEDAT EKKOEBELN EKKOSUBMI EKKOBSART EKKOKTWRT EKKO~LIFNR

LFA1KTOKK LFA1NAME1 LFA1ORT01 LFA1REGIO LFA1PSTLZ LFA1TELF1 LFA1TELFX LFB1MINDK ADRCHOUSE_NUM1 ADRCSTREET ADRCPO_BOX ADR6SMTP_ADDR WYT3~LIFN2 INTO

CORRESPONDING FIELDS OF TABLE IT_OUTPUT

FROM EKKO INNER JOIN LFA1 ON EKKOLIFNR EQ LFA1LIFNR

JOIN LFB1 ON LFA1LIFNR EQ LFB1LIFNR

JOIN WYT3 ON LFA1LIFNR EQ WYT3LIFNR

JOIN ADRC ON LFA1ADRNR EQ ADRCADDRNUMBER

JOIN ADR6 ON ADRCADDRNUMBER EQ ADR6ADDRNUMBER

WHERE LFB1~MINDK IN SMINDK AND

EKKO~AEDAT IN SAEDAT AND

EKKO~EKGRP IN SEKGRP AND

EKKO~LIFNR IN SLIFNR.

IF SY-SUBRC EQ 0.

LOOP AT IT_OUTPUT INTO ST_OUTPUT.

<b>WRITE:/ 2 ST_OUTPUT-EKGRP,7 ST_OUTPUT-AEDAT,15 ST_OUTPUT-EBELN,20 ST_OUTPUT-SUBMI,25 ST_OUTPUT-BSART,27 ST_OUTPUT-KTWRT,35 ST_OUTPUT-LIFNR,40 ST_OUTPUT-KTOKK,

45 ST_OUTPUT-NAME1,55 ST_OUTPUT-ORT01,65 ST_OUTPUT-REGIO,75 ST_OUTPUT-PSTLZ,83 ST_OUTPUT-TELF1,90 ST_OUTPUT-TELFX,98

ST_OUTPUT-MINDK,103 ST_OUTPUT-HOUSE_NUM1,110 ST_OUTPUT-STREET,120 ST_OUTPUT-PO_BOX,129 ST_OUTPUT-SMTP_ADDR,141 ST_OUTPUT-LIFN2.</b>

ENDLOOP.

ELSE.

WRITE:/ 'NO RECORDS FOUND'.

ENDIF.

&----


*& Form GETDATA_EKKO

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GETDATA_EKKO .

SELECT EKGRP "PURCHASING GROUP

AEDAT "DATE ON WHICH RECORD WAS CREATED

EBELN "PURCHASING DOCUMENT NUMBER

SUBMI "COLLECTIVE NUMBER

BSART "PURCHASE DOCUMENT TYPE

KTWRT "CUMULATIVE PLANNED VALUE

LIFNR "VENDOR ACCOUNT NUMBER

FROM EKKO INTO TABLE IT_EKKO

WHERE EKGRP IN SEKGRP AND LIFNR IN SLIFNR AND AEDAT IN SAEDAT AND BSTYP = 'A'.

IF SY-SUBRC EQ 0.

LOOP AT IT_EKKO INTO ST_EKKO.

WRITE:/ ST_EKKO-EKGRP,ST_EKKO-AEDAT,ST_EKKO-EBELN,ST_EKKO-SUBMI,ST_EKKO-BSART,ST_EKKO-KTWRT,ST_EKKO-KTWRT,ST_EKKO-LIFNR.

ENDLOOP.

ENDIF.

ENDFORM. " GETDATA_EKKO

&----


*& Form GETMIND_LFB1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GETMIND_LFB1 .

SELECT MINDK "MINORIY INDICATORS

FROM LFB1 INTO TABLE IT_LFB1 WHERE MINDK IN SMINDK.

IF SY-SUBRC EQ 0.

LOOP AT IT_LFB1 INTO ST_LFB1.

WRITE:/ ST_LFB1-MINDK.

ENDLOOP.

ENDIF.

ENDFORM. " GETMIND_LFB1

&----


*& Form GET_VENDORMASTERDATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_VENDORMASTERDATA .

SELECT KTOKK "VENDOR ACCOUNT NUMBER

NAME1 "NAME1

ORT01 "CITY

REGIO "REGION

PSTLZ "POSTAL CODE

TELF1 "FIRST TELEPHONE NUMBER

TELFX "FAX NUMBER

FROM LFA1 INTO TABLE IT_LFA1.

IF SY-SUBRC EQ 0.

LOOP AT IT_LFA1 INTO ST_LFA1.

WRITE:/ ST_LFA1-KTOKK,ST_LFA1-NAME1,ST_LFA1-ORT01,ST_LFA1-REGIO,ST_LFA1-PSTLZ,ST_LFA1-TELF1,ST_LFA1-TELFX.

ENDLOOP.

ENDIF.

ENDFORM. " GET_VENDORMASTERDATA

&----


*& Form GET_VENDORADDRESS

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_VENDORADDRESS .

SELECT HOUSE_NUM1 "HOUSE NUMBER1

STREET "STREET

PO_BOX "PO BOX

FROM ADRC INTO TABLE IT_ADRC.

IF SY-SUBRC EQ 0.

LOOP AT IT_ADRC INTO ST_ADRC.

WRITE:/ ST_ADRC-HOUSE_NUM1,ST_ADRC-STREET,ST_ADRC-PO_BOX.

ENDLOOP.

ENDIF.

ENDFORM. " GET_VENDORADDRESS

&----


*& Form GET_VENDOREMAIL

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_VENDOREMAIL .

SELECT SMTP_ADDR "VENDOR EMAIL ADDRESS

FROM ADR6 INTO TABLE IT_ADR6.

IF SY-SUBRC EQ 0.

LOOP AT IT_ADR6 INTO ST_ADR6.

WRITE:/ ST_ADR6-SMTP_ADDR.

ENDLOOP.

ENDIF.

ENDFORM. " GET_VENDOREMAIL

&----


*& Form GET_INVOICEPARTY

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_INVOICEPARTY .

SELECT LIFN2

FROM WYT3 INTO TABLE IT_WYT3.

IF SY-SUBRC EQ 0.

LOOP AT IT_WYT3 INTO ST_WYT3.

WRITE:/ ST_WYT3-LIFN2.

ENDLOOP.

ENDIF.

ENDFORM. " GET_INVOICEPARTY

&----


*& Form VALIDATE_MINDK

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM VALIDATE_MINDK .

DATA:

LW_MINDK TYPE T059M-MINDK,

W_INPUT TYPE C.

IF SMINDK NE 'EX'.

SELECT MINDK FROM T059M INTO LW_MINDK

WHERE MINDK IN SMINDK.

ENDSELECT.

ENDIF.

IF SY-SUBRC NE 0.

MESSAGE E000(0) WITH 'NO MINORITY INDICATOR FOR THIS CUSTOMER'.

ELSE.

W_INPUT = 'X'.

ENDIF.

ENDFORM. " VALIDATE_MINDK

&----


*& Form VALIDATE_EKGRP

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM VALIDATE_EKGRP .

DATA:

LW_EKGRP TYPE T024-EKGRP,

W_INPUT TYPE C.

IF SAEDAT IS NOT INITIAL.

SELECT EKGRP FROM T024 INTO LW_EKGRP

WHERE EKGRP IN SEKGRP.

ENDSELECT.

ENDIF.

IF SY-SUBRC NE 0.

MESSAGE E000(0) WITH 'INVALID PURCHASE GROUP RANGE'.

ELSE.

W_INPUT = 'X'.

ENDIF.

ENDFORM. " VALIDATE_EKGRP

&----


*& Form VALIDATE_LIFNR

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM VALIDATE_LIFNR .

DATA:

LW_LIFNR TYPE EKKO-LIFNR,

W_INPUT TYPE C.

IF SLIFNR IS NOT INITIAL.

SELECT LIFNR FROM EKKO INTO LW_LIFNR

WHERE LIFNR IN SLIFNR.

ENDSELECT.

ENDIF.

IF SY-SUBRC NE 0.

MESSAGE E000(0) WITH 'INVALID VENDOR GROUP RANGE'.

ELSE.

W_INPUT = 'X'.

ENDIF.

ENDFORM. " VALIDATE_LIFNR

Ram

1 ACCEPTED SOLUTION

Former Member
0 Kudos
130

Hi

Execute the following code and see

I removed the all PERFORMs you used

because we wrote a single Join for all the tables and fetching the data

Now see the output

If needed format the output as per the length of the fields

REPORT ZFS_TAB1 LINE-SIZE 180

LINE-COUNT 26(2)

NO STANDARD PAGE HEADING.

TYPES:

BEGIN OF TY_LFB1,

MINDK TYPE LFB1-MINDK,

END OF TY_LFB1,

BEGIN OF TY_EKKO,

EKGRP TYPE EKKO-EKGRP,

AEDAT TYPE EKKO-AEDAT,

EBELN TYPE EKKO-EBELN,

SUBMI TYPE EKKO-SUBMI,

BSART TYPE EKKO-BSART,

KTWRT TYPE EKKO-KTWRT,

LIFNR TYPE EKKO-LIFNR,

END OF TY_EKKO,

BEGIN OF TY_LFA1,

KTOKK TYPE LFA1-KTOKK,

NAME1 TYPE LFA1-NAME1,

ORT01 TYPE LFA1-ORT01,

REGIO TYPE LFA1-REGIO,

PSTLZ TYPE LFA1-PSTLZ,

TELF1 TYPE LFA1-TELF1,

TELFX TYPE LFA1-TELFX,

END OF TY_LFA1,

BEGIN OF TY_ADRC,

HOUSE_NUM1 TYPE ADRC-HOUSE_NUM1,

STREET TYPE ADRC-STREET,

PO_BOX TYPE ADRC-PO_BOX,

END OF TY_ADRC,

BEGIN OF TY_ADR6,

SMTP_ADDR TYPE ADR6-SMTP_ADDR,

END OF TY_ADR6,

BEGIN OF TY_WYT3,

LIFN2 TYPE WYT3-LIFN2,

END OF TY_WYT3.

TYPES:

BEGIN OF TY_OUTPUT,

MINDK TYPE LFB1-MINDK,

EKGRP TYPE EKKO-EKGRP,

AEDAT TYPE EKKO-AEDAT,

EBELN TYPE EKKO-EBELN,

SUBMI TYPE EKKO-SUBMI,

BSART TYPE EKKO-BSART,

KTWRT TYPE EKKO-KTWRT,

LIFNR TYPE EKKO-LIFNR,

KTOKK TYPE LFA1-KTOKK,

NAME1 TYPE LFA1-NAME1,

ORT01 TYPE LFA1-ORT01,

REGIO TYPE LFA1-REGIO,

PSTLZ TYPE LFA1-PSTLZ,

TELF1 TYPE LFA1-TELF1,

TELFX TYPE LFA1-TELFX,

HOUSE_NUM1 TYPE ADRC-HOUSE_NUM1,

STREET TYPE ADRC-STREET,

PO_BOX TYPE ADRC-PO_BOX,

SMTP_ADDR TYPE ADR6-SMTP_ADDR,

LIFN2 TYPE WYT3-LIFN2,

END OF TY_OUTPUT.

  • D A T A

DATA:

ST_LFB1 TYPE TY_LFB1,

IT_LFB1 TYPE TABLE OF TY_LFB1,

ST_EKKO TYPE TY_EKKO,

IT_EKKO TYPE TABLE OF TY_EKKO,

ST_LFA1 TYPE TY_LFA1,

IT_LFA1 TYPE TABLE OF TY_LFA1,

ST_ADRC TYPE TY_ADRC,

IT_ADRC TYPE TABLE OF TY_ADRC,

ST_ADR6 TYPE TY_ADR6,

IT_ADR6 TYPE TABLE OF TY_ADR6,

ST_WYT3 TYPE TY_WYT3,

IT_WYT3 TYPE TABLE OF TY_WYT3,

ST_OUTPUT TYPE TY_OUTPUT,

IT_OUTPUT TYPE TABLE OF TY_OUTPUT.

  • S E L E C T I O N S C R E E N

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS:

SMINDK FOR ST_LFB1-MINDK,

SAEDAT FOR ST_EKKO-AEDAT,

SEKGRP FOR ST_EKKO-EKGRP,

SLIFNR FOR ST_EKKO-LIFNR.

SELECTION-SCREEN END OF BLOCK B1.

  • T O P O F P A G E.

TOP-OF-PAGE.

WRITE:/2'PUR GROUP' ,7 'DATE',15 'DOCNO', 20 'CNO', 25 'PDTY', 27 'PL VALUE',35 'VNDOR NO',40 'ACCGRP',45'NAME',55 'CITY', 65 'REGION', 75 'PCODE',

83 'TELPH',90 'TELFAX', 98 'MIND', 103 'H NUM',110 'STREET', 120 'POBOX',129 'EMAILID', 141 'INPT NUMB'.

  • A T S E L E C T I O N S C R E E N

AT SELECTION-SCREEN.

PERFORM VALIDATE_MINDK.

PERFORM VALIDATE_EKGRP.

PERFORM VALIDATE_LIFNR.

  • S T A R T O F S E L E C T I O N.

START-OF-SELECTION.

SELECT EKKOEKGRP EKKOAEDAT EKKOEBELN EKKOSUBMI EKKOBSART EKKOKTWRT EKKO~LIFNR

LFA1KTOKK LFA1NAME1 LFA1ORT01 LFA1REGIO LFA1PSTLZ LFA1TELF1 LFA1TELFX LFB1MINDK ADRCHOUSE_NUM1 ADRCSTREET ADRCPO_BOX ADR6SMTP_ADDR WYT3~LIFN2 INTO

CORRESPONDING FIELDS OF TABLE IT_OUTPUT

FROM EKKO INNER JOIN LFA1 ON EKKOLIFNR EQ LFA1LIFNR

JOIN LFB1 ON LFA1LIFNR EQ LFB1LIFNR

JOIN WYT3 ON LFA1LIFNR EQ WYT3LIFNR

JOIN ADRC ON LFA1ADRNR EQ ADRCADDRNUMBER

JOIN ADR6 ON ADRCADDRNUMBER EQ ADR6ADDRNUMBER

WHERE LFB1~MINDK IN SMINDK AND

EKKO~AEDAT IN SAEDAT AND

EKKO~EKGRP IN SEKGRP AND

EKKO~LIFNR IN SLIFNR.

IF SY-SUBRC EQ 0.

LOOP AT IT_OUTPUT INTO ST_OUTPUT.

WRITE:/ 2 ST_OUTPUT-EKGRP,7 ST_OUTPUT-AEDAT,15 ST_OUTPUT-EBELN,20 ST_OUTPUT-SUBMI,25 ST_OUTPUT-BSART,27 ST_OUTPUT-KTWRT,35 ST_OUTPUT-LIFNR,40 ST_OUTPUT-KTOKK,

45 ST_OUTPUT-NAME1,55 ST_OUTPUT-ORT01,65 ST_OUTPUT-REGIO,75 ST_OUTPUT-PSTLZ,83 ST_OUTPUT-TELF1,90 ST_OUTPUT-TELFX,98

ST_OUTPUT-MINDK,103 ST_OUTPUT-HOUSE_NUM1,110 ST_OUTPUT-STREET,120 ST_OUTPUT-PO_BOX,129 ST_OUTPUT-SMTP_ADDR,141 ST_OUTPUT-LIFN2.

ENDLOOP.

ELSE.

WRITE:/ 'NO RECORDS FOUND'.

ENDIF.

&----


*& Form VALIDATE_MINDK

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM VALIDATE_MINDK .

DATA:

LW_MINDK TYPE T059M-MINDK,

W_INPUT TYPE C.

IF SMINDK NE 'EX'.

SELECT MINDK FROM T059M INTO LW_MINDK

WHERE MINDK IN SMINDK.

ENDSELECT.

ENDIF.

IF SY-SUBRC NE 0.

MESSAGE E000(0) WITH 'NO MINORITY INDICATOR FOR THIS CUSTOMER'.

ELSE.

W_INPUT = 'X'.

ENDIF.

ENDFORM. " VALIDATE_MINDK

&----


*& Form VALIDATE_EKGRP

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM VALIDATE_EKGRP .

DATA:

LW_EKGRP TYPE T024-EKGRP,

W_INPUT TYPE C.

IF SAEDAT IS NOT INITIAL.

SELECT EKGRP FROM T024 INTO LW_EKGRP

WHERE EKGRP IN SEKGRP.

ENDSELECT.

ENDIF.

IF SY-SUBRC NE 0.

MESSAGE E000(0) WITH 'INVALID PURCHASE GROUP RANGE'.

ELSE.

W_INPUT = 'X'.

ENDIF.

ENDFORM. " VALIDATE_EKGRP

&----


*& Form VALIDATE_LIFNR

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM VALIDATE_LIFNR .

DATA:

LW_LIFNR TYPE EKKO-LIFNR,

W_INPUT TYPE C.

IF SLIFNR IS NOT INITIAL.

SELECT LIFNR FROM EKKO INTO LW_LIFNR

WHERE LIFNR IN SLIFNR.

ENDSELECT.

ENDIF.

*F SY-SUBRC NE 0.

MESSAGE E000(0) WITH 'INVALID VENDOR GROUP RANGE'.

ELSE.

W_INPUT = 'X'.

ENDIF.

ENDFORM. " VALIDATE_LIFNR

<b>Reward points for useful Answers</b>

Regards

Anji

5 REPLIES 5

Former Member
0 Kudos
130

please refer u r length of the output field.

example.

mandt is 3 charater.

kunnr is 10 charater

write / 0(3) mandt, 4(10)kunnr.

Message was edited by:

Karthikeyan Pandurangan

Former Member
0 Kudos
131

Hi

Execute the following code and see

I removed the all PERFORMs you used

because we wrote a single Join for all the tables and fetching the data

Now see the output

If needed format the output as per the length of the fields

REPORT ZFS_TAB1 LINE-SIZE 180

LINE-COUNT 26(2)

NO STANDARD PAGE HEADING.

TYPES:

BEGIN OF TY_LFB1,

MINDK TYPE LFB1-MINDK,

END OF TY_LFB1,

BEGIN OF TY_EKKO,

EKGRP TYPE EKKO-EKGRP,

AEDAT TYPE EKKO-AEDAT,

EBELN TYPE EKKO-EBELN,

SUBMI TYPE EKKO-SUBMI,

BSART TYPE EKKO-BSART,

KTWRT TYPE EKKO-KTWRT,

LIFNR TYPE EKKO-LIFNR,

END OF TY_EKKO,

BEGIN OF TY_LFA1,

KTOKK TYPE LFA1-KTOKK,

NAME1 TYPE LFA1-NAME1,

ORT01 TYPE LFA1-ORT01,

REGIO TYPE LFA1-REGIO,

PSTLZ TYPE LFA1-PSTLZ,

TELF1 TYPE LFA1-TELF1,

TELFX TYPE LFA1-TELFX,

END OF TY_LFA1,

BEGIN OF TY_ADRC,

HOUSE_NUM1 TYPE ADRC-HOUSE_NUM1,

STREET TYPE ADRC-STREET,

PO_BOX TYPE ADRC-PO_BOX,

END OF TY_ADRC,

BEGIN OF TY_ADR6,

SMTP_ADDR TYPE ADR6-SMTP_ADDR,

END OF TY_ADR6,

BEGIN OF TY_WYT3,

LIFN2 TYPE WYT3-LIFN2,

END OF TY_WYT3.

TYPES:

BEGIN OF TY_OUTPUT,

MINDK TYPE LFB1-MINDK,

EKGRP TYPE EKKO-EKGRP,

AEDAT TYPE EKKO-AEDAT,

EBELN TYPE EKKO-EBELN,

SUBMI TYPE EKKO-SUBMI,

BSART TYPE EKKO-BSART,

KTWRT TYPE EKKO-KTWRT,

LIFNR TYPE EKKO-LIFNR,

KTOKK TYPE LFA1-KTOKK,

NAME1 TYPE LFA1-NAME1,

ORT01 TYPE LFA1-ORT01,

REGIO TYPE LFA1-REGIO,

PSTLZ TYPE LFA1-PSTLZ,

TELF1 TYPE LFA1-TELF1,

TELFX TYPE LFA1-TELFX,

HOUSE_NUM1 TYPE ADRC-HOUSE_NUM1,

STREET TYPE ADRC-STREET,

PO_BOX TYPE ADRC-PO_BOX,

SMTP_ADDR TYPE ADR6-SMTP_ADDR,

LIFN2 TYPE WYT3-LIFN2,

END OF TY_OUTPUT.

  • D A T A

DATA:

ST_LFB1 TYPE TY_LFB1,

IT_LFB1 TYPE TABLE OF TY_LFB1,

ST_EKKO TYPE TY_EKKO,

IT_EKKO TYPE TABLE OF TY_EKKO,

ST_LFA1 TYPE TY_LFA1,

IT_LFA1 TYPE TABLE OF TY_LFA1,

ST_ADRC TYPE TY_ADRC,

IT_ADRC TYPE TABLE OF TY_ADRC,

ST_ADR6 TYPE TY_ADR6,

IT_ADR6 TYPE TABLE OF TY_ADR6,

ST_WYT3 TYPE TY_WYT3,

IT_WYT3 TYPE TABLE OF TY_WYT3,

ST_OUTPUT TYPE TY_OUTPUT,

IT_OUTPUT TYPE TABLE OF TY_OUTPUT.

  • S E L E C T I O N S C R E E N

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS:

SMINDK FOR ST_LFB1-MINDK,

SAEDAT FOR ST_EKKO-AEDAT,

SEKGRP FOR ST_EKKO-EKGRP,

SLIFNR FOR ST_EKKO-LIFNR.

SELECTION-SCREEN END OF BLOCK B1.

  • T O P O F P A G E.

TOP-OF-PAGE.

WRITE:/2'PUR GROUP' ,7 'DATE',15 'DOCNO', 20 'CNO', 25 'PDTY', 27 'PL VALUE',35 'VNDOR NO',40 'ACCGRP',45'NAME',55 'CITY', 65 'REGION', 75 'PCODE',

83 'TELPH',90 'TELFAX', 98 'MIND', 103 'H NUM',110 'STREET', 120 'POBOX',129 'EMAILID', 141 'INPT NUMB'.

  • A T S E L E C T I O N S C R E E N

AT SELECTION-SCREEN.

PERFORM VALIDATE_MINDK.

PERFORM VALIDATE_EKGRP.

PERFORM VALIDATE_LIFNR.

  • S T A R T O F S E L E C T I O N.

START-OF-SELECTION.

SELECT EKKOEKGRP EKKOAEDAT EKKOEBELN EKKOSUBMI EKKOBSART EKKOKTWRT EKKO~LIFNR

LFA1KTOKK LFA1NAME1 LFA1ORT01 LFA1REGIO LFA1PSTLZ LFA1TELF1 LFA1TELFX LFB1MINDK ADRCHOUSE_NUM1 ADRCSTREET ADRCPO_BOX ADR6SMTP_ADDR WYT3~LIFN2 INTO

CORRESPONDING FIELDS OF TABLE IT_OUTPUT

FROM EKKO INNER JOIN LFA1 ON EKKOLIFNR EQ LFA1LIFNR

JOIN LFB1 ON LFA1LIFNR EQ LFB1LIFNR

JOIN WYT3 ON LFA1LIFNR EQ WYT3LIFNR

JOIN ADRC ON LFA1ADRNR EQ ADRCADDRNUMBER

JOIN ADR6 ON ADRCADDRNUMBER EQ ADR6ADDRNUMBER

WHERE LFB1~MINDK IN SMINDK AND

EKKO~AEDAT IN SAEDAT AND

EKKO~EKGRP IN SEKGRP AND

EKKO~LIFNR IN SLIFNR.

IF SY-SUBRC EQ 0.

LOOP AT IT_OUTPUT INTO ST_OUTPUT.

WRITE:/ 2 ST_OUTPUT-EKGRP,7 ST_OUTPUT-AEDAT,15 ST_OUTPUT-EBELN,20 ST_OUTPUT-SUBMI,25 ST_OUTPUT-BSART,27 ST_OUTPUT-KTWRT,35 ST_OUTPUT-LIFNR,40 ST_OUTPUT-KTOKK,

45 ST_OUTPUT-NAME1,55 ST_OUTPUT-ORT01,65 ST_OUTPUT-REGIO,75 ST_OUTPUT-PSTLZ,83 ST_OUTPUT-TELF1,90 ST_OUTPUT-TELFX,98

ST_OUTPUT-MINDK,103 ST_OUTPUT-HOUSE_NUM1,110 ST_OUTPUT-STREET,120 ST_OUTPUT-PO_BOX,129 ST_OUTPUT-SMTP_ADDR,141 ST_OUTPUT-LIFN2.

ENDLOOP.

ELSE.

WRITE:/ 'NO RECORDS FOUND'.

ENDIF.

&----


*& Form VALIDATE_MINDK

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM VALIDATE_MINDK .

DATA:

LW_MINDK TYPE T059M-MINDK,

W_INPUT TYPE C.

IF SMINDK NE 'EX'.

SELECT MINDK FROM T059M INTO LW_MINDK

WHERE MINDK IN SMINDK.

ENDSELECT.

ENDIF.

IF SY-SUBRC NE 0.

MESSAGE E000(0) WITH 'NO MINORITY INDICATOR FOR THIS CUSTOMER'.

ELSE.

W_INPUT = 'X'.

ENDIF.

ENDFORM. " VALIDATE_MINDK

&----


*& Form VALIDATE_EKGRP

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM VALIDATE_EKGRP .

DATA:

LW_EKGRP TYPE T024-EKGRP,

W_INPUT TYPE C.

IF SAEDAT IS NOT INITIAL.

SELECT EKGRP FROM T024 INTO LW_EKGRP

WHERE EKGRP IN SEKGRP.

ENDSELECT.

ENDIF.

IF SY-SUBRC NE 0.

MESSAGE E000(0) WITH 'INVALID PURCHASE GROUP RANGE'.

ELSE.

W_INPUT = 'X'.

ENDIF.

ENDFORM. " VALIDATE_EKGRP

&----


*& Form VALIDATE_LIFNR

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM VALIDATE_LIFNR .

DATA:

LW_LIFNR TYPE EKKO-LIFNR,

W_INPUT TYPE C.

IF SLIFNR IS NOT INITIAL.

SELECT LIFNR FROM EKKO INTO LW_LIFNR

WHERE LIFNR IN SLIFNR.

ENDSELECT.

ENDIF.

*F SY-SUBRC NE 0.

MESSAGE E000(0) WITH 'INVALID VENDOR GROUP RANGE'.

ELSE.

W_INPUT = 'X'.

ENDIF.

ENDFORM. " VALIDATE_LIFNR

<b>Reward points for useful Answers</b>

Regards

Anji

former_member196280
Active Contributor
0 Kudos
130

Try to write it like this

WRITE:/ 2(4) ST_OUTPUT-EKGRP, "Start from column 2 and size is 4

7(7) ST_OUTPUT-AEDAT, "start from column and max size is 7

15(4) ST_OUTPUT-EBELN,

20(4) ST_OUTPUT-SUBMI,

25(1) ST_OUTPUT-BSART,

27(7) ST_OUTPUT-KTWRT,

35(4) ST_OUTPUT-LIFNR,

40(4) ST_OUTPUT-KTOKK, etc.

Regards,

Sairam

Former Member
0 Kudos
130

If you tell me what is the problem,then someone can answer.

output not coming means what??fielda re missing or not in proper format?

incase if fields are not coming,then increase the length

ex : write 😕 2 pur group

purchase group is itself 9 characters,if you give spce 7 ,for next field,how it will display.

Thanks

Former Member
0 Kudos
130

Hi,

you can write like this.

uline.

write: /(10) 'Purch.grp' , '|' , (14) 'Doc.Cre.Date' , '|' , (10) 'Pur.Doc.No' , '|', (10) 'Doc.Type' , '|' , (15) 'Cum.Pln.Value' , '|' , (10) 'Vendor No' , '|' , (10) 'Acc.Grp' , '|' , (35) 'Name' , '|' , (35) 'City' , '|' , (10) 'Region' , '|' ,

(10) 'Post.Code' , '|' , (16) 'Tel.No' , '|' , (31) 'Fax Number' , '|' , (10) 'House No' , '|' ,

(40) 'Street' , '|' .

uline.

now loop at ur final internal table.

loop at itab into watab.

write :/(10) watab-purgrp under 'Purch.grp' , '|' ,

(14) watab-date under 'Doc.Cre.Date' , '|' .

endloop.

with in the loop u can write the values using the same length used for the header using UNDER statement.

If it helps...

REWARD/.

rgds

harris