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: 

display itab

Former Member
0 Kudos

Hi,

I have 4 different parameters,which iam passing paramter values into 4 different tables.All 4 tables having the relations.

If i pass the values in header table, iam getting the values from detail table into ITAB.

If i pass the values into detail table iam not getting ENTIRE related values into ITAB.My objective is to get the COMPLETE RELATED DATA if user enters value in ANY parameter.How can i achive this?Where i need to make changes?Here is my code.

REPORT ZQMUP01_INSPECTION MESSAGE-ID ZM

NO STANDARD PAGE HEADING

LINE-SIZE 225.

tables: qals,

mkpf,

mseg,

makt,

lfa1,

ekko,

ekpo,

afko,

afpo.

data: begin of t_ins occurs 0,

XBLNR LIKE MKPF-XBLNR,

MJAHR LIKE MKPF-MJAHR,

EBELN LIKE MSEG-EBELN,

MATNR LIKE MSEG-MATNR,

MAKTX LIKE MAKT-MAKTX,

MENGE LIKE MSEG-MENGE,

MEINS LIKE MSEG-MEINS,

PRUEFLOS LIKE QALS-PRUEFLOS,

AUFNR LIKE AFKO-AUFNR,

CPUDT LIKE MKPF-CPUDT,

MBLNR LIKE MKPF-MBLNR,

LIFNR LIKE LFA1-LIFNR,

NAME1 LIKE LFA1-NAME1,

ZEILE LIKE MSEG-ZEILE,

REASON LIKE ZQI01-REASON,

end of t_ins.

selection-screen begin of block a1 with frame title text-001.

<b>PARAMETERS : P_WERKS LIKE MSEG-WERKS DEFAULT '1000'.

PARAMETERS : P_XBLNR LIKE MKPF-XBLNR.

PARAMETERS : P_EBELN LIKE MSEG-EBELN.

PARAMETERS : P_INSLOT LIKE QALS-PRUEFLOS.

PARAMETERS : P_AUFNR LIKE AFKO-AUFNR.</b>

selection-screen end of block a1.

top-of-page.

perform set_header.

end-of-page.

start-of-selection.

if P_XBLNR eq '' and P_EBELN ne ''.

message i000(zm) with 'Please enter Delivery Note'.

leave list-processing.

elseif P_XBLNR ne '' and P_EBELN eq ''.

message i000(zm) with 'Please enter Purchase order'.

leave list-processing.

else.

perform get_data.

endif.

perform display_data.

end-of-selection.

&----


*& Form get_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM get_data .

SELECT * INTO CORRESPONDING FIELDS OF TABLE T_INS FROM MKPF

WHERE ( VGART EQ 'WE' OR VGART = 'WA' )

AND XBLNR = <b>P_XBLNR.</b>

LOOP AT T_INS.

SELECT SINGLE * FROM MSEG WHERE MBLNR = T_INS-MBLNR

AND MJAHR = T_INS-MJAHR

AND WERKS = <b>P_WERKS.</b>

IF SY-SUBRC = 0.

MOVE-CORRESPONDING MSEG TO T_INS.

MODIFY T_INS.

CLEAR T_INS.

ENDIF.

ENDLOOP.

LOOP AT T_INS.

DELETE T_INS WHERE EBELN NE P_EBELN.

SELECT SINGLE MAKTX INTO T_INS-MAKTX FROM MAKT

WHERE MATNR = T_INS-MATNR.

SELECT SINGLE NAME1 INTO T_INS-NAME1 FROM LFA1

WHERE LIFNR = T_INS-LIFNR.

SELECT SINGLE PRUEFLOS INTO T_INS-PRUEFLOS FROM QALS

WHERE MBLNR = T_INS-MBLNR or

<b>PRUEFLOS = P_INSLOT</b>

SELECT SINGLE REASON INTO T_INS-REASON FROM ZQI01

WHERE DELNOTE = T_INS-XBLNR

AND MBLNR = T_INS-MBLNR.

IF SY-SUBRC = 0.

MODIFY T_INS.

CLEAR T_INS.

ENDIF.

ENDLOOP.

ENDFORM. " get_data

&----


*& Form display_data

&----


  • text

----


FORM display_data.

DATA: MARKFIELD(1) TYPE C.

  • data: chk as checkbox.

  • loop at t_ins.

  • write:/0(6) MARKFIELD AS CHECKBOX.

write: MARKFIELD AS CHECKBOX.

write: /6(10) t_ins-xblnr,

17(16) t_ins-matnr,

34(21) t_ins-maktx,

56(10) t_ins-menge,

66(15) t_ins-PRUEFLOS,

82(14) t_ins-aufnr,

96(6) t_ins-meins,

102(10) t_ins-cpudt,

113(12) t_ins-mblnr,

126(20) t_ins-name1,

146(10) t_ins-lifnr,

157(5) t_ins-zeile,

163(12) 'QI doc',

175(10) 'QI date',

185(8) 'QI day',

193(35) t_ins-Reason.

  • endloop.

ENDFORM. "display_data

*&----


*

*& Form set_page_header

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


FORM set_header .

uline.

write:/0(6) space color col_heading,

6(10) 'DN number' color col_heading,

17(16) 'Material' color col_heading,

34(21) 'Matl Description' color col_heading,

56(10) 'Quantity' color col_heading,

66(15) 'Inspection lot' color col_heading,

82(14) 'Prod order' color col_heading,

96(6) 'UOM' color col_heading,

102(10) 'GR date' color col_heading,

113(12) 'GR doc' color col_heading,

126(20) 'Vendor name' color col_heading,

146(10) 'Vendor' color col_heading,

157(5) 'Item' color col_heading,

163(12) 'QI doc' color col_heading,

175(10) 'QI date' color col_heading,

185(8) 'QI day' color col_heading,

193(35) 'Reason' color col_heading.

WRITE : 1 SY-VLINE, 5 SY-VLINE, 16 SY-VLINE, 33 SY-VLINE,

55 SY-VLINE, 65 SY-VLINE, 81 SY-VLINE, 95 SY-VLINE,

101 SY-VLINE,112 SY-VLINE,125 SY-VLINE,145 SY-VLINE,

156 SY-VLINE,162 SY-VLINE,174 SY-VLINE,184 SY-VLINE,

191 SY-VLINE,225 SY-VLINE.

uline.

ENDFORM. " set_page_header

points guaranteed

cheers

kaki

<b></b>

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Kaki,

I think it has to do with the order of your SELECT statements.

If you are able to select the header and then going to child it will work. However, if you don't have header rows and try to loop through that internal table, then you will not get any rows as the table of header does not have any data.

You should check if the data exists in each of the parameters and then fire the SELECTS appropriately.

Regards

Ravi

2 REPLIES 2

Former Member
0 Kudos

Kaki,

I think it has to do with the order of your SELECT statements.

If you are able to select the header and then going to child it will work. However, if you don't have header rows and try to loop through that internal table, then you will not get any rows as the table of header does not have any data.

You should check if the data exists in each of the parameters and then fire the SELECTS appropriately.

Regards

Ravi

former_member188685
Active Contributor
0 Kudos

First check the test data, and try as they are parameters you cannot get any data if selects fails.

either get test data or make them as select options and try...

vijay